[SCM] morituri/master: * examples/gtkcrc.py: * morituri/common/task.py: Don't block the main loop by infinitely scheduling set_state.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:43 UTC 2014
The following commit has been merged in the master branch:
commit 1a02c32fc1c09ced18cfb80e21e050fd927875a1
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sat Apr 11 14:58:42 2009 +0000
* examples/gtkcrc.py:
* morituri/common/task.py:
Don't block the main loop by infinitely scheduling
set_state.
diff --git a/ChangeLog b/ChangeLog
index dbcb4df..1fd574a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-04-11 Thomas Vander Stichele <thomas at apestaart dot org>
+ * examples/gtkcrc.py:
+ * morituri/common/task.py:
+ Don't block the main loop by infinitely scheduling
+ set_state.
+
+2009-04-11 Thomas Vander Stichele <thomas at apestaart dot org>
+
* examples/ARcue.py:
* examples/gtkcrc.py:
* morituri/common/task.py:
diff --git a/examples/gtkcrc.py b/examples/gtkcrc.py
index 24dfc97..3714b67 100644
--- a/examples/gtkcrc.py
+++ b/examples/gtkcrc.py
@@ -67,10 +67,7 @@ class TaskProgress(gtk.VBox, task.TaskRunner):
def progressed(self, value):
gst.info('progressed')
# FIXME: why is this not painting the progress bar ?
- print 'progress', value
self._progress.set_fraction(value)
- while gtk.events_pending():
- gtk.main_iteration()
path = 'test.flac'
@@ -94,7 +91,8 @@ except:
crctask = task.CRC32Task(path, start, end)
-class DummTask(task.Task):
+# this is a Dummy task that can be used if this works at all
+class DummyTask(task.Task):
def start(self):
task.Task.start(self)
gobject.timeout_add(1000L, self._wind)
@@ -118,8 +116,6 @@ window.show_all()
progress.run(crctask)
-print 'going main'
-
gtk.main()
print "CRC: %08X" % crctask.crc
diff --git a/morituri/common/task.py b/morituri/common/task.py
index 182f23c..ff1870e 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -47,10 +47,9 @@ class Task(object):
_listeners = None
def debug(self, *args, **kwargs):
- #return
+ return
print args, kwargs
sys.stdout.flush()
- pass
def start(self):
self.running = True
@@ -147,7 +146,16 @@ class CRCTask(Task):
sink.connect('eos', self._eos_cb)
self.debug('scheduling setting to play')
- gobject.timeout_add(0L, self._pipeline.set_state, gst.STATE_PLAYING)
+ # since set_state returns non-False, adding it as timeout_add
+ # will repeatedly call it, and block the main loop; so
+ # gobject.timeout_add(0L, self._pipeline.set_state, gst.STATE_PLAYING)
+ # would not work.
+
+ def play():
+ self._pipeline.set_state(gst.STATE_PLAYING)
+ return False
+ gobject.timeout_add(0L, play)
+
#self._pipeline.set_state(gst.STATE_PLAYING)
self.debug('scheduled setting to play')
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list