summaryrefslogtreecommitdiff
path: root/portato/gui/windows
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-03-05 02:42:46 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-03-05 02:42:46 +0100
commit22bf1fe929e9997f13d0110cba1347d00fdd21cf (patch)
tree729b63c8f90d18c470078ecc4e78bfacbfa4fe5e /portato/gui/windows
parentf254bd593f3c1842658f4fb57fa87ed77d9fe993 (diff)
downloadportato-22bf1fe929e9997f13d0110cba1347d00fdd21cf.tar.gz
portato-22bf1fe929e9997f13d0110cba1347d00fdd21cf.tar.bz2
portato-22bf1fe929e9997f13d0110cba1347d00fdd21cf.zip
Added combo box for selecting the search type to main window
Diffstat (limited to 'portato/gui/windows')
-rw-r--r--portato/gui/windows/main.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 5a149f8..4a9971f 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -496,6 +496,8 @@ class MainWindow (Window):
# search entry
self.searchEntry = self.tree.get_widget("searchEntry")
+ self.typeCombo = self.tree.get_widget("typeCombo")
+ self.build_type_combo()
# queue list
self.queueOneshot = self.tree.get_widget("oneshotCB")
@@ -871,6 +873,26 @@ class MainWindow (Window):
else: # no selCatName -> so no category selected --> ignore
debug("No category selected --> should be no harm.")
+ def build_type_combo (self):
+ model = gtk.ListStore(int, str)
+ for k,v in self.db.TYPES.iteritems():
+ model.append((k,v))
+
+ self.typeCombo.set_model(model)
+ cell = gtk.CellRendererText()
+ self.typeCombo.pack_start(cell)
+ self.typeCombo.set_attributes(cell, text = 1)
+
+
+ for i, (k, v) in enumerate(model):
+ if k == self.db.type: break
+
+ self.typeCombo.set_active(i)
+
+ types = self.db.search_types()
+ if types == 1 or types % 2 == 0:
+ self.typeCombo.set_sensitive(False)
+
def load_session(self, sessionEx = None, defaults_only = False):
"""
Loads the session data.
@@ -1562,7 +1584,13 @@ class MainWindow (Window):
return False # not again ;)
- gobject.timeout_add(100, __update)
+ gobject.timeout_add(200, __update)
+
+ def cb_type_combo_changed (self, *args):
+ model = self.typeCombo.get_model()
+ active = self.typeCombo.get_active()
+
+ self.db.type = model[active][0]
def cb_delete_search_clicked (self, *args):
self.searchEntry.set_text("")