summaryrefslogtreecommitdiff
path: root/portato/gui/gtk
diff options
context:
space:
mode:
authorNecoro <>2007-10-31 15:28:06 +0000
committerNecoro <>2007-10-31 15:28:06 +0000
commit85ce664e4532065dbea066f283d0fd50fe71714a (patch)
treed18fdc0546cf0d601d009025061ae6d4d4386e4e /portato/gui/gtk
parent11933586a448ad6bd8b6aae6fa4a36dd48cbc136 (diff)
downloadportato-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 'portato/gui/gtk')
-rw-r--r--portato/gui/gtk/exception_handling.py2
-rw-r--r--portato/gui/gtk/windows.py38
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)