diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-11 18:29:40 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-11 18:29:40 +0200 |
| commit | fbcda68cc6fc5d416ae62c626974a1f2fcf92f76 (patch) | |
| tree | 5cb9ba5353570751da355fb31f821639ddb4e851 /UpdateManager/UpdateManager.py | |
| parent | f9f8e93cdca876b011b18dc96dd7162ad4c030af (diff) | |
| parent | ae0d9a877711e2f12cf7e62899d5cc60d50e9bd0 (diff) | |
| download | python-apt-fbcda68cc6fc5d416ae62c626974a1f2fcf92f76.tar.gz | |
* merged from sebastian
* fix bug in the "sort-by-origin" code
Diffstat (limited to 'UpdateManager/UpdateManager.py')
| -rw-r--r-- | UpdateManager/UpdateManager.py | 67 |
1 files changed, 28 insertions, 39 deletions
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 343dcd85..cc14ae4c 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,23 +236,23 @@ 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 = [] + self.held_back = [] # do the upgrade cache.saveDistUpgrade() # sort by origin for pkg in cache: - if pkg.markedUpgrade or pkg.markedInstall: - # TRANSLATORS: updates from an 'unknown' origin - originstr = _("Other updates") + if pkg.markedUpgrade or pkg.markedInstall or pkg.isUpgradable: + if pkg.candidateOrigin == None: + # can happen for e.g. loged packages + print "WARNING: upgradable but no canidateOrigin?!?: ", pkg.name + continue for aorigin in pkg.candidateOrigin: archive = aorigin.archive origin = aorigin.origin @@ -264,38 +264,11 @@ class UpdateList: self.pkgs[origin_node] = [] self.pkgs[origin_node].append(pkg) self.num_updates = self.num_updates + 1 - elif pkg.isUpgradable: - held_back.append(pkg.name) + if pkg.isUpgradable: + self.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 = ("<big><b>%s</b></big>\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): @@ -419,6 +392,8 @@ class UpdateManager(SimpleGladeApp): return to_install = pkg.markedInstall or pkg.markedUpgrade renderer.set_property("active", to_install) + if pkg.name in self.list.held_back: + renderer.set_property("activatable", False) def package_column_view_func(self, cell_layout, renderer, model, iter): self.header_column_func(cell_layout, renderer, model, iter) @@ -726,6 +701,7 @@ class UpdateManager(SimpleGladeApp): time.sleep(0.05) while gtk.events_pending(): gtk.main_iteration() + self.label_cache_progress_title.set_label("<b><big>%s</big></b>" % _("Checking for updates")) self.fillstore() # Allow suspend after synaptic is finished @@ -734,6 +710,7 @@ class UpdateManager(SimpleGladeApp): self.window_main.set_sensitive(True) self.window_main.window.set_cursor(None) + def inhibit_sleep(self): """Send a dbus signal to gnome-power-manager to not suspend the system""" @@ -809,9 +786,9 @@ class UpdateManager(SimpleGladeApp): # clean most objects self.dl_size = 0 - self.store.clear() self.initCache() - self.list = UpdateList(self.window_main) + self.store.clear() + self.list = UpdateList() # fill them again self.list.update(self.cache) @@ -839,6 +816,7 @@ class UpdateManager(SimpleGladeApp): self.store.append([contents, pkg.name, pkg]) self.update_count() self.setBusy(False) + self.check_all_updates_installable() return False def dist_no_longer_supported(self, meta_release): @@ -929,6 +907,17 @@ 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() + self.dialog_dist_upgrade.hide() + 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() |
