Skip to content

Commit

Permalink
Consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Mar 29, 2022
1 parent aff677a commit 4dd79e3
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/modules/PackageSlideShow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ def init_member_vars
@total_size_to_install = 0 # also used in one click installer
@expected_total_download_size = 0
@finished_total_download_size = 0
@current_pkg_download_size = 0
@current_pkg_download_percent = 0
@current_pkg_name = ""

@active_downloads = 0
@detected_parallel_download = false

# Those @current_pkg_... variables keep track of the most recent current
# download. Avoid using them if parallel downloads are in effect.

@current_download_pkg_size = 0 # RPM size, not installed size
@current_download_pkg_percent = 0
@current_download_pkg_name = ""

@installed_pkg_list = []
@updated_pkg_list = []
@removed_pkg_list = []
Expand Down Expand Up @@ -201,7 +206,7 @@ def UpdateTotalProgressValue
# the installed system (e.g. kernel updates).
#
def CurrentDownloadSize
current_pkg = @current_pkg_download_size * @current_pkg_download_percent / 100
current_pkg = @current_download_pkg_size * @current_download_pkg_percent / 100
@finished_total_download_size + current_pkg
end

Expand Down Expand Up @@ -250,9 +255,9 @@ def DownloadStart(pkg_name, download_size)
@active_downloads += 1
log.info "DownloadStart #{pkg_name} size: #{download_size}"
log.info "active downloads: #{@active_downloads}" if @active_downloads > 1
@current_pkg_name = pkg_name
@current_pkg_download_size = download_size
@current_pkg_download_percent = 0
@current_download_pkg_name = pkg_name
@current_download_pkg_size = download_size
@current_download_pkg_percent = 0
return if parallel_download?

# Update the progress text since it may change from "Installing..." to
Expand All @@ -264,8 +269,8 @@ def DownloadStart(pkg_name, download_size)

# Update the download progress for the current package
def DownloadProgress(pkg_percent)
log.info "#{@current_pkg_name}: #{pkg_percent}%"
@current_pkg_download_percent = pkg_percent
log.info "#{@current_download_pkg_name}: #{pkg_percent}%"
@current_download_pkg_percent = pkg_percent
return if parallel_download?

UpdateTotalProgressValue()
Expand Down Expand Up @@ -299,10 +304,10 @@ def DownloadError(error, reason, pkg_name)
# Finalize the sums for the current download
def CurrentDownloadFinished
@active_downloads -= 1 if @active_downloads > 0
@finished_total_download_size += @current_pkg_download_size
@current_pkg_download_size = 0
@current_pkg_download_percent = 0
@current_pkg_name = ""
@finished_total_download_size += @current_download_pkg_size
@current_download_pkg_size = 0
@current_download_pkg_percent = 0
@current_download_pkg_name = ""
end

# Notification that a package starts being installed, updated or removed.
Expand Down

0 comments on commit 4dd79e3

Please sign in to comment.