[pitivi] timeline: Remove the clips from the selection when they are removed



commit d65a3912bce70d605ea893135e0caf2bdb30c23f
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Oct 30 00:23:34 2015 +0100

    timeline: Remove the clips from the selection when they are removed
    
    Previously if a transition was selected and then one of the clips was
    moved and the transition disappeared, the transition panel was still
    displaying it.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D538

 pitivi/timeline/layer.py |   13 +++++++------
 pitivi/utils/timeline.py |    3 +++
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index ad9be0d..e7c77e5 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -443,10 +443,10 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
     def move(self, child, x, y):
         self._layout.move(child, x, y)
 
-    def _childAddedCb(self, bClip, child):
+    def _childAddedToClipCb(self, bClip, child):
         self.checkMediaTypes()
 
-    def _childRemovedCb(self, bClip, child):
+    def _childRemovedFromClipCb(self, bClip, child):
         self.checkMediaTypes()
 
     def _clipAddedCb(self, layer, bClip):
@@ -465,8 +465,8 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
 
         self._layout.put(clip, self.nsToPixel(bClip.props.start), 0)
         self.show_all()
-        bClip.connect_after("child-added", self._childAddedCb)
-        bClip.connect_after("child-removed", self._childRemovedCb)
+        bClip.connect_after("child-added", self._childAddedToClipCb)
+        bClip.connect_after("child-removed", self._childRemovedFromClipCb)
         self.checkMediaTypes()
 
     def _clipRemovedCb(self, bLayer, bClip):
@@ -483,6 +483,7 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
 
         bClip.ui.release()
         self._layout.remove(bClip.ui)
+        self.timeline.selection.unselect([bClip])
 
     def __childWidgetRemovedCb(self, layout, clip):
         bClip = clip.bClip
@@ -491,8 +492,8 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
             bClip.ui.release()
             bClip.ui = None
 
-        bClip.disconnect_by_func(self._childAddedCb)
-        bClip.disconnect_by_func(self._childRemovedCb)
+        bClip.disconnect_by_func(self._childAddedToClipCb)
+        bClip.disconnect_by_func(self._childRemovedFromClipCb)
         self.checkMediaTypes()
 
     def updatePosition(self):
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 62c839a..10babd5 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -152,6 +152,9 @@ class Selection(GObject.Object, Loggable):
                     element.selected.selected = True
         self.emit("selection-changed")
 
+    def unselect(self, objs):
+        self.setSelection(objs, UNSELECT)
+
     def getSelectedTrackElements(self):
         """
         Returns the list of L{TrackElement} contained in this selection.


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