summaryrefslogtreecommitdiff
path: root/portato/gui
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
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')
-rw-r--r--portato/gui/templates/MainWindow.ui16
-rw-r--r--portato/gui/windows/main.py30
2 files changed, 42 insertions, 4 deletions
diff --git a/portato/gui/templates/MainWindow.ui b/portato/gui/templates/MainWindow.ui
index 8e8c3b4..d8b224c 100644
--- a/portato/gui/templates/MainWindow.ui
+++ b/portato/gui/templates/MainWindow.ui
@@ -30,6 +30,16 @@
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
+ <object class="GtkComboBox" id="typeCombo">
+ <property name="visible">True</property>
+ <signal name="changed" handler="cb_type_combo_changed"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkEntry" id="searchEntry">
<property name="visible">True</property>
<signal name="changed" handler="cb_search_changed"/>
@@ -38,7 +48,7 @@
</object>
<packing>
<property name="padding">5</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -54,7 +64,7 @@
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -69,7 +79,7 @@
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
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("")