Permalink
Browse files

Undo/Redo in effect: Undo is happening, but not simultaneously, redo

crashes with this "app" argument non-coherency
  • Loading branch information...
1 parent 75a89ba commit 559db2b128143d6b494830d688f0b8e8ae525c03 @kyotobay committed Feb 3, 2012
Showing with 16 additions and 48 deletions.
  1. +1 −1 pitivi/application.py
  2. +1 −1 pitivi/timeline/timeline.py
  3. +6 −2 pitivi/undo/effect.py
  4. +6 −44 pitivi/undo/timeline.py
  5. +2 −0 pitivi/utils/timeline.py
View
@@ -135,7 +135,7 @@ def __init__(self):
self.debug_action_log_observer = DebugActionLogObserver()
self.debug_action_log_observer.startObserving(self.action_log)
# TODO reimplement the observing after GES port
- self.timelineLogObserver = TimelineLogObserver(self.action_log)
+ self.timelineLogObserver = TimelineLogObserver(self.action_log, instance)
self.projectLogObserver = ProjectLogObserver(self.action_log)
self.medialibrary_log_observer = MediaLibraryLogObserver(self.action_log)
@@ -830,7 +830,7 @@ def _dragDropCb(self, widget, context, x, y, timestamp):
# Trying to apply effect only on the first object of the selection
tlobj = timeline_objs[0]
- add_effect(tlobj, bin_desc, app)
+ add_effect(tlobj, bin_desc, self.app)
self._factories = None
self.seeker.seek(self._position)
View
@@ -98,16 +98,20 @@ class TrackEffectAdded(UndoableAction):
# doing again. We have to keep all EffectPropertyChanged object that refers
# to the TrackEffect when undoing so we reset theirs gst_element when
# doing it again. The way of doing it is the same with TrackEffectRemoved
- def __init__(self, timeline_object, track_object, properties_watcher):
+ def __init__(self, timeline_object, instance, track_object, properties_watcher):
self.timeline_object = timeline_object
self.track_object = track_object
+ self.bin_desc = self.track_object.props.bin_description
self.effect_props = []
self.gnl_obj_props = []
+ self.app = instance
+ print self.app
+ print "in TrackEffectAdded"
self._properties_watcher = properties_watcher
self._props_changed = []
def do(self):
- add_effect(self.timeline_object, bin_desc, app)
+ add_effect(self.timeline_object, self.bin_desc, self.app)
timeline = self.timeline_object.timeline
tl_obj_track_obj = timeline.addEffectFactoryOnObject(self.factory,
timeline_objects=[self.timeline_object])
View
@@ -225,11 +225,12 @@ class TimelineLogObserver(object):
interpolatorKeyframeChangedAction = InterpolatorKeyframeChanged
activePropertyChangedAction = ActivePropertyChanged
- def __init__(self, log):
+ def __init__(self, log, instance):
self.log = log
self.timeline_object_property_trackers = {}
self.interpolator_keyframe_trackers = {}
self.effect_properties_tracker = EffectGstElementPropertyChangeTracker(log)
+ self.app = instance
def startObserving(self, timeline):
self._connectToTimeline(timeline)
@@ -278,52 +279,28 @@ def _disconnectFromTimelineObject(self, timeline_object):
tracker.disconnect_by_func(self._timelineObjectPropertyChangedCb)
def _connectToTrackObject(self, track_object):
- #for prop, interpolator in track_object.getInterpolators().itervalues():
- #self._connectToInterpolator(interpolator)
if isinstance(track_object, ges.TrackEffect):
self.effect_properties_tracker.addEffect(track_object)
- #def _disconnectFromTrackObject(self, track_object):
- #for prop, interpolator in track_object.getInterpolators().itervalues():
- #self._disconnectFromInterpolator(interpolator)
-
- #def _connectToInterpolator(self, interpolator):
- #interpolator.connect("keyframe-added", self._interpolatorKeyframeAddedCb)
- #interpolator.connect("keyframe-removed",
- #self._interpolatorKeyframeRemovedCb)
-
- #tracker = KeyframeChangeTracker()
- #tracker.connectToObject(interpolator)
- #tracker.connect("keyframe-moved", self._interpolatorKeyframeMovedCb)
- #self.interpolator_keyframe_trackers[interpolator] = tracker
-
- #def _disconnectFromInterpolator(self, interpolator):
- #tracker = self.interpolator_keyframe_trackers.pop(interpolator)
- #tracker.disconnectFromObject(interpolator)
- #tracker.disconnect_by_func(self._interpolatorKeyframeMovedCb)
-
def _effectAddedCb(self, tlobj, track_object):
- action = self.trackEffectAddAction(tlobj, track_object,
- self.effect_properties_tracker)
+ action = self.trackEffectAddAction(tlobj, self.app, track_object, self.effect_properties_tracker)
#We use the action instead of the track object
#because the track_object changes when redoing
track_object.connect("notify::active",
self._trackObjectActiveChangedCb, action)
self.log.push(action)
self.effect_properties_tracker.addEffect(track_object)
- def _effectRemovedCb(self, timeline, track_object):
- track_object.disconnect_by_func(self._effectAddedCb)
- track_object.disconnect_by_func(self._effectRemovedCb)
+ def _effectRemovedCb(self, tlobj, track_object):
+ tlobj.disconnect_by_func(self._effectAddedCb)
+ tlobj.disconnect_by_func(self._effectRemovedCb)
def _layerAddedCb(self, timeline="her", layer="What"):
for tlobj in layer.get_objects():
tlobj.connect("track-object-added",
self._timelineObjectTrackObjectAddedCb)
tlobj.connect("track-object-removed",
self._timelineObjectTrackObjectRemovedCb)
- tlobj.connect("effect-added", self._effectAddedCb)
- tlobj.connect("effect-removed", self._effectRemovedCb)
layer.connect("object-added", self._timelineObjectAddedCb)
layer.connect("object-removed", self._timelineObjectRemovedCb)
@@ -371,21 +348,6 @@ def _timelineObjectTrackObjectRemovedCb(self, timeline_object,
#else:
#self._disconnectFromTrackObject(track_object)
- #def _interpolatorKeyframeAddedCb(self, track_object, keyframe):
- #action = self.interpolatorKeyframeAddedAction(track_object, keyframe)
- #self.log.push(action)
-
- #def _interpolatorKeyframeRemovedCb(self, track_object, keyframe,
- #old_value=None):
- #action = self.interpolatorKeyframeRemovedAction(track_object, keyframe)
- #self.log.push(action)
-
def _trackObjectActiveChangedCb(self, track_object, active, add_effect_action):
action = self.activePropertyChangedAction(add_effect_action, active)
self.log.push(action)
-
- #def _interpolatorKeyframeMovedCb(self, tracker, track_object,
- #keyframe, old_snapshot, new_snapshot):
- #action = self.interpolatorKeyframeChangedAction(track_object,
- #keyframe, old_snapshot, new_snapshot)
- #self.log.push(action)
View
@@ -1164,6 +1164,8 @@ def hover(self, item, target, event):
def add_effect(tlobj, bin_desc, app):
+ print app
+ print "in add_effect"
media_type = app.effects.getFactoryFromName(bin_desc).media_type
# Checking that this effect can be applied on this track object

0 comments on commit 559db2b

Please sign in to comment.