diff options
| author | Michael Vogt <egon@top> | 2005-12-07 13:32:38 +0100 |
|---|---|---|
| committer | Michael Vogt <egon@top> | 2005-12-07 13:32:38 +0100 |
| commit | 1cc5a78218011a78fb69ca7c3d6afb885cf8f4a7 (patch) | |
| tree | bbe3b465dfe902e028030b9d27afc72d82f02933 /DistUpgrade | |
| parent | a03af80fb420ac3889c46707fd9abaa3b6735f03 (diff) | |
| download | python-apt-1cc5a78218011a78fb69ca7c3d6afb885cf8f4a7.tar.gz | |
* ui-polish, show 4 steps during the upgrade
Diffstat (limited to 'DistUpgrade')
| -rw-r--r-- | DistUpgrade/DistUpgrade.glade | 416 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 4 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeView.py | 8 | ||||
| -rw-r--r-- | 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 @@ <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> - <property name="resizable">True</property> + <property name="resizable">False</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> @@ -38,8 +38,8 @@ <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> + <property name="xpad">12</property> + <property name="ypad">12</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> @@ -53,96 +53,368 @@ </child> <child> - <placeholder/> - </child> - - <child> - <widget class="GtkLabel" id="label_status"> + <widget class="GtkAlignment" id="alignment2"> <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">12</property> + <property name="left_padding">12</property> + <property name="right_padding">12</property> - <child> - <widget class="GtkProgressBar" id="progressbar_cache"> - <property name="visible">True</property> - <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> - <property name="fraction">0</property> - <property name="pulse_step">0.10000000149</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <child> + <widget class="GtkTable" id="table_steps"> + <property name="visible">True</property> + <property name="n_rows">4</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">12</property> + <property name="column_spacing">12</property> - <child> - <widget class="GtkLabel" id="label_extra_status"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <child> + <widget class="GtkImage" id="image_step1"> + <property name="width_request">16</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + </packing> + </child> + + <child> + <widget class="GtkImage" id="image_step2"> + <property name="width_request">16</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkImage" id="image_step3"> + <property name="width_request">16</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkImage" id="image_step4"> + <property name="width_request">16</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_step1"> + <property name="visible">True</property> + <property name="label" translatable="yes">Analyzing the system</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_step2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Updating repository information</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_step3"> + <property name="visible">True</property> + <property name="label" translatable="yes">Performing the upgrade</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_step4"> + <property name="visible">True</property> + <property name="label" translatable="yes">Post upgrade stuff</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + </child> </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> <child> - <widget class="GtkExpander" id="expander_terminal"> - <property name="can_focus">True</property> - <property name="expanded">False</property> - <property name="spacing">0</property> + <widget class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <widget class="Custom" id="custom_terminal"> + <widget class="GtkAlignment" id="alignment1"> <property name="visible">True</property> - <property name="creation_function">create_terminal</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 06 Dec 2005 20:03:08 GMT</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkVBox" id="vbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label_status"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkProgressBar" id="progressbar_cache"> + <property name="visible">True</property> + <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> + <property name="fraction">0</property> + <property name="pulse_step">0.10000000149</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_extra_status"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkExpander" id="expander_terminal"> + <property name="can_focus">True</property> + <property name="expanded">False</property> + <property name="spacing">0</property> + + <child> + <widget class="Custom" id="custom_terminal"> + <property name="visible">True</property> + <property name="creation_function">create_terminal</property> + <property name="int1">0</property> + <property name="int2">0</property> + <property name="last_modification_time">Tue, 06 Dec 2005 20:03:08 GMT</property> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes">Terminal</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> </widget> </child> <child> - <widget class="GtkLabel" id="label6"> + <widget class="GtkLabel" id="label16"> <property name="visible">True</property> - <property name="label" translatable="yes">Terminal</property> + <property name="label" translatable="yes"><b>Action</b></property> <property name="use_underline">False</property> - <property name="use_markup">False</property> + <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> 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,"") |
