[hamster-applet] case sensitivity fixes for category autocomplete and better treatment for single results



commit b091df3fbae5aed330a0dc37a963ce2e3e4283dc
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Jul 19 18:17:07 2009 +0300

    case sensitivity fixes for category autocomplete and better treatment for single results

 hamster/applet.py |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/hamster/applet.py b/hamster/applet.py
index eb3aca0..0816f44 100755
--- a/hamster/applet.py
+++ b/hamster/applet.py
@@ -349,6 +349,7 @@ class HamsterApplet(object):
         self.completion.set_minimum_key_length(1)
         self.completion.set_inline_completion(True)
         self.completion.set_popup_set_width(False)
+        self.completion.set_popup_single_match(False)
         self.completion.set_text_column(0)
         self.activity_combo.child.set_completion(self.completion)
         
@@ -419,14 +420,12 @@ class HamsterApplet(object):
         parsed_activity = stuff.parse_activity_input(entry.get_text())
 
         if input_text.find("@") > 0:
-            key = input_text[input_text.find("@")+1:]
+            key = input_text[input_text.find("@")+1:].lower()
             for category in self.all_categories:
-                if category['name'].startswith(key):
-                    fillable = input_text[:input_text.find("@") + 1] + category['name']
-                    store.append([fillable, category['name'], category['name']])
-            if len(store) <= 1:
-                #avoid popup on single result
-                store.clear()
+                if key in category['name'].lower():
+                    fillable = (input_text[:input_text.find("@") + 1] + category['name']).lower()
+                    store.append([fillable, category['name'], fillable])
+
         else:
             for activity in self.all_activities:
                 fillable = activity['name']



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]