Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/record.py
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-08-05 17:24:55 (GMT)
committer Daniel Drake <dsd@laptop.org>2011-08-05 17:31:20 (GMT)
commit8daca9741a0f2e1b9d9071a2e9c8e8f9ce071a6e (patch)
treec9ec67dbb5f166b16a4cde64edd4a900fdcd0f93 /record.py
parent280547bd2ff79ea30b74708ced0cea66af7afe4f (diff)
Release audio/video on visibility change (OLPC#10659)
When visibility is lost, stop recording, live feeds, countdowns, etc. Allows multiple camera-using apps to run simultaenously. This doesn't quite work correctly, having 2 Records open and switching from one to the other doesn't work as expected. Perhaps the events are being delivered without strict order, or not enough time is being given to the old Record to release its resources before activating the new one.
Diffstat (limited to 'record.py')
-rw-r--r--record.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/record.py b/record.py
index e6c7bb3..5c06f20 100644
--- a/record.py
+++ b/record.py
@@ -68,6 +68,9 @@ class Record(activity.Activity):
self.props.enable_fullscreen_mode = False
Instance(self)
+ self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
+ self.connect("visibility-notify-event", self._visibility_changed)
+
#the main classes
self.model = Model(self)
self.ui_init()
@@ -101,6 +104,9 @@ class Record(activity.Activity):
self.model.glive.stop()
super(Record, self).close()
+ def _visibility_changed(self, widget, event):
+ self.model.set_visible(event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED)
+
def _shared_cb(self, activity):
self.model.collab.set_activity_shared()
@@ -373,6 +379,7 @@ class Record(activity.Activity):
self._progress.hide()
self._controls_hbox.set_child_packing(self._shutter_button, expand=True, fill=False, padding=0, pack_type=gtk.PACK_START)
self._shutter_button.set_normal()
+ self._shutter_button.set_sensitive(True)
self._shutter_button.show()
self._media_view.show_live()
elif state == constants.STATE_RECORDING: