From 8abb01fb328c6e0c3da3263af149934b02949b8a Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Sat, 18 Feb 2006 16:06:37 +0100 Subject: * Do not disable the update dialog during downloading of the changelog * Show step 5 "Restarting the system" in the ui, since users asked me, how and when they should reboot. this should provide a better picture of the upgrade process * Fixed the parent of the change media dialog * Converted the abort DistUpgrade dialog to a nice glade dialog * Disabled the abortion of the DistUpgrade. it is currently not supported. --- DistUpgrade/DistUpgrade.glade | 129 +++++++++++++++++++++++++++++++++++++- DistUpgrade/DistUpgradeViewGtk.py | 24 ++++--- 2 files changed, 142 insertions(+), 11 deletions(-) (limited to 'DistUpgrade') diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index 5b59fb4d..55b439c1 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -12,7 +12,6 @@ False False False - update-manager.png True False False @@ -293,6 +292,7 @@ 18 18 + True 0.5 0.5 0 @@ -309,7 +309,8 @@ - + True + Restarting the system False False GTK_JUSTIFY_LEFT @@ -1285,4 +1286,128 @@ This is you last chance to cancel the upgrade. + + 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 + _Cancel Upgrade + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + True + _Resume Upgrade + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 12 + + + + True + gtk-dialog-question + 6 + 0 + 0 + 0 + 0 + + + 0 + False + True + + + + + + True + <b><big>Cancel the running upgrade?</big></b> + +The system could be in an unusable state if you cancel the upgrade. You are strongly adviced to resume the upgrade. + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + + diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index 6013200b..c36d8dac 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -74,7 +74,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress): def mediaChange(self, medium, drive): #print "mediaChange %s %s" % (medium, drive) msg = _("Please insert '%s' into the drive '%s'" % (medium,drive)) - dialog = gtk.MessageDialog(parent=self.main, + dialog = gtk.MessageDialog(parent=self.window_main, flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK_CANCEL) @@ -182,9 +182,13 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): # FIXME: i18n must be somewhere relative do this dir bindtextdomain("update-manager",os.path.join(os.getcwd(),"mo")) + icons = gtk.icon_theme_get_default() + gtk.window_set_default_icon(icons.load_icon("update-manager", 32, 0)) SimpleGladeApp.__init__(self, "DistUpgrade.glade", None, domain="update-manager") self.window_main.set_keep_above(True) + self.window_main.realize() + self.window_main.window.set_functions(gtk.gdk.FUNC_MOVE) self._opCacheProgress = GtkOpProgress(self.progressbar_cache) self._fetchProgress = GtkFetchProgressAdapter(self) self._installProgress = GtkInstallProgressAdapter(self) @@ -328,6 +332,8 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): def confirmRestart(self): self.dialog_restart.set_transient_for(self.window_main) + self.dialog_restart.realize() + self.dialog_restart.window.set_functions(gtk.gdk.FUNC_MOVE) res = self.dialog_restart.run() self.dialog_restart.hide() if res == gtk.RESPONSE_YES: @@ -335,14 +341,14 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): return False def on_window_main_delete_event(self, widget, event): - #print "on_window_main_delete_event()" - summary = _("Are you sure you want cancel?") - msg = _("Canceling during a upgrade can leave the system in a " - "unstable state. It is strongly adviced to continue " - "the operation. ") - if self.askYesNoQuestion(summary, msg): - self.exit(1) - return True + self.dialog_cancel.set_transient_for(self.window_main) + self.dialog_cancel.realize() + self.dialog_cancel.window.set_functions(gtk.gdk.FUNC_MOVE) + res = self.dialog_cancel.run() + self.dialog_cancel.hide() + if res == gtk.RESPONSE_CANCEL: + self.destroy() + return True if __name__ == "__main__": view = GtkDistUpgradeView() -- cgit v1.2.3 From d87c4020340ed0c869346c5b569a3b2e261b7be2 Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Sun, 19 Feb 2006 20:39:45 +0100 Subject: * dialog_confirm_changes: - Show a question mark icon in the confirm changes dialog - Fixed some spacing in the confirm changes dialog - Use a more informative label for the ob button and the summary - Do not show the close button of the wm - Use plural gettext in the summary - Include the summary into the alert message * common error dialogs: - Do not show the close button of the wm - Hopefully made the wording of some error dialogs clearer - Show the missing free space on the corresponding error dialog --- DistUpgrade/DistUpgrade.glade | 180 +++++++++++++++++++++--------------- DistUpgrade/DistUpgradeControler.py | 37 ++++---- DistUpgrade/DistUpgradeViewGtk.py | 65 +++++++++---- 3 files changed, 173 insertions(+), 109 deletions(-) (limited to 'DistUpgrade') diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index 55b439c1..c28b20ad 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -520,7 +520,7 @@ GTK_BUTTONBOX_END - + True True True @@ -533,11 +533,11 @@ - + True True True - _Continue + _Start Upgrade True GTK_RELIEF_NORMAL True @@ -554,106 +554,70 @@ - + 6 True False - 6 - - - - True - - False - True - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + 12 - + True - - False - False - GTK_JUSTIFY_LEFT - False - False + gtk-dialog-question + 6 0 - 0.5 + 0 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 False - False + True - + True - True - False - 0 + False + 12 - - 400 - 200 + True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - + + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + 0 + False + False + - + True - Details + False - False + True GTK_JUSTIFY_LEFT - False + True False - 0.5 + 0 0.5 0 0 @@ -663,7 +627,73 @@ 0 - label_item + 0 + False + False + + + + + + True + True + False + 6 + + + + 400 + 200 + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + False + False + False + + + + + + + + True + Details + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 9fa717fe..6dcc0e2a 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -187,13 +187,16 @@ class DistUpgradeControler(object): st = os.statvfs(archivedir) free = st[statvfs.F_BAVAIL]*st[statvfs.F_FRSIZE] if self.cache.requiredDownload > free: - self._view.error(_("Not enough free space"), - _("There is not enough free space on your " - "system to download the required pacakges. " - "Please free some space before trying again " - "with e.g. 'sudo apt-get clean'")) - return False - res = self._view.confirmChanges(_("Perform Upgrade?"),changes, + free_at_least = apt_pkg.SizeToStr(self.cache.requiredDownload-free) + self._view.error(_("Not enough free disk space"), + _("The upgrade aborts now. " + "Please free at least %s of disk space. " + "Empty your trash and remove temporary " + "packages of former installations using " + "'sudo apt-get clean'." % free_at_least )) + return False + res = self._view.confirmChanges(_("Do you want to start the upgrade?"), + changes, self.cache.requiredDownload) return res @@ -208,12 +211,11 @@ class DistUpgradeControler(object): res = self.cache.commit(fprogress,iprogress) except SystemError, e: # installing the packages failed, can't be retried - self._view.error(_("Error during commit"), - _("Some problem occured during the upgrade. " - "Most likely packages failed to install. " - "Try 'sudo apt-get install -f' or synaptic " - "to fix your system."), - "%s" % e) + self._view.error(_("Could not install the upgrades"), + _("The upgrade aborts now. Your system " + "can be in an unusable state. Please " + "try 'sudo apt-get install -f' or Synaptic " + "to fix your system."), "%s" % e) return False except IOError, e: # fetch failed, will be retried @@ -225,11 +227,10 @@ class DistUpgradeControler(object): # maximum fetch-retries reached without a successful commit logging.debug("giving up on fetching after maximum retries") - self._view.error(_("Error fetching the packages"), - _("Some problem occured during the fetching " - "of the packages. This is most likely a network " - "problem. Please check your network and try " - "again. "), + self._view.error(_("Could not download the upgrades"), + _("The upgrade aborts now. Please check your "\ + "internet connection or "\ + "installation media and try again. "), "%s" % e) # abort here because we want our sources.list back self.abort() diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index c36d8dac..7fd39a32 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -39,6 +39,7 @@ from apt.progress import InstallProgress from DistUpgradeView import DistUpgradeView from UpdateManager.Common.SimpleGladeApp import SimpleGladeApp, bindtextdomain +import gettext from gettext import gettext as _ def utf8(str): @@ -138,17 +139,20 @@ class GtkInstallProgressAdapter(InstallProgress): "APT_LISTCHANGES_FRONTEND=none"] def error(self, pkg, errormsg): - logging.error("got a error from dpkg for pkg: '%s': '%s'" % (pkg, errormsg)) + logging.error("got an error from dpkg for pkg: '%s': '%s'" % (pkg, errormsg)) #self.expander_terminal.set_expanded(True) self.parent.dialog_error.set_transient_for(self.parent.window_main) summary = _("Could not install '%s'" % pkg) - msg = _("The upgrade will abort. Please report the bug.") + msg = _("The upgrade aborts now. Please report this bug.") markup="%s\n\n%s" % (summary, msg) + self.parent.dialog_error.realize() + self.parent.dialog_error.window.set_functions(gtk.gdk.FUNC_MOVE) self.parent.label_error.set_markup(markup) self.parent.textview_error.get_buffer().set_text(utf8(errormsg)) self.parent.scroll_error.show() self.parent.dialog_error.run() self.parent.dialog_error.hide() + def conffile(self, current, new): logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) self.expander.set_expanded(True) @@ -218,10 +222,9 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): lines = traceback.format_exception(type, value, tb) logging.error("not handled expection:\n%s" % "\n".join(lines)) self.error(_("A fatal error occured"), - _("During the operation a fatal error occured. " - "Please report this as a bug and include the " + _("Please report this as a bug and include the " "files ~/dist-upgrade.log and ~/dist-upgrade-apt.log " - "in your report. The upgrade will abort now. "), + "in your report. The upgrade aborts now. "), "\n".join(lines)) def create_terminal(self, arg1,arg2,arg3,arg4): @@ -284,8 +287,9 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): self.scroll_error.show() else: self.scroll_error.hide() + self.dialog_error.realize() + self.dialog_error.window.set_functions(gtk.gdk.FUNC_MOVE) self.dialog_error.run() - self.dialog_error.show() self.dialog_error.destroy() return False @@ -293,24 +297,51 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): # FIXME: add a whitelist here for packages that we expect to be # removed (how to calc this automatically?) DistUpgradeView.confirmChanges(self, summary, changes, downloadSize) + pkgs_remove = len(self.toRemove) + pkgs_inst = len(self.toInstall) + pkgs_upgrade = len(self.toUpgrade) + msg = "" + + if pkgs_remove > 0: + msg += gettext.ngettext("%s package is going to be removed." %\ + pkgs_remove, + "%s packages are going to be removed." %\ + pkgs_remove, pkgs_remove) + msg +=" " + if pkgs_inst > 0: + msg += gettext.ngettext("%s new package is going to be "\ + "installed." % pkgs_inst, + "%s new packages are going to be "\ + "installed." % pkgs_inst, pkgs_inst) + msg +=" " + if pkgs_upgrade > 0: + msg += gettext.ngettext("%s package is going to be upgraded." %\ + pkgs_upgrade, + "%s packages are going to be upgraded." %\ + pkgs_upgrade, pkgs_upgrade) + msg +=" " + if msg == "": + # FIXME: this should go into DistUpgradeController + summary = _("Could not find any upgrades") + msg = _("Your system has already been upgraded.") + self.error(summary, msg) + return False + else: + msg += _("You have to download a total of %s." %\ + apt_pkg.SizeToStr(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" - "%s packages are going to be upgraded.\n\n" - "%s needs to be fetched" % (len(self.toRemove), - len(self.toInstall), - len(self.toUpgrade), - apt_pkg.SizeToStr(downloadSize))) self.label_changes.set_text(msg) # fill in the details self.details_list.clear() for rm in self.toRemove: - self.details_list.append([_("To be removed: %s" % rm)]) + self.details_list.append([_("Remove %s" % rm)]) for inst in self.toInstall: - self.details_list.append([_("To be installed: %s" % inst)]) + self.details_list.append([_("Install %s" % inst)]) for up in self.toUpgrade: - self.details_list.append([_("To be upgraded: %s" % up)]) + self.details_list.append([_("Upgrade %s" % up)]) self.dialog_changes.set_transient_for(self.window_main) + self.dialog_changes.realize() + self.dialog_changes.window.set_functions(gtk.gdk.FUNC_MOVE) res = self.dialog_changes.run() self.dialog_changes.hide() if res == gtk.RESPONSE_YES: @@ -347,6 +378,8 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): res = self.dialog_cancel.run() self.dialog_cancel.hide() if res == gtk.RESPONSE_CANCEL: + #FIXME: this does not work correctly and leaves a stalled + # dist-upgrade.py process self.destroy() return True -- cgit v1.2.3