From 5d73a0332e39db8a773b1c3af989ed268c1f99e2 Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Mon, 23 Jan 2006 22:28:54 +0100 Subject: * show the update dialog on the center of the screen * minor alignment and spacing issues * set an urgency hint on starting * unset sensitive instead of hiding the terminal expander * add a nice dialog "confirm_restart" * nicer status messages * remove the second status label (label_extra_status) show speed and files in the label_status and only the time in the progress bar --- DistUpgrade/DistUpgrade.glade | 261 +++++++++++++++++++++++++++--------- DistUpgrade/DistUpgradeControler.py | 15 +-- DistUpgrade/DistUpgradeViewGtk.py | 42 +++--- 3 files changed, 231 insertions(+), 87 deletions(-) (limited to 'DistUpgrade') diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index 7ad420da..55072576 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -8,7 +8,7 @@ True Upgrading Ubuntu GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE + GTK_WIN_POS_CENTER False False False @@ -18,7 +18,7 @@ GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True - False + True @@ -349,30 +349,6 @@ False - - - - - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - 0 @@ -383,9 +359,11 @@ + True + False True False - 0 + 4 @@ -502,7 +480,8 @@ - Changes + 6 + GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER_ON_PARENT False @@ -511,13 +490,13 @@ False False True - False - False + True + True GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True - False - True + True + False @@ -535,11 +514,11 @@ True True True - gtk-no + gtk-cancel True GTK_RELIEF_NORMAL True - -9 + -6 @@ -548,8 +527,8 @@ True True True - gtk-yes - True + _Continue + True GTK_RELIEF_NORMAL True -8 @@ -576,34 +555,9 @@ True False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - <b>Confirm changes:</b> - False True GTK_JUSTIFY_LEFT - False + True False 0 0.5 @@ -720,4 +674,187 @@ + + 6 + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + False + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + True + False + + + + True + False + 12 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + GTK_RELIEF_NORMAL + True + 0 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-refresh + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Restart Now + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 12 + + + + True + gtk-dialog-info + 6 + 0 + 0 + 0 + 0 + + + 0 + False + True + + + + + + True + <b><big>Restart the system to complete the upgrade</big></b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + + diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index bea1e40f..0fdb8bbd 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -222,11 +222,7 @@ class DistUpgradeControler(object): self.cache.commit(fprogress,iprogress) def askForReboot(self): - return self._view.askYesNoQuestion(_("Reboot required"), - _("The upgrade is finished now. " - "A reboot is required to " - "now, do you want to do this " - "now?")) + return self._view.confirm_restart() def abort(self): """ abort the upgrade, cleanup (as much as possible) """ @@ -237,7 +233,7 @@ class DistUpgradeControler(object): # this is the core def dapperUpgrade(self): # sanity check (check for ubuntu-desktop, brokenCache etc) - self._view.updateStatus(_("Checking the system")) + self._view.updateStatus(_("Checking update system")) self._view.setStep(1) self.openCache() if not self.cache.sanityCheck(self._view): @@ -256,16 +252,17 @@ class DistUpgradeControler(object): self.abort() # then open the cache (again) - self._view.updateStatus(_("Reading cache")) + self._view.updateStatus(_("Checking update system")) self.openCache() # 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")) + self._view.updateStatus(_("Asking for confirmation")) if not self.askDistUpgrade(): self.abort() - + + self._view.updateStatus(_("Performing the upgrade")) if not self.doDistUpgrade(): self.abort() diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index a313ce4f..77307611 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -44,7 +44,7 @@ class GtkOpProgress(apt.progress.OpProgress): self.progressbar = progressbar def update(self, percent): #self._progressbar.show() - self.progressbar.set_text(self.op) + #self.progressbar.set_text(self.op) self.progressbar.set_fraction(percent/100.0) while gtk.events_pending(): gtk.main_iteration() @@ -59,7 +59,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress): # FIXME2: we need to thing about mediaCheck here too def __init__(self, parent): # if this is set to false the download will cancel - self.status = parent.label_extra_status + self.status = parent.label_status self.progress = parent.progressbar_cache def mediaChange(self, medium, drive): #print "mediaChange %s %s" % (medium, drive) @@ -87,15 +87,18 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress): # FIXME: move the status_str and progress_str into python-apt # (python-apt need i18n first for this) apt.progress.FetchProgress.pulse(self) - if self.currentCPS > 0: - self.status.set_text(_("Download rate: %s/s - %s remaining" % (apt_pkg.SizeToStr(self.currentCPS), apt_pkg.TimeToStr(self.eta)))) - else: - self.status.set_text(_("Download rate: unkown")) self.progress.set_fraction(self.percent/100.0) currentItem = self.currentItems + 1 if currentItem > self.totalItems: currentItem = self.totalItems - self.progress.set_text(_("Downloading file %li of %li" % (currentItem, self.totalItems))) + + if self.currentCPS > 0: + self.status.set_text(_("Downloading file %li of %li with %s/s" % (currentItem, self.totalItems, apt_pkg.SizeToStr(self.currentCPS)))) + self.progress.set_text(_("%s remaining" % apt_pkg.TimeToStr(self.eta))) + else: + self.status.set_text(_("Downloading file %li of %li with unknown speed" % (currentItem, self.totalItems))) + self.progress.set_text(" ") + while gtk.events_pending(): gtk.main_iteration() return True @@ -103,7 +106,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress): class GtkInstallProgressAdapter(InstallProgress): def __init__(self,parent): InstallProgress.__init__(self) - self.label_status = parent.label_extra_status + self.label_status = parent.label_status self.progress = parent.progressbar_cache self.expander = parent.expander_terminal self.term = parent._term @@ -121,7 +124,7 @@ class GtkInstallProgressAdapter(InstallProgress): #self.progress.show() self.progress.set_fraction(0.0) self.progress.set_text(" ") - self.expander.show() + self.expander.set_sensitive(True) self.term.show() self.env = ["VTE_PTY_KEEP_FD=%s"% self.writefd, "DEBIAN_FRONTEND=gnome", @@ -182,7 +185,8 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): def __init__(self): # FIXME: i18n must be somewhere relative do this dir SimpleGladeApp.__init__(self, "DistUpgrade.glade", - None, domain="update-manager") + None, domain="update-manager", + position="gtk.WIN_POS_CENTER") self._opCacheProgress = GtkOpProgress(self.progressbar_cache) self._fetchProgress = GtkFetchProgressAdapter(self) self._installProgress = GtkInstallProgressAdapter(self) @@ -195,16 +199,12 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): self.treeview_details.append_column(column) self.treeview_details.set_model(self.details_list) self.vscrollbar_terminal.set_adjustment(self._term.get_adjustment()) - # Use italic style in the status labels + # Use italic style in the status labels attrlist=pango.AttrList() attr = pango.AttrStyle(pango.STYLE_ITALIC, 0, -1) attrlist.insert(attr) - - self.label_status.set_property("attributes", attrlist) - self.label_extra_status.set_property("attributes", attrlist) - #self.label_status_extra.set_property("attributes", pango.AttrStyle(pango.STYLE_ITALIC, 0, -1)) def create_terminal(self, arg1,arg2,arg3,arg4): " helper to create a vte terminal " @@ -257,10 +257,11 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): dialog.run() dialog.destroy() return False + def confirmChanges(self, summary, changes, downloadSize): # FIXME: add a whitelist here for packages that we expect to be # removed (how to calc this automatically?) - DistUpgradeView.confirmChanges(self, summary, changes,downloadSize) + DistUpgradeView.confirmChanges(self, summary, changes, downloadSize) self.label_summary.set_markup("%s" % summary) msg = _("%s packages are going to be removed.\n" "%s packages are going to be newly installed.\n" @@ -284,6 +285,7 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): if res == gtk.RESPONSE_YES: return True return False + def askYesNoQuestion(self, summary, msg): msg = "%s\n\n%s" % (summary,msg) dialog = gtk.MessageDialog(parent=self.window_main, @@ -296,6 +298,14 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): if res == gtk.RESPONSE_YES: return True return False + + def confirm_restart(self): + self.dialog_restart.set_transient_for(self.window_main) + res = self.dialog_restart.run() + self.dialog_restart.hide() + if res == RESPONSE_YES: + return True + return False def on_window_main_delete_event(self, widget, event): #print "on_window_main_delete_event()" -- cgit v1.2.3