Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mesh
diff options
context:
space:
mode:
authorAntoine van Gelder <antoine@g7.org.za>2007-10-29 09:21:06 (GMT)
committer Antoine van Gelder <antoine@g7.org.za>2007-10-29 09:21:06 (GMT)
commit420f73b64979f4a695c780f080c8873229260f27 (patch)
tree82aca565218aaf445ffb0f556c5f5c91024d119c /mesh
parent05d7e0283b978bb4836a1ddf8833b039ae55f130 (diff)
JokeMachine-3.xo
* Feature: Put alerts up when joke submitted and approved over mesh * Feature: Put alert up advising patience when joining a shared jokebook * Feature: Made Lesson Plans button work * Feature: Safe fallback for builds without sugar.alert * Feature: Hooked LanguageCombo up * i18n: Created (a rough!) Afrikaans translation * Fixed: Prepended Cover on preview * Fixed: Don't hardcode JokeEditor delete button position * Fixed: On read jokebook & empty -> "Edit My Jokes" -> Go to edit my jokes tab * Updated :Mesh code for dbus tubes changes
Diffstat (limited to 'mesh')
-rw-r--r--mesh/activitysession.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/mesh/activitysession.py b/mesh/activitysession.py
index 6c2b51b..b7dfb89 100644
--- a/mesh/activitysession.py
+++ b/mesh/activitysession.py
@@ -25,9 +25,9 @@ from globals import Globals
from persistence.jokemachinestate import JokeMachineState
from persistence.joke import Joke
-MESH_SERVICE = 'org.worldwideworkshop.JokeMachine'
+MESH_SERVICE = 'org.worldwideworkshop.olpc.JokeMachine'
MESH_IFACE = MESH_SERVICE
-MESH_PATH = '/org/worldwideworkshop/JokeMachine'
+MESH_PATH = '/org/worldwideworkshop/olpc/JokeMachine'
@@ -146,7 +146,9 @@ class JokeMachineSession(ExportedGObject):
logging.debug('JokeMachineSession.submit_cb() -> empty joke_pickle - doing nothing')
return
joke = Joke.loads(joke_pickle)
- logging.debug('%s submitted a joke to my jokebook# %d with text: %s and answer %s', joke.joker, jokebook_id, joke.text, joke.answer)
+ if joke is None:
+ logging.error('JokeMachineSession.submit_cb -> could not unpickle joke')
+ return
# 2. get the jokebook it belongs to
jokebook = Globals.JokeMachineState.jokebook(jokebook_id)
@@ -155,17 +157,20 @@ class JokeMachineSession(ExportedGObject):
return
# 3. add it to submissions in the appropriate jokebook
+ logging.debug('%s submitted a joke to my jokebook# %d with text: %s and answer %s', joke.joker, jokebook_id, joke.text, joke.answer)
jokebook.submissions.append(joke)
- # 4. TODO - show some kind of alert - ask on #sugar
+ # 4. alert the owner
+ message = str(joke.joker) + _(' submitted a joke to ') + str(jokebook.title)
+ Globals.JokeMachineActivity.alert(_('Joke Machine'), message)
# e -> I am the initiator, I've just accepted a submission, tell everyone!
- @signal (dbus_interface=MESH_IFACE, signature='us')
- def BroadcastJoke(self, jokebook_id, joke_pickle):
+ @signal (dbus_interface=MESH_IFACE, signature='uss')
+ def BroadcastJoke(self, jokebook_id, joke_pickle, sender_nick):
'''broadcast newly accepted submission back to the mesh'''
- def broadcast_joke_cb(self, jokebook_id, joke_pickle, sender):
+ def broadcast_joke_cb(self, jokebook_id, joke_pickle, sender_nick, sender):
'''handle a BroadCast Joke by creating a new joke in the local store'''
if sender == self.my_bus_name:
# Ignore my own signal
@@ -179,7 +184,9 @@ class JokeMachineSession(ExportedGObject):
logging.debug('JokeMachineSession.broadcast_joke_cb() -> empty joke_pickle - doing nothing')
return
joke = Joke.loads(joke_pickle)
- logging.debug('%s broadcast a joke to my jokebook# %d with text: %s and answer %s', joke.joker, jokebook_id, joke.text, joke.answer)
+ if joke is None:
+ logging.error('JokeMachineSession.broadcast_joke_cb -> could not unpickle joke')
+ return
# 2. get the jokebook it belongs to
jokebook = Globals.JokeMachineState.jokebook(jokebook_id)
@@ -188,10 +195,14 @@ class JokeMachineSession(ExportedGObject):
return
# 3. add it to jokes in the appropriate jokebook
+ logging.debug('%s broadcast a joke to my jokebook# %d with text: %s and answer %s', joke.joker, jokebook_id, joke.text, joke.answer)
jokebook.jokes.append(joke)
+
# 4. TODO - show some kind of alert - ask on #sugar
-
+ message = str(sender_nick) + _(' accepted a joke submitted to ') + \
+ str(jokebook.title) + _(' by ') + str(joke.joker)
+ Globals.JokeMachineActivity.alert(_('Joke Machine'), message)
# ############################################################################