diff options
Diffstat (limited to 'portato/gui/gtk')
-rw-r--r-- | portato/gui/gtk/exception_handling.py | 2 | ||||
-rw-r--r-- | portato/gui/gtk/windows.py | 38 |
2 files changed, 33 insertions, 7 deletions
diff --git a/portato/gui/gtk/exception_handling.py b/portato/gui/gtk/exception_handling.py index 673dd7e..c44f554 100644 --- a/portato/gui/gtk/exception_handling.py +++ b/portato/gui/gtk/exception_handling.py @@ -70,7 +70,7 @@ class UncaughtExceptionDialog(gtk.MessageDialog): textbuffer = self.textview.get_buffer() self.text = get_trace(type, value, tb) if thread: - self.text = _("Exception in thread \"%(thread)s\":\n%(trace)s") % {"thread": thread, "trace": text} + self.text = _("Exception in thread \"%(thread)s\":\n%(trace)s") % {"thread": thread, "trace": self.text} textbuffer.set_text(self.text) self.textview.set_size_request(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/3) 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) |