pitivi r1397 - in trunk/pitivi: timeline ui



Author: edwardrv
Date: Fri Nov 28 17:35:09 2008
New Revision: 1397
URL: http://svn.gnome.org/viewvc/pitivi?rev=1397&view=rev

Log:
added link/unlink code to the UI, and fixed some bugs in the core implementation. visually does the right thing, but core is kinda screwed up

Modified:
   trunk/pitivi/timeline/timeline.py
   trunk/pitivi/ui/controller.py
   trunk/pitivi/ui/timeline.py
   trunk/pitivi/ui/timelinecanvas.py

Modified: trunk/pitivi/timeline/timeline.py
==============================================================================
--- trunk/pitivi/timeline/timeline.py	(original)
+++ trunk/pitivi/timeline/timeline.py	Fri Nov 28 17:35:09 2008
@@ -179,11 +179,15 @@
                     collapse_neighbours=False)
         self.__selection = set()
 
-    def unlinkSelection(self, obj):
-        pass
-
-    def relinkSelection(self, obj):
-        pass
+    def unlinkSelection(self):
+        for obj in self.__selection:
+            if obj.linked:
+                obj.unlinkObject()
+
+    def relinkSelection(self):
+        for obj in self.__selection:
+            if not obj.linked:
+                obj.relinkBrother()
 
     def selectBefore(self):
         pass

Modified: trunk/pitivi/ui/controller.py
==============================================================================
--- trunk/pitivi/ui/controller.py	(original)
+++ trunk/pitivi/ui/controller.py	Fri Nov 28 17:35:09 2008
@@ -9,8 +9,6 @@
 # that explictly combines the functionality of both when custom behavior is
 # desired.
 
-#TODO: refactor to handle modifier keys
-
 class Controller(object):
 
     """A controller which implements drag-and-drop bahavior on connected view

Modified: trunk/pitivi/ui/timeline.py
==============================================================================
--- trunk/pitivi/ui/timeline.py	(original)
+++ trunk/pitivi/ui/timeline.py	Fri Nov 28 17:35:09 2008
@@ -43,6 +43,8 @@
 RAZOR = _("Cut clip at mouse position")
 ZOOM_IN =  _("Zoom In")
 ZOOM_OUT =  _("Zoom Out")
+UNLINK = _("Unlink audio from video")
+RELINK = _("Relink audio to original video")
 SELECT_BEFORE = ("Select all sources before selected")
 SELECT_AFTER = ("Select all after selected")
 
@@ -56,6 +58,8 @@
         <toolitem action="Razor" />
         <separator />
         <toolitem action="DeleteObj" />
+        <toolitem action="UnlinkObj" />
+        <toolitem action="RelinkObj" />
     </toolbar>
 </ui>
 '''
@@ -151,7 +155,11 @@
             ("ZoomOut", gtk.STOCK_ZOOM_OUT, None, None, ZOOM_OUT, 
                 self._zoomOutCb),
             ("DeleteObj", gtk.STOCK_DELETE, None, None, DELETE, 
-                self.__canvas.deleteSelected),
+                self.deleteSelected),
+            ("UnlinkObj", gtk.STOCK_DISCONNECT, None, None, UNLINK,
+                self.unlinkSelected),
+            ("RelinkObj", gtk.STOCK_CONNECT, None, None, RELINK,
+                self.relinkSelected),
             ("Razor", gtk.STOCK_CUT, None, None, RAZOR,
                 self.__canvas.activateRazor)
         )
@@ -232,6 +240,15 @@
         self._cur_zoom = max(0, self._cur_zoom - 1)
         self._zoom_adj.set_value(self._computeZoomRatio(self._cur_zoom))
 
+    def deleteSelected(self, unused_action):
+        instance.PiTiVi.current.timeline.deleteSelection()
+
+    def unlinkSelected(self, unused_action):
+        instance.PiTiVi.current.timeline.unlinkSelection()
+
+    def relinkSelected(self, unused_action):
+        instance.PiTiVi.current.timeline.relinkSelection()
+
 ## PlayGround timeline position callback
 
     def _playgroundPositionCb(self, unused_playground, smartbin, value):

Modified: trunk/pitivi/ui/timelinecanvas.py
==============================================================================
--- trunk/pitivi/ui/timelinecanvas.py	(original)
+++ trunk/pitivi/ui/timelinecanvas.py	Fri Nov 28 17:35:09 2008
@@ -80,9 +80,6 @@
 
 ## Editing Operations
 
-    def deleteSelected(self, unused_action):
-        instance.PiTiVi.current.timeline.deleteSelection()
-
     # FIXME: the razor is the one toolbar tool that violates the noun-verb
     # principle. Do I really want to make an exception for this? What about
     # just double-clicking on the source like jokosher?



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