Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPootle daemon <pootle@pootle.sugarlabs.org>2012-05-22 04:32:48 (GMT)
committer Pootle daemon <pootle@pootle.sugarlabs.org>2012-05-22 04:32:48 (GMT)
commit16b5b482bd86e0bf11a0a9e1466ee0b148859fb6 (patch)
treef9aa9fd4e0ab36b12228639085eee1ff9aaf0f7f
parenta2c4a0dbbbb809ff3ec9a351cdc0ca4f51f57e56 (diff)
parent4c65b8b46fbf39859815e9afd3bb12c393b1d073 (diff)
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
-rw-r--r--TurtleArt/talogo.py2
-rw-r--r--TurtleArtActivity.py26
2 files changed, 14 insertions, 14 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 422d4f9..7e1361e 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -566,7 +566,7 @@ class LogoCode:
self.tw.clear_plugins()
if self.tw.gst_available:
from tagplay import stop_media
- # stop_media(self) # TODO: gplay variable
+ stop_media(self)
self.tw.canvas.clearscreen()
self.scale = DEFAULT_SCALE
self.hidden_turtle = None
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 5503482..24ed3f6 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -82,7 +82,7 @@ class TurtleArtActivity(activity.Activity):
_logger.error(str(e))
self._check_ver_change(get_path(activity, 'data'))
- self._setup_visibility_handler()
+ self.connect("notify::active", self._notify_active_cb)
self.has_toolbarbox = HAS_TOOLBARBOX
_logger.debug('_setup_toolbar')
@@ -503,14 +503,6 @@ class TurtleArtActivity(activity.Activity):
tmpfile = None
return tmpfile
- def __visibility_notify_cb(self, window, event):
- ''' Callback method for when the activity's visibility changes. '''
- if event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED:
- self.tw.background_plugins()
- elif event.state in \
- [gtk.gdk.VISIBILITY_UNOBSCURED, gtk.gdk.VISIBILITY_PARTIAL]:
- self.tw.foreground_plugins()
-
def _keep_clicked_cb(self, button):
''' Keep-button clicked. '''
self.jobject_new_patch()
@@ -937,10 +929,18 @@ class TurtleArtActivity(activity.Activity):
''' Resync xy position (and orientation) of my turtle. '''
self._collaboration.send_my_xy()
- def _setup_visibility_handler(self):
- ''' Notify me when the visibility state changes. '''
- self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
- self.connect('visibility-notify-event', self.__visibility_notify_cb)
+ def _notify_active_cb(self, widget, event):
+ ''' Sugar notify us that the activity is becoming active or
+ inactive. Notify plugins. '''
+ if self.props.active:
+ _logger.debug('going to foreground')
+ self.tw.foreground_plugins()
+ else:
+ # If we go to background, stop media playing.
+ if self.tw.gst_available:
+ from TurtleArt.tagplay import stop_media
+ stop_media(self.tw.lc)
+ self.tw.background_plugins()
def can_close(self):
''' Override activity class can_close inorder to notify plugins '''