pitivi r1331 - in trunk: . pitivi/ui



Author: edwardrv
Date: Thu Oct 16 14:21:02 2008
New Revision: 1331
URL: http://svn.gnome.org/viewvc/pitivi?rev=1331&view=rev

Log:
	* pitivi/ui/ruler.py:
	Fix duration query.
	Don't seek if there's no available content.

Modified:
   trunk/ChangeLog
   trunk/pitivi/ui/ruler.py

Modified: trunk/pitivi/ui/ruler.py
==============================================================================
--- trunk/pitivi/ui/ruler.py	(original)
+++ trunk/pitivi/ui/ruler.py	Thu Oct 16 14:21:02 2008
@@ -159,9 +159,14 @@
     def _doSeek(self, value, format=gst.FORMAT_TIME):
         gst.debug("seeking to %s / currentlySeeking %r" % (gst.TIME_ARGS (value),
                                                            self.currentlySeeking))
-        if (format == gst.FORMAT_TIME) and (value > self.getDuration()):
-            gst.debug("you can't seek outside of the timeline")
+        # clamping values within acceptable range
+        duration = self.getDuration()
+        if duration == gst.CLOCK_TIME_NONE:
             return
+        if value > duration:
+            value = duration
+        elif value < 0:
+            value = 0
         if not self.currentlySeeking:
             self.currentlySeeking = True
             if instance.PiTiVi.playground.seekInCurrent(value, format=format):
@@ -215,7 +220,10 @@
         self.drawRuler(context, rect)
 
     def getDuration(self):
-        return instance.PiTiVi.current.timeline.getDuration()
+        if instance.PiTiVi.current:
+            return instance.PiTiVi.current.timeline.getDuration()
+        else:
+            return gst.CLOCK_TIME_NONE
 
     def getPixelWidth(self):
         return self.nsToPixel(self.getDuration())



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]