summaryrefslogtreecommitdiff
path: root/portato/gui/windows/main.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-10-05 15:09:41 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-10-05 15:09:41 +0200
commit7a38fcc10c89f401cdd2acb716f5200ad906fd9c (patch)
tree962a14a1ff3e2d2a652a50c6966d2261eb6d45fc /portato/gui/windows/main.py
parent7a5d63304dbc17dccad6f98bcd22144b164d057f (diff)
downloadportato-7a38fcc10c89f401cdd2acb716f5200ad906fd9c.tar.gz
portato-7a38fcc10c89f401cdd2acb716f5200ad906fd9c.tar.bz2
portato-7a38fcc10c89f401cdd2acb716f5200ad906fd9c.zip
Added an PkgList window and rewrote UpdateWindow and WorldListWindow to use it
Diffstat (limited to 'portato/gui/windows/main.py')
-rw-r--r--portato/gui/windows/main.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index c99790c..5935423 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,46 @@ 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(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):