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



Author: blewis
Date: Sat Jul 19 20:51:17 2008
New Revision: 1195
URL: http://svn.gnome.org/viewvc/pitivi?rev=1195&view=rev

Log:
* pitivi/ui/complextimeline.py:
made sources slightly translucent, even when selected
got rid of per-track backgrounds
re-arranged code in complexlayers slightly, so it makes more sense ot
me at least
changed the size_request code slightly, so the canvas is always at
least 800 pixels wide. this isn't really necessary without the
backgrounds.
* pitivi/ui/util.py:


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	Sat Jul 19 20:51:17 2008
@@ -50,7 +50,7 @@
     },
     {
         "normal_color" : 0x709fb899,
-        "selected_color" : 0xa6cee3FF, 
+        "selected_color" : 0xa6cee3AA, 
     }
 )
 AUDIO_SOURCE = (
@@ -62,7 +62,7 @@
     },
     {
         "normal_color" : 0x709fb899,
-        "selected_color" : 0xa6cee3FF, 
+        "selected_color" : 0xa6cee3AA, 
     }
 )
 
@@ -138,8 +138,6 @@
         self.set_zoom_ratio(10.0)
         self._deadband = self.pixel_to_ns(DEADBAND)
         self.object_style = None
-        self.bg = make_item(BACKGROUND)
-        self.add_child(self.bg)
 
     def get_zoom_adjustment(self):
         return self._zoom_adjustment
@@ -164,10 +162,10 @@
             self.sig_ids = (added, removed)
             if comp.media_type == MEDIA_TYPE_VIDEO:
                 self.object_style = VIDEO_SOURCE
-                self.bg.props.height = VIDEO_TRACK_HEIGHT
+                self.height = VIDEO_TRACK_HEIGHT
             else:
                 self.object_style = AUDIO_SOURCE
-                self.bg.props.height = AUDIO_TRACK_HEIGHT
+                self.height = AUDIO_TRACK_HEIGHT
 
     def _objectAdded(self, timeline, element):
         w = ComplexTimelineObject(element, self.object_style)
@@ -177,20 +175,18 @@
         self.widgets[element] = w
         self.elements[w] = element
         self.start_duration_cb(element, element.start, element.duration, w)
-        self.add_child(w, (0, 0))
+        self.add_child(w)
         make_selectable(self.canvas, w.bg)
         make_dragable(self.canvas, w.l_handle, moved=self._trim_source_start_cb,
             cursor=LEFT_SIDE)
         make_dragable(self.canvas, w.r_handle, moved=self._trim_source_end_cb,
             cursor=RIGHT_SIDE)
-        self._update_edges()
 
     def _objectRemoved(self, timeline, element):
         w = self.widgets[element]
         self.remove_child(w)
         del self.widgets[element]
         del self.elements[w]
-        self._update_edges()
 
     def ns_to_pixel(self, time):
         if time == gst.CLOCK_TIME_NONE:
@@ -362,32 +358,32 @@
         self.props.integer_layout = True
         self.connect("size_allocate", self._size_allocate)
 
+    def _createUI(self):
+        self.set_border_width(2)
+        self.layers = VList(canvas=self)
+        self.layers.connect("notify::width", self._request_size)
+        self.layers.connect("notify::height", self._request_size)
+        self.get_root_item().add_child(self.layers)
+        self._marquee = make_item(MARQUEE)
+        manage_selection(self, self._marquee, True, self._selection_changed_cb)
+
     def _size_allocate(self, unused_layout, allocation):
         width = max(allocation.width, self.layers.width)
-        for layer in self.layers:
-            layer.bg.props.width = width
 
     def _request_size(self, unused_item, prop):
         # we only update the bounds of the canvas by chunks of 100 pixels
         # in width, otherwise we would always be redrawing the whole canvas.
-        w = ((int(self.layers.width) / 100) + 1 ) * 100
+        # Make sure canvas is at least 800 pixels wide, and at least 100 pixels 
+        # wider than it actually needs to be.
+        w = max(800, ((int(self.layers.width + 100) / 100) + 1 ) * 100)
         h = int(self.layers.height)
         x1,y1,x2,y2 = self.get_bounds()
         pw = abs(x2 - x1)
         ph = abs(y2 - y1)
         if not (w == pw and h == ph):
-            self.set_bounds(0, 0, float(w), float(h))
+            self.set_bounds(0, 0, w, h)
         return True
 
-    def _createUI(self):
-        self.set_border_width(2)
-        self.layers = VList(canvas=self)
-        self.layers.connect("notify::width", self._request_size)
-        self.layers.connect("notify::height", self._request_size)
-        self.get_root_item().add_child(self.layers)
-        self._marquee = make_item(MARQUEE)
-        manage_selection(self, self._marquee, True, self._selection_changed_cb)
-
 ## ZoomableWidgetInterface overrides
 
     def _selection_changed_cb(self, selected, deselected):
@@ -423,7 +419,6 @@
         self.set_size_request(int(self.layers.width), int(self.layers.height))
 
     def _layerRemovedCb(self, unused_layerInfoList, position):
-        #TODO handle this, and test it somehow
         child = self.layers.item_at(position)
         self.layers.remove_child(child)
 #

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	Sat Jul 19 20:51:17 2008
@@ -373,6 +373,7 @@
             self.background.remove()
             goocanvas.Group.add_child(self, bg, 0)
         self.background = bg
+        #TODO: move background beneath lowest item
 
     def set_canvas(self, canvas):
         self.canvas = canvas



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