[pitivi] Scale Trimbars according to layer height



commit 40835dcabb2bb5fa47fe9d2722275fb08b1b3b60
Author: Paul Lange <palango gmx de>
Date:   Thu Jun 28 14:28:52 2012 +0200

    Scale Trimbars according to layer height

 pitivi/timeline/track.py |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 08d5d5f..58dfe2e 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -23,6 +23,7 @@
 import goocanvas
 import ges
 import gtk
+import gtk.gdk
 import os.path
 import pango
 import cairo
@@ -241,8 +242,9 @@ class TrimHandle(View, goocanvas.Image, Loggable, Zoomable):
         self.element = element
         self.timeline = timeline
         self.movable = True
+        self.current_pixbuf = TRIMBAR_PIXBUF
         goocanvas.Image.__init__(self,
-            pixbuf=TRIMBAR_PIXBUF,
+            pixbuf=self.current_pixbuf,
             line_width=0,
             pointer_events=goocanvas.EVENTS_FILL,
             **kwargs)
@@ -251,10 +253,30 @@ class TrimHandle(View, goocanvas.Image, Loggable, Zoomable):
         Loggable.__init__(self)
 
     def focus(self):
-        self.props.pixbuf = TRIMBAR_PIXBUF_FOCUS
+        self.current_pixbuf = TRIMBAR_PIXBUF_FOCUS
+        self._scalePixbuf()
 
     def unfocus(self):
-        self.props.pixbuf = TRIMBAR_PIXBUF
+        self.current_pixbuf = TRIMBAR_PIXBUF
+        self._scalePixbuf()
+
+    _height = 0
+
+    def setHeight(self, height):
+        self._height = height
+        self.props.height = height
+        self._scalePixbuf()
+
+    def getHeight(self):
+        return self._height
+
+    height = property(getHeight, setHeight)
+
+    def _scalePixbuf(self):
+        self.props.pixbuf = self.current_pixbuf.scale_simple(
+                                                self.current_pixbuf.get_width(),
+                                                self.height,
+                                                gtk.gdk.INTERP_BILINEAR)
 
 
 class StartHandle(TrimHandle):
@@ -417,8 +439,8 @@ class TrackObject(View, goocanvas.Group, Zoomable, Loggable):
     def setHeight(self, height):
         self._height = height
         self.bg.props.height = height
-        self.start_handle.props.height = height
-        self.end_handle.props.height = height
+        self.start_handle.height = height
+        self.end_handle.height = height
         self._selec_indic.props.height = height
         if hasattr(self, "preview"):
             self.preview.height = height



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