From 39ef4a4b58922222cceec76400895acbb7e569b2 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 27 Sep 2010 21:27:53 +0200 Subject: [PATCH] [sulfur] move orphan packages dialog and logic to post-_process_queue() functions --- sulfur/src/sulfur/__init__.py | 55 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/sulfur/src/sulfur/__init__.py b/sulfur/src/sulfur/__init__.py index c78388bfc..ccd9200da 100644 --- a/sulfur/src/sulfur/__init__.py +++ b/sulfur/src/sulfur/__init__.py @@ -1826,25 +1826,6 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): elif allpkgs and (self.lastPkgPB != "pkgsets"): self.ui.pkgSorter.set_property('sensitive', True) - orphans = None - syspkg_orphans = None - unavail_repo_pkgs = None - if (not self._orphans_message_shown) and (not self._RESOURCES_LOCKED) \ - and self._entropy.repositories(): - if action == "updates" and \ - (not self.etpbase.get_raw_groups('updates')): - - orphans = self.etpbase.get_raw_groups('orphans') - syspkg_orphans = self.etpbase.get_raw_groups('syspkg_orphans') - unavail_repo_pkgs = self.etpbase.get_raw_groups('unavail_orphans') - if self.do_debug: - print_generic("show_packages: found orphans %s" % (orphans,)) - print_generic("show_packages: found syspkg orphans %s" % ( - syspkg_orphans,)) - print_generic("show_packages: found unavail repo pkgs %s" % ( - unavail_repo_pkgs,)) - self._orphans_message_shown = True - self.pkgView.populate(allpkgs, empty = empty, pkgsets = show_pkgsets) if back_to_page: @@ -1858,12 +1839,6 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): rb = self.packageRB[do_switch_to] gobject.timeout_add(200, rb.clicked) - if orphans or syspkg_orphans or unavail_repo_pkgs: - # enqueue in the main loop, better! - # avoid actions button to not show up - gobject.timeout_add(2000, self._show_orphans_message, orphans, - syspkg_orphans, unavail_repo_pkgs) - def add_atoms_to_queue(self, atoms, always_ask = False, matches = None): if matches is None: @@ -2113,6 +2088,35 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.progress.set_subLabel(_("Something bad happened, have a look at the messages in the terminal below.")) self.progress.set_extraLabel(_("Don't feel guilty, it's all my fault!")) + def _show_orphans_message(state): + + if not state: + return + if self._orphans_message_shown: + return + + orphans = None + syspkg_orphans = None + unavail_repo_pkgs = None + if not self.etpbase.get_raw_groups('updates'): + + orphans = self.etpbase.get_raw_groups('orphans') + syspkg_orphans = self.etpbase.get_raw_groups('syspkg_orphans') + unavail_repo_pkgs = self.etpbase.get_raw_groups('unavail_orphans') + if self.do_debug: + print_generic("_show_orphans_message: found orphans %s" % (orphans,)) + print_generic("_show_orphans_message: found syspkg orphans %s" % ( + syspkg_orphans,)) + print_generic("_show_orphans_message: found unavail repo pkgs %s" % ( + unavail_repo_pkgs,)) + self._orphans_message_shown = True + + if orphans or syspkg_orphans or unavail_repo_pkgs: + # enqueue in the main loop, better! + # avoid actions button to not show up + gobject.timeout_add(2000, self._show_orphans_message, orphans, + syspkg_orphans, unavail_repo_pkgs) + def _install_done(err): state = True @@ -2205,6 +2209,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): self.queue.clear() if status_cb is not None: status_cb(state) + _show_orphans_message(state) with self._privileges: