def confirmChanges(self, summary, changes, downloadSize, actions=None): DistUpgradeView.confirmChanges(self, summary, changes, downloadSize, actions) pkgs_remove = len(self.toRemove) pkgs_inst = len(self.toInstall) pkgs_upgrade = len(self.toUpgrade) msg = "" if pkgs_remove > 0: # FIXME: make those two seperate lines to make it clear # that the "%" applies to the result of ngettext msg += gettext.ngettext("%d package is going to be removed.", "%d packages are going to be removed.", pkgs_remove) % pkgs_remove msg += " " if pkgs_inst > 0: msg += gettext.ngettext( "%d new package is going to be " "installed.", "%d new packages are going to be " "installed.", pkgs_inst) % pkgs_inst msg += " " if pkgs_upgrade > 0: msg += gettext.ngettext( "%d package is going to be upgraded.", "%d packages are going to be upgraded.", pkgs_upgrade) % pkgs_upgrade msg += " " if downloadSize > 0: msg += _("\n\nYou have to download a total of %s. ") %\ apt_pkg.SizeToStr(downloadSize) msg += estimatedDownloadTime(downloadSize) msg += "." if (pkgs_upgrade + pkgs_inst + pkgs_remove) > 100: msg += "\n\n%s" % _("Fetching and installing the upgrade can take several hours and "\ "cannot be canceled at any time later.") # Show an error if no actions are planned if (pkgs_upgrade + pkgs_inst + pkgs_remove) < 1: # FIXME: this should go into DistUpgradeController summary = _("Your system is up-to-date") msg = _("There are no upgrades available for your system. " "The upgrade will now be canceled.") self.error(summary, msg) return False return self.askYesNoQuestion(summary, msg)
def confirmChanges(self, summary, changes, downloadSize, actions=None): DistUpgradeView.confirmChanges(self, summary, changes, downloadSize, actions) pkgs_remove = len(self.toRemove) pkgs_inst = len(self.toInstall) pkgs_upgrade = len(self.toUpgrade) msg = "" if pkgs_remove > 0: # FIXME: make those two seperate lines to make it clear # that the "%" applies to the result of ngettext msg += gettext.ngettext("%d package is going to be removed.", "%d packages are going to be removed.", pkgs_remove) % pkgs_remove msg += " " if pkgs_inst > 0: msg += gettext.ngettext("%d new package is going to be " "installed.", "%d new packages are going to be " "installed.",pkgs_inst) % pkgs_inst msg += " " if pkgs_upgrade > 0: msg += gettext.ngettext("%d package is going to be upgraded.", "%d packages are going to be upgraded.", pkgs_upgrade) % pkgs_upgrade msg +=" " if downloadSize > 0: msg += _("\n\nYou have to download a total of %s. ") %\ apt_pkg.SizeToStr(downloadSize) msg += estimatedDownloadTime(downloadSize) msg += "." if (pkgs_upgrade + pkgs_inst + pkgs_remove) > 100: msg += "\n\n%s" % _("Fetching and installing the upgrade can take several hours and "\ "cannot be canceled at any time later.") # Show an error if no actions are planned if (pkgs_upgrade + pkgs_inst + pkgs_remove) < 1: # FIXME: this should go into DistUpgradeController summary = _("Your system is up-to-date") msg = _("There are no upgrades available for your system. " "The upgrade will now be canceled.") self.error(summary, msg) return False return self.askYesNoQuestion(summary, msg)
def confirmChanges(self, summary, changes, downloadSize, actions=None): # 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: # FIXME: make those two seperate lines to make it clear # that the "%" applies to the result of ngettext msg += gettext.ngettext("%d package is going to be removed.", "%d packages are going to be removed.", pkgs_remove) % pkgs_remove msg += " " if pkgs_inst > 0: msg += gettext.ngettext("%d new package is going to be " "installed.", "%d new packages are going to be " "installed.",pkgs_inst) % pkgs_inst msg += " " if pkgs_upgrade > 0: msg += gettext.ngettext("%d package is going to be upgraded.", "%d packages are going to be upgraded.", pkgs_upgrade) % pkgs_upgrade msg +=" " if downloadSize > 0: msg += _("\n\nYou have to download a total of %s. ") %\ apt_pkg.SizeToStr(downloadSize) msg += estimatedDownloadTime(downloadSize) msg += "." if (pkgs_upgrade + pkgs_inst + pkgs_remove) > 100: msg += "\n\n%s" % _("Fetching and installing the upgrade can take several hours and "\ "cannot be canceled at any time later.") msg += "\n\n<b>%s</b>" % _("To prevent data loss close all open "\ "applications and documents.") # Show an error if no actions are planned if (pkgs_upgrade + pkgs_inst + pkgs_remove) < 1: # FIXME: this should go into DistUpgradeController summary = _("Your system is up-to-date") msg = _("There are no upgrades available for your system. " "The upgrade will now be canceled.") self.error(summary, msg) return False if actions != None: self.button_cancel_changes.set_use_stock(False) self.button_cancel_changes.set_use_underline(True) self.button_cancel_changes.set_label(actions[0]) self.button_confirm_changes.set_label(actions[1]) self.label_summary.set_markup("<big><b>%s</b></big>" % summary) self.label_changes.set_markup(msg) # fill in the details self.details_list.clear() for rm in self.toRemove: self.details_list.append([_("<b>Remove %s</b>") % rm]) for inst in self.toInstall: self.details_list.append([_("Install %s") % inst]) for up in self.toUpgrade: self.details_list.append([_("Upgrade %s") % up]) self.treeview_details.scroll_to_cell((0,)) 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: return True return False