[pitivi] elements: Reuse computed values when saving state



commit 879adac819955b72f99bb3a15c0bf38543fa0c44
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Jul 7 15:09:05 2015 +0200

    elements: Reuse computed values when saving state
    
    https://phabricator.freedesktop.org/D245

 pitivi/timeline/elements.py |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 1cb073c..021050b 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -607,30 +607,17 @@ class Clip(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
         self._videoSource = None
 
         self._setupWidget()
+        self.__force_position_update = True
 
         for child in self.bClip.get_children(False):
             self._childAdded(self.bClip, child)
             self.__connectToChild(child)
 
-        self._savePositionState()
         self._connectWidgetSignals()
 
         self._connectGES()
         self.get_accessible().set_name(self.bClip.get_name())
 
-    def _savePositionState(self, y=0):
-        self.__force_position_update = False
-        self._current_x = self.nsToPixel(self.bClip.props.start)
-        self._current_y = y
-        self._curent_width = self.nsToPixel(self.bClip.props.duration)
-        parent = self.get_parent()
-        if parent:
-            self._current_parent_height = self.get_parent(
-            ).get_allocated_height()
-        else:
-            self._current_parent_height = 0
-        self._current_parent = parent
-
     def __computeHeightAndY(self):
         parent = self.get_parent()
         parent_height = parent.get_allocated_height()
@@ -672,7 +659,12 @@ class Clip(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
             for child in elements:
                 child.setSize(width, height / len(elements))
 
-            self._savePositionState(y)
+            self.__force_position_update = False
+            self._current_x = x
+            self._current_y = y
+            self._curent_width = width
+            self._current_parent_height = parent.get_allocated_height()
+            self._current_parent = parent
 
     def _setupWidget(self):
         pass


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