diff options
author | Necoro <> | 2007-10-31 15:28:06 +0000 |
---|---|---|
committer | Necoro <> | 2007-10-31 15:28:06 +0000 |
commit | 85ce664e4532065dbea066f283d0fd50fe71714a (patch) | |
tree | d18fdc0546cf0d601d009025061ae6d4d4386e4e /portato/gui/gtk/windows.py | |
parent | 11933586a448ad6bd8b6aae6fa4a36dd48cbc136 (diff) | |
download | portato-85ce664e4532065dbea066f283d0fd50fe71714a.tar.gz portato-85ce664e4532065dbea066f283d0fd50fe71714a.tar.bz2 portato-85ce664e4532065dbea066f283d0fd50fe71714a.zip |
r93@Devoty: necoro | 2007-10-31 11:37:04 +0100
Make menu management work again with glade
r94@Devoty: necoro | 2007-10-31 14:38:28 +0100
Fixed bug (missing self)
r95@Devoty: necoro | 2007-10-31 16:22:40 +0100
Added "Show only installed packages" option
r96@Devoty: necoro | 2007-10-31 16:27:07 +0100
New translations.
Diffstat (limited to '')
-rw-r--r-- | portato/gui/gtk/windows.py | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index 476411d..ff3c4d1 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -890,6 +890,7 @@ class MainWindow (Window): # booleans self.doUpdate = False + self.showAll = True # show only installed or all packages? # installed pixbuf self.instPixbuf = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU) @@ -1024,17 +1025,26 @@ class MainWindow (Window): store = gtk.ListStore(str) - # build categories - for p in system.list_categories(): - store.append([p]) - # sort them alphabetically - store.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.catList.set_model(store) cell = gtk.CellRendererText() col = gtk.TreeViewColumn(_("Categories"), cell, text = 0) self.catList.append_column(col) + self.fill_cat_store(store) + + def fill_cat_store (self, store): + + if self.showAll: + cats = system.list_categories() + else: + cats = self.db.get_installed_categories() + + for p in cats: + store.append([p]) + + # sort them alphabetically + store.set_sort_column_id(0, gtk.SORT_ASCENDING) + def build_pkg_list (self, name = None): """Builds the package list. @@ -1077,6 +1087,8 @@ class MainWindow (Window): for pkg, is_inst in self.db.get_cat(name, self.sortPkgListByName): if is_inst: icon = self.instPixbuf + elif not self.showAll: + continue # ignore not installed packages else: icon = None store.append([icon, pkg]) @@ -1324,6 +1336,20 @@ class MainWindow (Window): GtkThread(name="Show Updates Thread", target = __update).start() return True + def cb_show_installed_toggled (self, *args): + self.showAll = not self.showAll + + store = self.catList.get_model() + store.clear() + self.fill_cat_store(store) + + store = self.pkgList.get_model() + store.clear() + try: + self.fill_pkg_store(store, self.selCatName) + except AttributeError: # no selCatName -> so no category selected --> ignore + debug("AttributeError occured --> should be no harm.") + def cb_right_click (self, object, event): if event.button == 3: x = int(event.x) |