hamster-applet r614 - trunk/hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r614 - trunk/hamster
- Date: Thu, 30 Oct 2008 06:57:14 +0000 (UTC)
Author: tbaugis
Date: Thu Oct 30 06:57:13 2008
New Revision: 614
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=614&view=rev
Log:
for autocomplete retrieve activities in lowercase, fixes bug 558097
Modified:
trunk/hamster/add_custom_fact.py
trunk/hamster/applet.py
trunk/hamster/db.py
trunk/hamster/storage.py
Modified: trunk/hamster/add_custom_fact.py
==============================================================================
--- trunk/hamster/add_custom_fact.py (original)
+++ trunk/hamster/add_custom_fact.py Thu Oct 30 06:57:13 2008
@@ -109,7 +109,7 @@
self.glade.signal_autoconnect(self)
def refresh_menu(self):
- all_activities = storage.get_activities()
+ all_activities = storage.get_autocomplete_activities()
self.activities.clear()
for activity in all_activities:
self.activities.append([activity['name'], activity['category']])
Modified: trunk/hamster/applet.py
==============================================================================
--- trunk/hamster/applet.py (original)
+++ trunk/hamster/applet.py Thu Oct 30 06:57:13 2008
@@ -386,9 +386,9 @@
def refresh_menu(self):
- #first populate the autocomplete - contains all entries
+ #first populate the autocomplete - contains all entries in lowercase
self.activities.clear()
- all_activities = storage.get_activities()
+ all_activities = storage.get_autocomplete_activities()
for activity in all_activities:
self.activities.append([activity['name'], activity['category']])
Modified: trunk/hamster/db.py
==============================================================================
--- trunk/hamster/db.py (original)
+++ trunk/hamster/db.py Thu Oct 30 06:57:13 2008
@@ -269,19 +269,6 @@
"""
self.execute(query, (fact_id,))
- def __get_sorted_activities(self):
- """returns list of acitivities that have categories"""
- query = """
- SELECT a.*, b.name as category, b.category_order
- FROM activities a
- LEFT JOIN categories b on coalesce(b.id, -1) = a.category_id
- WHERE a.category_id > -1
- AND a.deleted is null
- ORDER BY category_order, activity_order
- """
- return self.fetchall(query)
-
-
def __get_activities(self, category_id = None):
"""returns list of activities, if category is specified, order by name
otherwise - by activity_order"""
@@ -314,6 +301,33 @@
return activities
+ def __get_sorted_activities(self):
+ """returns list of acitivities that have categories"""
+ query = """
+ SELECT a.*, b.name as category, b.category_order
+ FROM activities a
+ LEFT JOIN categories b on coalesce(b.id, -1) = a.category_id
+ WHERE a.category_id > -1
+ AND a.deleted is null
+ ORDER BY category_order, activity_order
+ """
+ return self.fetchall(query)
+
+ def __get_autocomplete_activities(self):
+ """returns list of activities for autocomplete,
+ activity names converted to lowercase"""
+
+ query = """
+ SELECT lower(a.name) as name, b.name as category
+ FROM activities a
+ LEFT JOIN categories b on coalesce(b.id, -1) = a.category_id
+ WHERE deleted is null
+ ORDER BY lower(a.name)
+ """
+ activities = self.fetchall(query)
+
+ return activities
+
def __remove_activity(self, id):
""" check if we have any facts with this activity and behave accordingly
if there are facts - sets activity to deleted = True
Modified: trunk/hamster/storage.py
==============================================================================
--- trunk/hamster/storage.py (original)
+++ trunk/hamster/storage.py Thu Oct 30 06:57:13 2008
@@ -55,11 +55,14 @@
self.__remove_fact(fact_id)
self.dispatch('day_updated', fact['start_time'])
+ def get_activities(self, category_id = None):
+ return self.__get_activities(category_id = category_id)
+
def get_sorted_activities(self):
return self.__get_sorted_activities()
- def get_activities(self, category_id = None):
- return self.__get_activities(category_id = category_id)
+ def get_autocomplete_activities(self):
+ return self.__get_autocomplete_activities()
def get_last_activity(self):
return self.__get_last_activity()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]