From 1cc5a78218011a78fb69ca7c3d6afb885cf8f4a7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Dec 2005 13:32:38 +0100 Subject: * ui-polish, show 4 steps during the upgrade --- DistUpgrade/DistUpgrade.glade | 416 +++++++++++++++++++++++++++++------- DistUpgrade/DistUpgradeControler.py | 4 + DistUpgrade/DistUpgradeView.py | 8 + DistUpgrade/DistUpgradeViewGtk.py | 42 +++- 4 files changed, 389 insertions(+), 81 deletions(-) diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index f705cf3d..4773b007 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -10,7 +10,7 @@ GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False - True + False False True False @@ -38,8 +38,8 @@ False 0.5 0.5 - 0 - 0 + 12 + 12 PANGO_ELLIPSIZE_NONE -1 False @@ -53,96 +53,368 @@ - - - - - + True - - False - False - GTK_JUSTIFY_LEFT - False - False 0.5 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + 1 + 1 + 0 + 12 + 12 + 12 - - - True - GTK_PROGRESS_LEFT_TO_RIGHT - 0 - 0.10000000149 - PANGO_ELLIPSIZE_NONE - - - 0 - False - False - - + + + True + 4 + 2 + False + 12 + 12 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + + + 16 + 16 + True + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + + + + + + 16 + 16 + True + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + 16 + 16 + True + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + 16 + 16 + True + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + True + Analyzing the system + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + Updating repository information + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + Performing the upgrade + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 2 + 3 + fill + + + + + + + True + Post upgrade stuff + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 3 + 4 + fill + + + + + 0 - False - False + True + True - - True - False - 0 + + True + 0 + 0.5 + GTK_SHADOW_NONE - + True - create_terminal - 0 - 0 - Tue, 06 Dec 2005 20:03:08 GMT + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 0 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + GTK_PROGRESS_LEFT_TO_RIGHT + 0 + 0.10000000149 + PANGO_ELLIPSIZE_NONE + + + 0 + False + False + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + 0 + + + + True + create_terminal + 0 + 0 + Tue, 06 Dec 2005 20:03:08 GMT + + + + + + True + Terminal + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + - + True - Terminal + <b>Action</b> False - False + True GTK_JUSTIFY_LEFT False False diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index e5c09249..a6fc4111 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -196,6 +196,7 @@ class DistUpgradeControler(object): def breezyUpgrade(self): # sanity check (check for ubuntu-desktop, brokenCache etc) self._view.updateStatus(_("Checking the system")) + self._view.setStep(1) if not self.sanityCheck(): sys.exit(1) @@ -203,6 +204,7 @@ class DistUpgradeControler(object): self.doPreUpgrade() # update sources.list + self._view.setStep(2) self._view.updateStatus(_("Updating repository information")) if not self.updateSourcesList(): sys.exit(1) @@ -215,12 +217,14 @@ class DistUpgradeControler(object): # calc the dist-upgrade and see if the removals are ok/expected # do the dist-upgrade + self._view.setStep(3) self._view.updateStatus(_("Performing the upgrade")) if not self.askDistUpgrade(): sys.exit(1) self.doDistUpgrade() # do post-upgrade stuff + self._view.setStep(4) self.doPostUpgrade() # done, ask for reboot diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py index 98e80c08..c94a9137 100644 --- a/DistUpgrade/DistUpgradeView.py +++ b/DistUpgrade/DistUpgradeView.py @@ -17,6 +17,14 @@ class DistUpgradeView(object): on the current view """ pass + def setStep(self, step): + """ we have 4 steps current for a upgrade: + 1. Analyzing the system + 2. Updating repository information + 3. Performing the upgrade + 4. Post upgrade stuff + """ + pass def confirmChanges(self, changes, downloadSize): """ display the list of changed packages (apt.Package) and return if the user confirms them diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index fa4aa4ee..4bf6e8e2 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -14,9 +14,22 @@ from apt.progress import InstallProgress from DistUpgradeView import DistUpgradeView from UpdateManager.Common.SimpleGladeApp import SimpleGladeApp -from UpdateManager.GtkProgress import GtkOpProgress from gettext import gettext as _ +class GtkOpProgress(apt.progress.OpProgress): + def __init__(self, progressbar): + self._progressbar = progressbar + def update(self, percent): + #self._progressbar.show() + self._progressbar.set_text(self.op) + self._progressbar.set_fraction(percent/100.0) + while gtk.events_pending(): + gtk.main_iteration() + def done(self): + #self._progressbar.hide() + pass + + class GtkFetchProgressAdapter(apt.progress.FetchProgress): # FIXME: we really should have some sort of "we are at step" # xy in the gui @@ -26,13 +39,12 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress): self.status = parent.label_extra_status self.progress = parent.progressbar_cache def start(self): - self.progress.show() + #self.progress.show() self.progress.set_fraction(0) self.status.show() def stop(self): - self.progress.hide() - self.status.hide() - self.status.hide() + #self.progress.hide() + self.status.set_text("") def pulse(self): # FIXME: move the status_str and progress_str into python-apt # (python-apt need i18n first for this) @@ -65,9 +77,9 @@ class GtkInstallProgressAdapter(InstallProgress): # FIXME: add support for the timeout # of the terminal (to display something useful then) # -> longer term, move this code into python-apt - self.label_status.show() + #self.label_status.show() self.label_status.set_text(_("Installing updates ...")) - self.progress.show() + #self.progress.show() self.progress.set_fraction(0.0) self.progress.set_text("") self.expander.show() @@ -89,8 +101,8 @@ class GtkInstallProgressAdapter(InstallProgress): self.updateInterface() return self.apt_status def finishUpdate(self): - self.progress.hide() - self.label_status.hide() + #self.progress.hide() + self.label_status.set_text("") def updateInterface(self): InstallProgress.updateInterface(self) self.progress.set_fraction(self.percent/100.0) @@ -133,6 +145,18 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): return self._opCacheProgress def updateStatus(self, msg): self.label_status.set_markup("%s" % msg) + def setStep(self, step): + # first update the "last" step as completed + size = gtk.ICON_SIZE_MENU + if step > 1: + image = getattr(self,"image_step%i" % (step-1)) + label = getattr(self,"label_step%i" % (step-1)) + image.set_from_stock(gtk.STOCK_APPLY, size) + image = getattr(self,"image_step%i" % step) + label = getattr(self,"label_step%i" % step) + image.set_from_stock(gtk.STOCK_YES, size) + + def error(self, summary, msg): dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,"") -- cgit v1.2.3