[pitivi] timeline: Fix ctrl+click traceback when deselecting clip



commit 44d087dfdd32646e89348e8d12dd6029356a5f48
Author: Rodrigo Oliveira <rodrigo redcode gmail com>
Date:   Wed Mar 25 01:23:04 2020 -0300

    timeline: Fix ctrl+click traceback when deselecting clip
    
    Fixes #2434

 pitivi/timeline/elements.py | 14 +++++++-------
 pitivi/timeline/timeline.py |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 1b1e35e9..4bd77167 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -90,11 +90,12 @@ class KeyframeCurve(FigureCanvas, Loggable):
         "leave": (GObject.SignalFlags.RUN_LAST, None, ()),
     }
 
-    def __init__(self, timeline, binding):
+    def __init__(self, timeline, binding, ges_elem):
         figure = Figure()
         FigureCanvas.__init__(self, figure)
         Loggable.__init__(self)
 
+        self._ges_elem = ges_elem
         self._timeline = timeline
         self.__source = binding.props.control_source
         self._connect_sources()
@@ -368,8 +369,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
         event_widget = Gtk.get_event_widget(event.guiEvent)
         x, unused_y = event_widget.translate_coordinates(self._timeline.layout.layers_vbox,
                                                          event.x, event.y)
-        ges_clip = self._timeline.selection.get_single_clip(GES.Clip)
-        event.xdata = Zoomable.pixel_to_ns(x) - ges_clip.props.start + ges_clip.props.in_point
+        event.xdata = Zoomable.pixel_to_ns(x) - self._ges_elem.props.start + self._ges_elem.props.in_point
 
         if self._offset is not None:
             # If dragging a keyframe, make sure the keyframe ends up exactly
@@ -447,9 +447,9 @@ class KeyframeCurve(FigureCanvas, Loggable):
 class MultipleKeyframeCurve(KeyframeCurve):
     """Keyframe curve which controls multiple properties at once."""
 
-    def __init__(self, timeline, bindings):
+    def __init__(self, timeline, bindings, ges_elem):
         self.__bindings = bindings
-        super().__init__(timeline, bindings[0])
+        super().__init__(timeline, bindings[0], ges_elem)
 
         self._timeline = timeline
         self._project = timeline.app.project_manager.current_project
@@ -726,9 +726,9 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
             bindings = [self._ges_elem.get_control_binding(self.__controlled_property.name)]
 
         if len(bindings) == 1:
-            self.keyframe_curve = KeyframeCurve(self.timeline, bindings[0])
+            self.keyframe_curve = KeyframeCurve(self.timeline, bindings[0], self._ges_elem)
         else:
-            self.keyframe_curve = MultipleKeyframeCurve(self.timeline, bindings)
+            self.keyframe_curve = MultipleKeyframeCurve(self.timeline, bindings, self._ges_elem)
 
         self.keyframe_curve.connect("enter", self.__curve_enter_cb)
         self.keyframe_curve.connect("leave", self.__curve_leave_cb)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index c261d803..8621056f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -776,7 +776,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
                     self.__next_seek_position = None
                 else:
                     event_widget = Gtk.get_event_widget(event)
-                    if self._get_parent_of_type(event_widget, LayerControls) is None:
+                    if event_widget and self._get_parent_of_type(event_widget, LayerControls) is None:
                         self._seek(event)
 
             # Allowing group clips selection by shift+clicking anywhere on the timeline.


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