Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
Diffstat (limited to 'activity.py')
-rwxr-xr-xactivity.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/activity.py b/activity.py
index bb8c101..849f87a 100755
--- a/activity.py
+++ b/activity.py
@@ -95,9 +95,13 @@ class MemorizeActivity(Activity):
self.show_all()
+ # connect to the in/out events of the memorize activity
+ self.connect('focus_in_event', self._focus_in)
+ self.connect('focus_out_event', self._focus_out)
+ self.connect('destroy', self._cleanup_cb)
+
# Get the Presence Service
self.pservice = presenceservice.get_instance()
- bus = dbus.Bus()
name, path = self.pservice.get_preferred_connection()
self.tp_conn_name = name
self.tp_conn_path = path
@@ -270,3 +274,18 @@ class MemorizeActivity(Activity):
else:
_logger.debug("buddy left - _buddy_left_cb: %s", buddy.props.nick)
self.game.rem_buddy(buddy)
+
+ def _focus_in(self, event, data=None):
+ if self.game.sound == 1:
+ self.game.cs.start()
+ _logger.debug(" Memorize is visible: start csound server. ")
+
+ def _focus_out(self, event, data=None):
+ if self.game.sound == 1:
+ self.game.cs.pause()
+ _logger.debug(" Memorize is invisible: pause csound server. ")
+
+ def _cleanup_cb(self, data=None):
+ if self.game.sound == 1:
+ self.game.cs.quit()
+ _logger.debug(" Memorize closes: close csound server. ")