[pitivi/gtktimeline] elements: Make sure to always set a ui field to all TrackElements
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/gtktimeline] elements: Make sure to always set a ui field to all TrackElements
- Date: Tue, 5 May 2015 16:40:07 +0000 (UTC)
commit 56a3be1c77d77bbbf738ecc4579b0dc8b4beebf7
Author: Thibault Saunier <tsaunier gnome org>
Date: Tue May 5 18:35:20 2015 +0200
elements: Make sure to always set a ui field to all TrackElements
Forcing subclasses of Clip to linkup the _ChildAdded vmethod
+ Misc minor cleanups
pitivi/timeline/elements.py | 37 +++++++++++++++++++------------------
pitivi/timeline/timeline.py | 4 +---
2 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 456a09e..ae750aa 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -695,14 +695,12 @@ class Clip(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
handle.hide()
def _eventCb(self, element, event):
- if event.type == Gdk.EventType.ENTER_NOTIFY:
- if event.mode == Gdk.CrossingMode.NORMAL:
- ui.set_children_state_recurse(self, Gtk.StateFlags.PRELIGHT)
- self.__showHandles()
- elif event.type == Gdk.EventType.LEAVE_NOTIFY:
- if event.mode == Gdk.CrossingMode.NORMAL:
- ui.unset_children_state_recurse(self, Gtk.StateFlags.PRELIGHT)
- self.__hideHandles()
+ if event.type == Gdk.EventType.ENTER_NOTIFY and event.mode == Gdk.CrossingMode.NORMAL:
+ ui.set_children_state_recurse(self, Gtk.StateFlags.PRELIGHT)
+ self.__showHandles()
+ elif event.type == Gdk.EventType.LEAVE_NOTIFY and event.mode == Gdk.CrossingMode.NORMAL:
+ ui.unset_children_state_recurse(self, Gtk.StateFlags.PRELIGHT)
+ self.__hideHandles()
return False
@@ -726,11 +724,13 @@ class Clip(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
self.layer = bLayer.ui
def __connectToChild(self, child):
- child.ui.connect("curve-enter", self.__curveEnterCb)
- child.ui.connect("curve-leave", self.__curveLeaveCb)
+ if child.ui:
+ child.ui.connect("curve-enter", self.__curveEnterCb)
+ child.ui.connect("curve-leave", self.__curveLeaveCb)
def _childAdded(self, clip, child):
child.selected = timelineUtils.Selected()
+ child.ui = None
def __curveEnterCb(self, unused_keyframe_curve):
self.__hideHandles()
@@ -746,8 +746,9 @@ class Clip(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
pass
def _childRemovedCb(self, clip, child):
- child.disconnect_by_func(self.__curveEnterCb)
- child.disconnect_by_func(self.__curveLeaveCb)
+ if child.ui:
+ child.ui.disconnect_by_func(self.__curveEnterCb)
+ child.ui.disconnect_by_func(self.__curveLeaveCb)
self._childRemoved(clip, child)
def _connectGES(self):
@@ -799,6 +800,8 @@ class UriClip(SourceClip):
self.set_tooltip_markup(misc.filename_from_uri(bClip.get_uri()))
def _childAdded(self, clip, child):
+ super(UriClip, self)._childAdded(clip, child)
+
if isinstance(child, GES.Source):
if child.get_track_type() == GES.TrackType.AUDIO:
self._audioSource = AudioUriSource(child, self.timeline)
@@ -810,22 +813,20 @@ class UriClip(SourceClip):
child.ui = self._videoSource
self._elements_container.pack_start(self._videoSource, True, False, 0)
self._videoSource.set_visible(True)
- else:
- child.ui = None
class TitleClip(SourceClip):
__gtype_name__ = "PitiviTitleClip"
def _childAdded(self, clip, child):
+ super(Title, self)._childAdded(clip, child)
+
if isinstance(child, GES.Source):
if child.get_track_type() == GES.TrackType.VIDEO:
self._videoSource = VideoSource(child, self.timeline)
child.ui = self._videoSource
self._elements_container.pack_start(self._videoSource, True, False, 0)
self._videoSource.set_visible(True)
- else:
- child.ui = None
class TransitionClip(Clip):
@@ -850,11 +851,11 @@ class TransitionClip(Clip):
str(bClip.props.vtype.value_nick))
def _childAdded(self, clip, child):
- child.selected = timelineUtils.Selected()
-
if isinstance(child, GES.VideoTransition):
self.z_order += 1
+ super(TransitionClip, self)._childAdded(clip, child)
+
def do_draw(self, cr):
Clip.do_draw(self, cr)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index ff5cf9f..ff6f94c 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -791,7 +791,6 @@ class Timeline(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
self._on_layer = None
def __getLayerAt(self, y, bLayer=None):
- self.error("Y is %s" % y)
if y < 20 or not self.bTimeline.get_layers():
try:
bLayer = self.bTimeline.get_layers()[0]
@@ -877,7 +876,6 @@ class Timeline(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
self.editing_context.editTo(position, priority)
def createLayer(self, priority):
- self.error("Creating layer %s" % priority)
new_bLayer = GES.Layer.new()
new_bLayer.props.priority = priority
self.bTimeline.add_layer(new_bLayer)
@@ -918,7 +916,7 @@ class Timeline(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
if self.__on_separators[0] == self._on_layer.ui.after_sep:
priority = self._on_layer.props.priority + 1
- self.error("On separator --> %s" % priority)
+ self.debug("On separator --> %s" % priority)
self.createLayer(max(0, priority))
self._onSeparatorStartTime = None
self.editing_context.editTo(self.editing_context.new_position, priority)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]