Skip to content

Commit

Permalink
Move progress to separate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 22, 2016
1 parent 5fbe297 commit df4eaab
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions src/lib/installation/clients/inst_update_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,7 @@ def main
# shortcut - already updated
return :next if installer_updated?

# open a new wizard dialog with title on the top
# (the default dialog with title on the left looks ugly with the
# Progress dialog)
Yast::Wizard.CreateDialog
@wizard_open = true

Yast::Progress.New(
# TRANSLATORS: dialog title
_("Updating the Installer..."),
# TRANSLATORS: progress title
_("Updating the Installer..."),
# max is 100%
100,
# stages
[
# TRANSLATORS: progress label
_("Add Update Repository"),
_("Download the Packages"),
_("Restart")
],
# steps
[],
# help text
""
)

# mark the first stage active
Yast::Progress.NextStage
initialize_progress

# initialize packager, we need to load the base product name
# to properly obtain the update URL from the registration server
Expand All @@ -106,10 +79,7 @@ def main
:next
end
ensure
if @wizard_open
Yast::Progress.Finish
Yast::Wizard.CloseDialog
end
finish_progress
end

# Tries to update the installer
Expand Down Expand Up @@ -550,5 +520,45 @@ def finish_packager
Pkg.SourceGetCurrent(false).each { |r| Pkg.SourceDelete(r) }
Pkg.SourceSaveAll
end

# Show global self update progress
def initialize_progress
# open a new wizard dialog with title on the top
# (the default dialog with title on the left looks ugly with the
# Progress dialog)
Yast::Wizard.CreateDialog
@wizard_open = true

Yast::Progress.New(
# TRANSLATORS: dialog title
_("Updating the Installer..."),
# TRANSLATORS: progress title
_("Updating the Installer..."),
# max is 100%
100,
# stages
[
# TRANSLATORS: progress label
_("Add Update Repository"),
_("Download the Packages"),
_("Restart")
],
# steps
[],
# help text
""
)

# mark the first stage active
Yast::Progress.NextStage
end

# Finish the self update progress
def finish_progress
return unless @wizard_open

Yast::Progress.Finish
Yast::Wizard.CloseDialog
end
end
end

0 comments on commit df4eaab

Please sign in to comment.