Merge lp:~manishsinha/cheers/signals-handled into lp:~cheers/cheers/trunk

Proposed by Seif Lotfy
Status: Merged
Merged at revision: 21
Proposed branch: lp:~manishsinha/cheers/signals-handled
Merge into: lp:~cheers/cheers/trunk
Diff against target: 625 lines (+329/-70)
12 files modified
LICENSE (+21/-0)
MAINTAINERS (+1/-0)
README (+39/-0)
aa.trophy (+1/-0)
cheers-daemon (+29/-0)
cheers-daemon.py (+0/-27)
cheers/client.py (+47/-24)
cheers/config.py (+12/-0)
cheers/datastore.py (+102/-4)
cheers/server.py (+14/-15)
cheers/test_client.py (+41/-0)
setup.py (+22/-0)
To merge this branch: bzr merge lp:~manishsinha/cheers/signals-handled
Reviewer Review Type Date Requested Status
Cheers Pending
Review via email: mp+39476@code.launchpad.net
To post a comment you must log in.
21. By Manish Sinha (मनीष सिन्हा)

Changed all the wrapper methods in lower case _ seperated names and set the default awarded state to 0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'LICENSE'
2--- LICENSE 2010-10-03 18:20:14 +0000
3+++ LICENSE 2010-10-27 20:47:49 +0000
4@@ -0,0 +1,21 @@
5+# The MIT/X11/Expat License
6+
7+# Copyright (c) 2010 Manish Sinha<mail@manishsinha.net>
8+
9+# Permission is hereby granted, free of charge, to any person obtaining a copy
10+# of this software and associated documentation files (the "Software"), to deal
11+# in the Software without restriction, including without limitation the rights
12+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+# copies of the Software, and to permit persons to whom the Software is
14+# furnished to do so, subject to the following conditions:
15+
16+# The above copyright notice and this permission notice shall be included in
17+# all copies or substantial portions of the Software.
18+
19+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+# THE SOFTWARE.
26
27=== modified file 'MAINTAINERS'
28--- MAINTAINERS 2010-10-03 18:20:14 +0000
29+++ MAINTAINERS 2010-10-27 20:47:49 +0000
30@@ -0,0 +1,1 @@
31+Manish Sinha <mail@manishsinha.net>
32
33=== modified file 'README'
34--- README 2010-10-03 18:20:14 +0000
35+++ README 2010-10-27 20:47:49 +0000
36@@ -0,0 +1,39 @@
37+Cheers is a trophy awarding framework. It runs as a daemon activating a DBus Session bus over which applications can talk to it.
38+The aim of cheers is to have a centralized system where all the trophies can be stored. This removes the reduendency of every application with requirements which sounds like trophjy/medal/badges to have their own implementation.
39+
40+It is written using python, sqlite, dbus
41+
42+Prerequisties
43+---------------
44+To get cheers up and running, you need the following packages. Please check your distribution for the exact name of the packages
45+* python
46+* python-dbus
47+* python-sqlite
48+* python-gio
49+* python-glib
50+* python-gtk
51+
52+
53+
54+Running
55+---------
56+Execute cheers-daemon using the command
57+
58+./cheers-daemon.py
59+
60+
61+Registering a trophy
62+---------------------
63+
64+Cheers keeps a watch on three folders for new trophies when the server is running. These two folders are
65+* /usr/share/cheers/trophies
66+* /usr/local/share/cheers/trophies
67+* ~/.local/share/cheers/trophies
68+
69+A sample trophy aa.trophy is provided. Put it under the folder ~/.local/share/cheers/trophies to register the trophy
70+
71+
72+Debugging
73+------------
74+
75+Use D-feet DBus debugger to have a look at the DBus API
76
77=== added file 'aa.trophy'
78--- aa.trophy 1970-01-01 00:00:00 +0000
79+++ aa.trophy 2010-10-27 20:47:49 +0000
80@@ -0,0 +1,1 @@
81+{"id":"Name","setname":"Music", "seticon": "", "app":"application://banshee.desktop", "appname":"Banshee Music Player", "title":"FM Junkie", "iconpath":"", "priority": 1, "unlocked": "False", "stockicon":"", "desc": {"1": {"lang":"en-us", "desc": "Listen to Music alot"}, "2": {"lang":"en-uk", "desc": "Listen to Music a lot, a lot"}}}
82
83=== added file 'cheers-daemon'
84--- cheers-daemon 1970-01-01 00:00:00 +0000
85+++ cheers-daemon 2010-10-27 20:47:49 +0000
86@@ -0,0 +1,29 @@
87+#! /usr/bin/env python
88+
89+# The MIT/X11/Expat License
90+# Copyright (c) 2010 Manish Sinha<mail@manishsinha.net>
91+
92+# Permission is hereby granted, free of charge, to any person obtaining a copy
93+# of this software and associated documentation files (the "Software"), to deal
94+# in the Software without restriction, including without limitation the rights
95+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
96+# copies of the Software, and to permit persons to whom the Software is
97+# furnished to do so, subject to the following conditions:
98+
99+# The above copyright notice and this permission notice shall be included in
100+# all copies or substantial portions of the Software.
101+
102+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
103+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
105+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
106+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
107+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
108+# THE SOFTWARE.
109+
110+
111+from cheers import server
112+
113+if __name__ == "__main__":
114+
115+ server.TrophyServer()
116
117=== removed file 'cheers-daemon.py'
118--- cheers-daemon.py 2010-10-17 20:31:25 +0000
119+++ cheers-daemon.py 1970-01-01 00:00:00 +0000
120@@ -1,27 +0,0 @@
121-# The MIT/X11/Expat License
122-# Copyright (c) 2010 Manish Sinha<mail@manishsinha.net>
123-
124-# Permission is hereby granted, free of charge, to any person obtaining a copy
125-# of this software and associated documentation files (the "Software"), to deal
126-# in the Software without restriction, including without limitation the rights
127-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
128-# copies of the Software, and to permit persons to whom the Software is
129-# furnished to do so, subject to the following conditions:
130-
131-# The above copyright notice and this permission notice shall be included in
132-# all copies or substantial portions of the Software.
133-
134-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
136-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
137-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
138-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
139-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
140-# THE SOFTWARE.
141-
142-
143-from cheers import server
144-
145-
146-if __name__ == "__main__":
147- cheers_server = server.TrophyServer()
148
149=== modified file 'cheers/client.py'
150--- cheers/client.py 2010-10-03 19:24:44 +0000
151+++ cheers/client.py 2010-10-27 20:47:49 +0000
152@@ -23,6 +23,9 @@
153 from config import *
154 from datamodel import *
155
156+from dbus.mainloop.glib import DBusGMainLoop
157+DBusGMainLoop(set_as_default=True)
158+
159 class Cheers(object):
160 """ The actual client which interfaces with the OMG Daemon """
161
162@@ -30,79 +33,99 @@
163
164 def __init__(self):
165 bus = dbus.SessionBus()
166- self.__interface = bus.get_object(OMG_BUS_NAME, OMG_OBJECT_PATH)
167-
168- def AwardTrophy(self, id, setname):
169+ self.__interface = bus.get_object(CHEERS_BUS_NAME, CHEERS_OBJECT_PATH)
170+
171+ def connect(self, signal, callback, **kwargs):
172+ """Connect a callback to a signal of the current proxy instance."""
173+ def _callback(*args, **kwargs):
174+ callback(args)
175+ self.__interface.connect_to_signal(signal, _callback, sender_keyword='sender')
176+
177+ def trophy_awarded(self, callback, **kwargs):
178+ """ Connect the callback to TrophyAwarded signal """
179+
180+ self.connect("TrophyAwarded", callback)
181+
182+ def trophy_deleted(self, callback, **kwargs):
183+ """ Connect the callback to TrophyDeleted signal """
184+
185+ self.connect("TrophyDeleted", callback)
186+
187+ def trophy_unawarded(self, callback, **kwargs):
188+ """ Connect the callback to TrophyUnAwarded signal """
189+
190+ self.connect("TrophyUnAwarded", callback)
191+
192+ def award_trophy(self, id, setname):
193 """ Awards the trophy specified by it's id and the setName.
194
195 Even though the id contains the setname, it is required that setname be explicitly passed
196- If the trophy has been registered, then it is awarded a small notify-osd(libnotify) notification is shown.
197+ If the trophy has been registered, then a notify-osd(libnotify) notification is shown.
198 If the trophy is not registered or has already been awarded, then nothing happens. Call GetTrophy(id,set) to check whether it trophy exists or has already been awarded.
199 """
200- self.__interface.AwardTrophy(id, setname)
201+ self.__interface.AwardTrophy(id)
202
203- def DeleteTrophy(self, id, setname):
204+ def delete_trophy(self, id, setname):
205 """ Deletes the trophy permanently from the trophy store.
206
207 This is reverse of registering a trophy. This action is irreversible. Use with caution """
208
209- res = self.__interface.DeleteTrophy(id, setname)
210-
211- return Response(res[0], res[1], res[2])
212-
213- def UnAwardTrophy(self, id, setname):
214+ self.__interface.DeleteTrophy(id)
215+
216+ def unaward_trophy(self, id):
217 """ Do the reverse of awarding the trophy. Useful for debugging purposes """
218
219- res = self.__interface.UnAwardTrophy(id, setname)
220-
221- return Response(res[0], res[1], res[2])
222+ self.__interface.UnAwardTrophy(id)
223
224
225- def GetTrophies(self):
226+ def get_trophies(self):
227 """ Get all the trophies registsred by OMG """
228
229 trophy_list = self.__interface.GetTrophies()
230 return [self.__UnwrapTrophy(trp) for trp in trophy_list]
231
232- def GetTrophy(self, id, setname):
233+ def get_trophy(self, id):
234 """ Get a trophy given it's id and setname """
235
236- trophy = self.__interface.GetTrophy(str(id), str(setname))
237+ trophy = self.__interface.GetTrophy(str(id))
238 return self.__UnwrapTrophy(trophy)
239
240- def GetTrophyBySet(self, setname):
241+ def get_trophy_by_set(self, setname):
242 """ Get all the trophies for the supplied set """
243
244 trophy_list = self.__interface.GetTrophyBySet(str(setname))
245 return [self.__UnwrapTrophy(trp) for trp in trophy_list]
246
247- def GetTrophyByApp(self, appname):
248+ def get_trophy_by_app(self, appname):
249 """ Get all the trophies registered by a specific application"""
250
251 trophy_list = self.__interface.GetTrophyByApp(str(appname))
252 return [self.__UnwrapTrophy(trp) for trp in trophy_list]
253
254- def GetTrophyById(self, id):
255+ def get_trophy(self, id):
256 """ Get the trophie registered by it's ID"""
257
258 trophy_list = self.__interface.GetTrophyById(str(id))
259 return [self.__UnwrapTrophy(trp) for trp in trophy_list]
260
261- def GetAllSetNames(self):
262+ def get_all_setnames(self):
263 """ Get the name of all the Trophy sets """
264
265 set_names = self.__interface.GetAllSetNames()
266 return [str(name) for name in set_names]
267
268
269- def Quit(self):
270+ def quit(self):
271 """ Exits the OMG Daemon """
272-
273- self.__interface.Quit()
274+ try:
275+ self.__interface.Quit()
276+ except dbus.DBusException:
277+ pass
278
279 def __UnwrapTrophy(self, trophy):
280 """ Unwraps the trophy instances as per the positions """
281
282+ print(trophy)
283 return Trophy(trophy[0], trophy [1], trophy [2], trophy [4], \
284 trophy[5], trophy[6], trophy[7], trophy[3], \
285 trophy[8], trophy[9], trophy[10], trophy[11])
286
287=== modified file 'cheers/config.py'
288--- cheers/config.py 2010-10-12 19:29:39 +0000
289+++ cheers/config.py 2010-10-27 20:47:49 +0000
290@@ -31,6 +31,7 @@
291
292 trophy_dump_path = os.path.join(cheers_data_path, "trophies")
293 global_trophy_path = "/usr/share/cheers/trophies"
294+global_trophy_path_local = "/usr/local/share/cheers/trophies"
295
296 DATA_STORE_TYPE = "sqlite"
297
298@@ -47,10 +48,21 @@
299 create_desc_command = "CREATE TABLE description (id TEXT, language TEXT, desc TEXT)"
300 create_app_command = "CREATE TABLE app(appid INTEGER, app TEXT, appname TEXT)"
301 create_set_command = "CREATE TABLE appset(setid INTEGER, setname TEXT, seticon TEXT)"
302+create_history_command = "CREATE TABLE history(id TEXT, timestamp INTEGER)"
303+
304+insert_history_command = "INSERT INTO history VALUES(?,?)"
305+insert_trophy_command = "INSERT INTO trophy VALUES(?,?,?,?,?,?,?,?,?)"
306+insert_desc_command = "INSERT INTO description VALUES(?,?,?)"
307+insert_app_command = "INSERT INTO app VALUES(?,?,?)"
308+insert_set_command = "INSERT INTO appset VALUES(?,?,?)"
309
310 fetch_trophy_where = "SELECT trophy.id, trophy.title, trophy.iconpath, app.app, app.appname, appset.setname, appset.seticon, trophy.priority, trophy.unlocked, trophy.timestamp, trophy.stockicon FROM trophy, app,appset WHERE trophy.app=app.appid and trophy.appset=appset.setid and %s=:value"
311 fetch_trophy_all = "select trophy.id, trophy.title, trophy.iconpath, app.app, app.appname, appset.setname, appset.seticon, trophy.priority, trophy.unlocked, trophy.timestamp, trophy.stockicon FROM trophy, app,appset WHERE trophy.app=app.appid and trophy.appset=appset.setid"
312 fetch_description = "SELECT language, desc FROM description WHERE id=:Id"
313+fetch_history = "SELECT * FROM history WHERE id=?"
314+fetch_set_byname = "SELECT * FROM appset WHERE setname=?"
315+fetch_app_byapp = "SELECT * FROM app where app=?"
316+fetch_sets = "SELECT setname FROM appset"
317
318 award_trophy_command = "UPDATE trophy SET unlocked=1 WHERE id=?"
319 unaward_trophy_command = "UPDATE trophy SET unlocked=0 WHERE id=?"
320
321=== modified file 'cheers/datastore.py'
322--- cheers/datastore.py 2010-10-12 19:29:39 +0000
323+++ cheers/datastore.py 2010-10-27 20:47:49 +0000
324@@ -22,6 +22,8 @@
325 import os
326 import sqlite3
327 import config
328+import random
329+import datetime
330
331 class SqliteStore():
332 """ Implement the data storage based using sqlite as backend
333@@ -46,27 +48,116 @@
334 # Try creating the tables
335 try:
336 self.__cur.execute(config.create_trophy_command)
337+ except sqlite3.OperationalError:
338+ print("Trophy Table existed")
339+
340+ try:
341 self.__cur.execute(config.create_desc_command)
342+ except sqlite3.OperationalError:
343+ print("Description Table existed")
344+
345+ try:
346 self.__cur.execute(config.create_app_command)
347+ except sqlite3.OperationalError:
348+ print("App Table existed")
349+
350+ try:
351 self.__cur.execute(config.create_set_command)
352- print("All tables create successfully")
353- except sqlite3.OperationalError:
354- print("Table existed")
355+ except sqlite3.OperationalError:
356+ print("Set Table existed")
357+
358+ try:
359+ self.__cur.execute(config.create_history_command)
360+ except sqlite3.OperationalError:
361+ print("History Table existed")
362+
363
364 self.__res_cursor=None
365
366+ def AddTrophy(self, json_data):
367+ """ Add the trophy to the database from the JSON data passed """
368+
369+ res_history = self.__cur.execute(config.fetch_history, (json_data["id"],))
370+ fetch_trp = config.fetch_trophy_where %("id",)
371+ res_trophy = self.__cur.execute(fetch_trp, { "value":json_data["id"] })
372+ if(len(res_history.fetchall()) == 0 and len(res_trophy.fetchall()) == 0):
373+
374+ # Searching and Inserting Sets
375+ set_list = self.__cur.execute(config.fetch_set_byname, (json_data["setname"],))
376+ matched_set = set_list.fetchone()
377+ if matched_set is None:
378+ # Does not exist, create one
379+ print("Set '%s' does not exist. Creating." %(json_data["setname"],))
380+ setid = int(random.random()*10000000)
381+ self.__cur.execute(config.insert_set_command, (setid, json_data["setname"], json_data["seticon"]))
382+ else:
383+ # Exists. Use it
384+ print("Set '%s' already exists. Will be reused" %(matched_set[1],))
385+ setid = matched_set[0]
386+
387+ # Searching and Inserting Apps
388+ app_list = self.__cur.execute(config.fetch_app_byapp, (json_data["app"],))
389+ matched_app = app_list.fetchone()
390+ if matched_app is None:
391+ # Does not exist, create one
392+ print("App '%s' does not exist. Creating." %(json_data["app"],))
393+ appid = int(random.random()*10000000)
394+ self.__cur.execute(config.insert_app_command, (appid, json_data["app"], json_data["appname"]))
395+ else:
396+ # Exists. Use it
397+ print("App '%s' already exists. Will be reused" %(matched_app[1],))
398+ appid = matched_app[0]
399+
400+
401+ # Remove all description for this Id if present
402+ desc_list = self.__cur.execute(config.remove_desc_command, (json_data["id"],))
403+ # Inserting Description
404+ desc_list = json_data["desc"]
405+ for desc in desc_list.values():
406+ self.__cur.execute(config.insert_desc_command, (json_data["id"], desc["lang"], desc["desc"]))
407+
408+ timestamp = int(datetime.datetime(1970,01,01).today().strftime("%s"))
409+
410+ try:
411+ # Inserting Trophy
412+ is_present = self.Search("trophy.id", json_data["id"])
413+ if len(is_present) > 0:
414+ print("The trophy '%s' already exists" %(json_data["id"], ))
415+ else:
416+ self.__cur.execute(config.insert_trophy_command, ( json_data["id"], \
417+ json_data["title"], \
418+ json_data["iconpath"], \
419+ appid, \
420+ setid, \
421+ int(json_data["priority"]), \
422+ 0, \
423+ timestamp, \
424+ json_data["stockicon"]))
425+
426+ # Inserting History
427+ self.__cur.execute(config.insert_history_command, (json_data["id"], timestamp))
428+
429+ self.__conn.commit()
430+ pass
431+ except:
432+ raise
433+
434+
435 def AwardTrophy(self, id):
436 """ Award the trophy """
437+
438 self.__cur.execute(config.award_trophy_command, (id,))
439 self.__conn.commit()
440
441 def UnAwardTrophy(self, id):
442 """ Un-Award the trophy """
443+
444 self.__cur.execute(config.unaward_trophy_command, (id,))
445 self.__conn.commit()
446
447 def DeleteTrophy(self, id):
448 """ Un-Award the trophy """
449+
450 self.__cur.execute(config.remove_trophy_command, (id,))
451 self.__cur.execute(config.remove_desc_command, (id,))
452 self.__conn.commit()
453@@ -94,6 +185,7 @@
454
455 for val in self.__res_cursor:
456 desc_cursor = self.__cur.execute(config.fetch_description, {"Id": val[0]})
457+ print(desc_cursor)
458 # Create the Localization Description
459 desc_list = [[desc[0], desc[1]] for desc in desc_cursor]
460
461@@ -102,13 +194,19 @@
462
463 trophy_list.append(trp)
464
465- print(trophy_list)
466 return trophy_list
467
468+ def GetSetList(self):
469+ """ Get a list of app the sets present in the database """
470+
471+ set_list = self.__cur.execute(config.fetch_sets)
472+ return [setname[0] for setname in set_list.fetchall()]
473+
474 def _CreateTrophyDBus(self, desc_list, trp):
475 """ Create the DBus representation of Trophy which is to be sent
476 over DBus matching the signature a(ssaasssssisbxs)
477 """
478+
479 if trp[8] == 0:
480 unlocked = 0
481 else:
482
483=== modified file 'cheers/server.py'
484--- cheers/server.py 2010-10-17 20:31:25 +0000
485+++ cheers/server.py 2010-10-27 20:47:49 +0000
486@@ -28,6 +28,7 @@
487 import json
488 import gio
489 import glib
490+import pynotify
491 import gtk
492 import threading
493
494@@ -63,15 +64,20 @@
495 global_monitor = global_dump.monitor_directory(gio.FILE_MONITOR_NONE, None)
496 global_monitor.connect("changed", self.directory_changed)
497
498+ if os.path.exists(config.global_trophy_path_local):
499+ global_dump_local = gio.File(config.global_trophy_path_local)
500+ global_monitor_local = global_dump_local.monitor_directory(gio.FILE_MONITOR_NONE, None)
501+ global_monitor_local.connect("changed", self.directory_changed)
502+
503 # Start the MainLoop
504 glib.MainLoop().run()
505
506 def directory_changed(self, monitor, file1, file2, evt_type):
507 """ The callback for handling the directory changes notification """
508
509- if (evt_type in (gio.FILE_MONITOR_EVENT_CREATED,)):
510- print "Changed:", file1, file2, evt_type
511- self.AddTrophy(file1.get_path())
512+ if (evt_type in (gio.FILE_MONITOR_EVENT_CREATED,)):
513+ print "Changed:", file1, file2, evt_type
514+ self.AddTrophy(file1.get_path())
515
516 def AddTrophy(self, trophy_file):
517 """ Read the JSON trophy files and register it """
518@@ -81,6 +87,7 @@
519 json_data = json.load(fs)
520 fs.close()
521
522+ self.__store.AddTrophy(json_data)
523
524 @dbus.service.method(config.CHEERS_BUS_NAME, in_signature='s')
525 def DeleteTrophy(self, id):
526@@ -135,8 +142,8 @@
527
528
529
530- @dbus.service.method(config.CHEERS_BUS_NAME, in_signature='ss')
531- def UnAwardTrophy(self, id, setname):
532+ @dbus.service.method(config.CHEERS_BUS_NAME, in_signature='s')
533+ def UnAwardTrophy(self, id):
534 """ Find the trophy to be unawarded, unaward it and send a async reply via event """
535
536 trophies = self.__store.Search("trophy.id", id)
537@@ -194,13 +201,5 @@
538
539 @dbus.service.method(config.CHEERS_BUS_NAME, out_signature='as')
540 def GetAllSetNames(self):
541- pass
542-
543-
544-class MyThread(threading.Thread):
545- def __init__(self, notifier):
546- self.__notifier = notifier
547- threading.Thread.__init__ ( self )
548- def run(self):
549- print("inotify started")
550- self.__notifier.loop()
551+ """ Get the list of all the trophy set known by cheers """
552+ return self.__store.GetSetList()
553
554=== added file 'cheers/test_client.py'
555--- cheers/test_client.py 1970-01-01 00:00:00 +0000
556+++ cheers/test_client.py 2010-10-27 20:47:49 +0000
557@@ -0,0 +1,41 @@
558+# The MIT/X11/Expat License
559+# Copyright (c) 2010 Seif Lotfy<seiflotfy@googlemail.com>
560+
561+# Permission is hereby granted, free of charge, to any person obtaining a copy
562+# of this software and associated documentation files (the "Software"), to deal
563+# in the Software without restriction, including without limitation the rights
564+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
565+# copies of the Software, and to permit persons to whom the Software is
566+# furnished to do so, subject to the following conditions:
567+
568+# The above copyright notice and this permission notice shall be included in
569+# all copies or substantial portions of the Software.
570+
571+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
572+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
573+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
574+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
575+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
576+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
577+# THE SOFTWARE.
578+
579+from client import Cheers
580+import gtk
581+
582+
583+def handle_awarded(trophies):
584+ print "Awarded"
585+
586+def handle_deleted(trophies):
587+ print "Deleted"
588+
589+def handle_unawarded(trophies):
590+ print "Unawarded"
591+
592+cheers = Cheers()
593+
594+cheers.trophy_awarded(handle_awarded)
595+cheers.trophy_deleted(handle_deleted)
596+cheers.trophy_unawarded(handle_unawarded)
597+
598+gtk.main()
599
600=== modified file 'setup.py'
601--- setup.py 2010-10-03 18:20:14 +0000
602+++ setup.py 2010-10-27 20:47:49 +0000
603@@ -0,0 +1,22 @@
604+#!/usr/bin/env python
605+
606+from distutils.core import setup
607+
608+setup(name='cheers',
609+ version='0.1.0',
610+ description='Trophy awarding framework',
611+ long_description='Cheers is a trophy awarding framework. It runs as a daemon activating a DBus Session bus over which applications can talk to it. The aim of cheers is to have a centralized system where all the trophies can be stored. This removes the reduendency of every application with requirements which sounds like trophjy/medal/badges to have their own implementation.',
612+ author='Manish Sinha',
613+ author_email='mail@manishsinha.net',
614+ url='http://cheers-project.com/',
615+ license='MIT/X11/Expat License',
616+ platforms='Posix; MacOSX',
617+ py_modules=['cheers.client',
618+ 'cheers.config',
619+ 'cheers.datamodel',
620+ 'cheers.datastore',
621+ 'cheers.server'],
622+ scripts=['cheers-daemon'],
623+ data_files=[('share/doc/apt-offline', ['LICENSE',
624+ 'MAINTAINERS', 'README'])]
625+ )

Subscribers

People subscribed via source and target branches