[pitivi] timeline: Set best zoom only when stop moving objects



commit 7b06c54c153f4612fee8d8b91e7510c6b27576fa
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Fri May 18 12:49:28 2012 -0400

    timeline: Set best zoom only when stop moving objects

 pitivi/mainwindow.py        |   15 +++------------
 pitivi/timeline/timeline.py |    4 +++-
 2 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index bd3a005..0ffc7cf 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -1079,19 +1079,10 @@ class PitiviMainWindow(gtk.Window, Loggable):
         return res
 
     def _timelineDurationChangedCb(self, timeline, unused_duration):
+        duration = timeline.get_duration()
         self.debug("Timeline duration changed to %s",
-            gst.TIME_ARGS(timeline.props.duration))
-        if timeline.props.duration > 0:
-            sensitive = True
-            if self.zoomed_fitted:
-                self.log("The timeline was zoomed fitted, readjusting to fit again")
-                self.setBestZoomRatio()
-            else:
-                self.log("User had changed the zoom, so not autozooming")
-                self.timeline_ui.updateHScrollAdjustments()
-        else:
-            sensitive = False
-        self.render_button.set_sensitive(sensitive)
+            gst.TIME_ARGS(duration))
+        self.render_button.set_sensitive(duration > 0)
 
 ## other
     def _showExportDialog(self, project):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index ba089c5..f1a6d1c 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1244,6 +1244,8 @@ class Timeline(gtk.Table, Loggable, Zoomable):
                     self._layerAddedCb))
             self._layer_sig_ids.append(self._timeline.connect("layer-removed",
                     self._layerRemovedCb))
+            self._layer_sig_ids.append(timeline.connect("notify::update",
+                    self._zoomFitCb))
 
             # Make sure to set the current layer in use
             self._layerAddedCb(None, None)
@@ -1313,7 +1315,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
             self.app.gui.zoomed_fitted = True
 
 ## ToolBar callbacks
-    def _zoomFitCb(self, unused_action):
+    def _zoomFitCb(self, unused, unsued2=None):
         self.app.gui.setBestZoomRatio()
 
     def _zoomInCb(self, unused_action):



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