pitivi r1135 - branches/SOC_2008_BLEWIS/pitivi/ui



Author: blewis
Date: Tue Jun  3 02:16:42 2008
New Revision: 1135
URL: http://svn.gnome.org/viewvc/pitivi?rev=1135&view=rev

Log:
* pitivi/ui/test.py:
switched testing mode back to goocanvas items, rather than widgets
* pitivi/ui/timelineobjects.py:
factored out _condensedListChanged() callback into
_sourceAddedCb()
_sourceRemoved()
reordreing is temporarily broken, because swap() is overridden and
does nothing. That's okay though, because the reordering doesn't work
right now anyways (it's only been working in the UI all this time).
* pitivi/ui/util.py:
tidy() now calls _set_drag_thresholds() if the list is in drag mode
_child_drag() now calls swap() directly to change element positions


Modified:
   branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py	Tue Jun  3 02:16:42 2008
@@ -80,6 +80,7 @@
         self.set_timeline(timeline)
         self.reorderable = True
         self.widgets = {}
+        self.elements = {}
 
     def set_timeline(self, timeline):
         if self.sig_ids:
@@ -87,7 +88,7 @@
                 self.timeline.videocomp.disconnect(sig)
         self.timeline = timeline
         if timeline:
-            self.condensed = self.timeline.videocomp.condensed
+            #TODO: connect transition callbacks here
             changed = timeline.videocomp.connect("condensed-list-changed", 
                 self._condensedListChangedCb)
             added = timeline.videocomp.connect("source-added",
@@ -96,8 +97,19 @@
                 self._sourceRemovedCb)
             self.sig_ids = (changed, added, removed)
 
+    # overriding from parent
     def swap(self, a, b):
-        pass
+        #TODO: make this code handle transitions.
+        element_a = self.elements[a]
+        element_b = self.elements[b]
+        index_a = self.index(a)
+        index_b = self.index(b)
+
+        #FIXME: are both of these calls necessary? or do we just need to be
+        # smarter about figuring which source to move in front of the other.
+        # in any case, it seems to work.
+        self.timeline.videocomp.moveSource(element_a, index_b, True, True)
+        self.timeline.videocomp.moveSource(element_b, index_a, True, True)
 
     def _condensedListChangedCb(self, unused_videocomp, clist):
         """ add/remove the widgets """
@@ -120,12 +132,15 @@
                 height=DEFAULT_SIMPLE_ELEMENT_HEIGHT)
             item = group(background, item)
         else:
+            #TODO: implement this
             raise Exception("Not Implemented")
         self.widgets[element] = item
+        self.elements[item] = element
         self.add_child(self.widgets[element])
 
     def _sourceRemovedCb(self, timeline, element):
         self.remove_child(self.widgets[element])
+        del self.elements[self.widgets[element]]
         del self.widgets[element]
 
 ## Child callbacks
@@ -192,6 +207,8 @@
         self.set_size_request(int(self.items.width), int(
             self.items.height))
         self.set_bounds(0, 0, self.items.width, self.items.height)
+        self.editingCanvasItem.props.width = self.items.width
+        self.editingCanvasItem.props.height = self.items.height
         return True
 
     def _size_allocate(self, unused_layout, allocation):
@@ -262,10 +279,13 @@
 ## Drag and Drop callbacks
 
     def _dragMotionCb(self, unused_layout, unused_context, x, y, timestamp):
+        #TODO: temporarily add source to timeline, and put it in drag mode
+        # so user can see where it will go
         gst.info("SimpleTimeline x:%d , source would go at %d" % (x, 0))
 
     def _dragLeaveCb(self, unused_layout, unused_context, unused_tstamp):
         gst.info("SimpleTimeline")
+        #TODO: remove temp source from timeline
 
     def _dragDataReceivedCb(self, unused_layout, context, x, y, 
         selection, targetType, timestamp):



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