summaryrefslogtreecommitdiff
path: root/portato/gui/windows/main.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-10-05 15:38:42 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-10-05 15:38:42 +0200
commitb859cb5199b63e28a0f6470e0ddf8658d6304ad9 (patch)
tree21cae5c3280473fe176befec2300e1b928e1dfc0 /portato/gui/windows/main.py
parent5ae4fda6f6fdcc8a21253dd6dc9d6051c99af34f (diff)
parent2fae9ac523385f61d192e9eeb664002c4a952a01 (diff)
downloadportato-b859cb5199b63e28a0f6470e0ddf8658d6304ad9.tar.gz
portato-b859cb5199b63e28a0f6470e0ddf8658d6304ad9.tar.bz2
portato-b859cb5199b63e28a0f6470e0ddf8658d6304ad9.zip
Reworked the World List stuff to be more usable and better coded
Diffstat (limited to '')
-rw-r--r--portato/gui/windows/main.py47
1 files changed, 29 insertions, 18 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index c99790c..5a149f8 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -50,7 +50,7 @@ from .about import AboutWindow
from .plugin import PluginWindow
from .preference import PreferenceWindow
from .search import SearchWindow
-from .update import UpdateWindow, WorldListWindow
+from .pkglist import UpdateWindow, WorldListWindow
class PackageTable:
"""A window with data about a specfic package."""
@@ -1594,41 +1594,52 @@ class MainWindow (Window):
PluginWindow(self.window, plugins, self.queue)
return True
-
- def cb_show_updates_clicked (self, *args):
- """
- Show the list of updateble packages.
- """
- def __update():
- def cb_idle_show(packages):
- """
- Callback opening the menu when the calculation is finished.
+ def show_package_list (self, pkg_generator, klass, thread_name = "PkgList Update Thread"):
+
+ def cb_idle_show(packages):
+ """
+ Callback opening the menu when the calculation is finished.
- @returns: False to signal that it is finished
- """
- UpdateWindow(self.window, packages, self.queue, self.jump_to)
- return False
-
+ @returns: False to signal that it is finished
+ """
+ klass(self.window, packages, self.queue, self.jump_to)
+ return False
+
+ def __update():
watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
self.window.window.set_cursor(watch)
packages = []
try:
- packages.extend(system.get_updated_packages())
+ packages.extend(pkg_generator())
finally:
self.window.window.set_cursor(None)
gobject.idle_add(cb_idle_show, packages)
- GtkThread(name="Show Updates Thread", target = __update).start()
+ GtkThread(name = thread_name, target = __update).start()
+ return True
+
+ def cb_show_updates_clicked (self, *args):
+ """
+ Show the list of updateble packages.
+ """
+
+ self.show_package_list(
+ lambda: (x.get_cpv() for x in system.get_updated_packages()),
+ UpdateWindow, "Show Updates Thread")
+
return True
def cb_show_world_clicked (self, *args):
"""
Show the list of world packages.
"""
- WorldListWindow(self.window, system.find_packages(pkgSet = "world"), self.queue, self.jump_to)
+ self.show_package_list(
+ lambda: system.find_packages(pkgSet = "world", only_cpv = True),
+ WorldListWindow)
+
return True
def cb_show_installed_toggled (self, *args):