pitivi r1150 - in branches/SOC_2008_BLEWIS: . pitivi/ui



Author: blewis
Date: Mon Jun 30 11:28:07 2008
New Revision: 1150
URL: http://svn.gnome.org/viewvc/pitivi?rev=1150&view=rev

Log:
* pitivi/ui/complextimeline.py:
make resizing work properly again
* pitivi/ui/util.py:
make VLists actually work correctly and be reorderable by replacing HList
specific code with calles to List interface methods.


Modified:
   branches/SOC_2008_BLEWIS/ChangeLog
   branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py
   branches/SOC_2008_BLEWIS/pitivi/ui/util.py

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py	Mon Jun 30 11:28:07 2008
@@ -159,7 +159,7 @@
 
     def _zoom(self):
         """Force resize if zoom ratio changes"""
-        for child in self.widgets:
+        for child in self.elements:
             element = self.elements[child]
             start = element.start
             duration = element.duration

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/util.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/util.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/util.py	Mon Jun 30 11:28:07 2008
@@ -313,6 +313,9 @@
     def __len__(self):
         return len(self.order)
 
+    def __iter__(self):
+        return self.order.__iter__()
+
     def __init__(self, *args, **kwargs):
         SmartGroup.__init__(self, *args, **kwargs)
         self.cur_pos = 0
@@ -338,6 +341,9 @@
         else:
             for child in self.order:
                 self.unmake_reorderable(child)
+    
+    def end(self, child):
+        return self.position(child) + self.dimension(child)
 
     def tidy(self):
         cur = 0
@@ -378,7 +384,7 @@
     def _child_drag_start(self, child):
         child.raise_(None)
         self.draging = child
-        self.dwidth = width(self.draging)
+        self.dwidth = self.dimension(child)
         self._set_drag_thresholds()
         return True
 
@@ -388,12 +394,12 @@
         self.right = None
         if index > 0:
             self.left = self.order[index - 1]
-            self.l_thresh = (right(self.left) - 0.5 * width(self.left)
+            self.l_thresh = (self.end(self.left) - 0.5 * self.dimension(self.left)
                 + self.spacing)
         if index < len(self.order) - 1:
             self.right = self.order[index + 1]
-            self.r_thresh = (left(self.right) + 0.5 * width(self.right)
-                - width(self.draging) + self.spacing)
+            self.r_thresh = (self.position(self.right) + 0.5 * self.dimension(self.right)
+                - self.dimension(self.draging) + self.spacing)
 
     def _child_drag_end(self, child):
         self.left = None
@@ -414,15 +420,15 @@
         return True
 
     def _child_drag(self, pos_):
-        x, y = pos_
-        x = (min(self.width - width(self.draging),  max(0, x)))
+        coord = self.coord(pos_)
+        coord = (min(self.dimension(self) - self.dimension(self.draging),  max(0, coord)))
         if self.left:
-            if x <= self.l_thresh:
+            if coord <= self.l_thresh:
                self.swap(self.draging, self.left)
         if self.right:
-            if x >= self.r_thresh:
+            if coord >= self.r_thresh:
                self.swap(self.draging, self.right)
-        return self.cur(x)
+        return self.cur(coord)
 
     def remove_child(self, child):
         SmartGroup.remove_child(self, child)
@@ -467,6 +473,9 @@
     def cur(self, value):
         return (0, value)
 
+    def coord(self, point):
+        return point[1]
+
     def position(self, child):
         return child.props.y
 
@@ -479,6 +488,9 @@
     def __init__(self, *args, **kwargs):
         List.__init__(self, *args, **kwargs)
 
+    def coord(self, point):
+        return point[0]
+
     def cur(self, value):
         return (value, 0)
 
@@ -488,4 +500,3 @@
     def dimension(self, child):
         return child.props.width
 
-



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