[pitivi/ges: 81/287] utils: Make the Seeker class a singleton and add a flush() method
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 81/287] utils: Make the Seeker class a singleton and add a flush() method
- Date: Thu, 15 Mar 2012 16:32:38 +0000 (UTC)
commit 6370d6acc0a5a8042856339a41f8c6f4227b4f4e
Author: Thibault Saunier <thibault saunier collabora com>
Date: Thu Dec 8 16:54:21 2011 -0300
utils: Make the Seeker class a singleton and add a flush() method
pitivi/utils.py | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/utils.py b/pitivi/utils.py
index 96da995..d238fb6 100644
--- a/pitivi/utils.py
+++ b/pitivi/utils.py
@@ -305,7 +305,20 @@ class PropertyChangeTracker(Signallable):
class Seeker(Signallable):
- __signals__ = {'seek': ['position', 'format']}
+ """
+ The Seeker is a singleton helper class to do various seeking
+ operations in the pipeline.
+ """
+
+ __signals__ = {'seek': ['position', 'format'],
+ 'flush': []}
+ _instance = None
+
+ def __new__(cls, *args, **kwargs):
+ if not cls._instance:
+ cls._instance = super(Seeker, cls).__new__(
+ cls, *args, **kwargs)
+ return cls._instance
def __init__(self, timeout):
self.timeout = timeout
@@ -325,6 +338,12 @@ class Seeker(Signallable):
self.pending_seek_id = self._scheduleSeek(self.timeout,
self._seekTimeoutCb)
+ def flush(self):
+ try:
+ self.emit('flush')
+ except:
+ log.doLog(log.ERROR, None, "seeker", "Error while flushing", None)
+
def _scheduleSeek(self, timeout, callback):
return gobject.timeout_add(timeout, callback)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]