[hamster-applet] "finished" + simplified the unlock code by reusing trophies module
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] "finished" + simplified the unlock code by reusing trophies module
- Date: Fri, 20 Aug 2010 09:35:59 +0000 (UTC)
commit 7b34839efa3fd547fa76ef4846e2801a934d733e
Author: Toms Bauģis <toms baugis gmail com>
Date: Fri Aug 20 10:32:56 2010 +0100
"finished" + simplified the unlock code by reusing trophies module
src/hamster/db.py | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/hamster/db.py b/src/hamster/db.py
index 14d0079..6ad68aa 100644
--- a/src/hamster/db.py
+++ b/src/hamster/db.py
@@ -73,16 +73,14 @@ class Storage(storage.Storage):
print "DB file has been modified externally. Calling all stations"
self.dispatch_overwrite()
+ # plan "b" â?? synchronize the time tracker's database from external source while the tracker is running
try:
- from gnome_achievements.client import Storage as TrophiesStorage
- trophies = TrophiesStorage()
- # plan "b" â?? synchronize the time tracker's database from external source while the tracker is running
- trophies.unlock_achievement("hamster-applet", "plan_b")
+ import trophies
+ trophies.unlock("plan_b")
except:
pass
-
self.__database_file = gio.File(self.db_path)
self.__db_monitor = self.__database_file.monitor_file()
self.__db_monitor.connect("changed", on_db_file_change)
@@ -792,6 +790,14 @@ class Storage(storage.Storage):
else:
self.execute("delete from activities where id = ?", (id,))
+ # Finished! - deleted an activity with more than 50 facts on it
+ if bound_facts >= 50:
+ try:
+ import trophies
+ trophies.unlock("finished")
+ except:
+ pass
+
def __remove_category(self, id):
"""move all activities to unsorted and remove category"""
@@ -1195,10 +1201,9 @@ class Storage(storage.Storage):
print "updated database from version %d to %d" % (version, current_version)
try:
- from gnome_achievements.client import Storage as TrophiesStorage
- trophies = TrophiesStorage()
# oldtimer â?? database version structure had been performed on startup (thus we know that he has been on at least 2 versions)
- trophies.unlock_achievement("hamster-applet", "oldtimer")
+ import trophies
+ trophies.unlock("oldtimer")
except:
pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]