From 2e2c637be425f7ecb4cbaeb8aa27e92c47c54fa0 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Mon, 11 Sep 2006 17:16:38 +0200 Subject: * Move the "run full dit upgrade" dialog into the UpdateManager class - to avoid spliting the UI stuff into several classes * Use a glade based dialog with better buttons instead of yes/no * Improved wording --- UpdateManager/UpdateManager.py | 46 ++++-------- data/glade/UpdateManager.glade | 163 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 32 deletions(-) diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 343dcd85..69308ec6 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -219,7 +219,7 @@ class UpdateList: self.importance = importance self.description = desc - def __init__(self, parent_window): + def __init__(self): # a map of packages under their origin pipe = os.popen("lsb_release -c -s") dist = pipe.read().strip() @@ -236,14 +236,12 @@ class UpdateList: self.pkgs = {} self.matcher = {} self.num_updates = 0 - self.parent_window = parent_window for (origin, archive, desc, importance) in templates: self.matcher[(origin, archive)] = self.UpdateOrigin(desc, importance) self.unknown_origin = self.UpdateOrigin(_("Other updates"), -1) def update(self, cache): held_back = [] - broken = [] # do the upgrade cache.saveDistUpgrade() @@ -268,34 +266,7 @@ class UpdateList: held_back.append(pkg.name) for l in self.pkgs.keys(): self.pkgs[l].sort(lambda x,y: cmp(x.name,y.name)) - - # check if we have held-back something - if cache._depcache.KeepCount > 0: - keepcount = cache._depcache.KeepCount - msg = ("%s\n\n%s" % \ - (_("Cannot install all available updates"), - _("Some of the updates require more extensive changes " - "than expected.\n\n" - "This usually means that you have enabled unoffical " - "repositories, that it is not " - "fully upgraded from the last distribution release or " - "that you run a development release " - "of the distribution.\n\n" - "Would you like to perform a full distribution upgrade " - "now?"))) - dialog = gtk.MessageDialog(self.parent_window, 0, - gtk.MESSAGE_QUESTION, - gtk.BUTTONS_YES_NO,"") - dialog.set_default_response(gtk.RESPONSE_NO) - dialog.set_markup(msg) - dialog.set_title("") - dialog.vbox.set_spacing(6) - res = dialog.run() - if res == gtk.RESPONSE_YES: - os.execl("/usr/bin/gksu", - "/usr/bin/gksu", - "/usr/bin/update-manager --dist-upgrade") - dialog.destroy() + self.keepcount = cache._depcache.KeepCount class UpdateManagerDbusControler(dbus.service.Object): @@ -811,7 +782,7 @@ class UpdateManager(SimpleGladeApp): self.dl_size = 0 self.store.clear() self.initCache() - self.list = UpdateList(self.window_main) + self.list = UpdateList() # fill them again self.list.update(self.cache) @@ -929,6 +900,16 @@ class UpdateManager(SimpleGladeApp): if res == gtk.RESPONSE_YES: self.on_button_reload_clicked(None) + def check_all_updates_installable(self): + """ Check if all available updates can be installed and suggest + to run a distribution upgrade if not """ + if self.list.keepcount > 0: + self.dialog_dist_upgrade.set_transient_for(self.window_main) + res = self.dialog_dist_upgrade.run() + if res == gtk.RESPONSE_YES: + os.execl("/usr/bin/gksu", + "/usr/bin/gksu", + "/usr/bin/update-manager --dist-upgrade") def main(self, options): gconfclient = gconf.client_get_default() @@ -945,5 +926,6 @@ class UpdateManager(SimpleGladeApp): gtk.main_iteration() self.fillstore() + self.check_all_updates_installable() self.check_auto_update() gtk.main() diff --git a/data/glade/UpdateManager.glade b/data/glade/UpdateManager.glade index bb78008c..e9fd6bfc 100644 --- a/data/glade/UpdateManager.glade +++ b/data/glade/UpdateManager.glade @@ -1453,4 +1453,167 @@ Software updates correct errors, eliminate security vulnerabilities and provide + + 6 + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + True + 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 + _Distribution Upgrade + True + GTK_RELIEF_NORMAL + True + -8 + + + + + + True + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 12 + + + + True + gtk-dialog-warning + 6 + 0 + 0 + 0 + 0 + + + 0 + False + True + + + + + + True + False + 12 + + + + True + True + <big><b>Not all updates can be installed</b></big> + False + True + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + Run a distribution upgrade, to install as many updates as possible. + +This can be caused by an uncompleted upgrade, unofficial software packages or by running a development version. + False + False + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + -- cgit v1.2.3