[pitivi] Fix undoing 'ungroup' operation. Fixes #597711.
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pitivi] Fix undoing 'ungroup' operation. Fixes #597711.
- Date: Fri, 9 Oct 2009 16:11:16 +0000 (UTC)
commit 8c0b21ce98b1b5d8d160f09b87ac93f99d63ac74
Author: Alessandro Decina <alessandro d gmail com>
Date: Thu Oct 8 15:19:59 2009 +0200
Fix undoing 'ungroup' operation. Fixes #597711.
pitivi/timeline/timeline.py | 8 ++++----
pitivi/ui/timeline.py | 2 ++
tests/test_timeline_undo.py | 36 +++++++++++++++++++++++++++++++++++-
3 files changed, 41 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index e1de17a..cf6761e 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1752,13 +1752,13 @@ class Timeline(Signallable, Loggable):
self.selection.setTo(timeline_object.track_objects, UNSELECT)
for track_object in list(timeline_object.track_objects):
- timeline_object.removeTrackObject(track_object)
- new_timeline_object = TimelineObject(track_object.factory)
- new_timeline_object.addTrackObject(track_object)
+ new_track_object = track_object.copy()
+ new_timeline_object = TimelineObject(new_track_object.factory)
+ new_timeline_object.addTrackObject(new_track_object)
self.addTimelineObject(new_timeline_object)
new_track_objects.extend(new_timeline_object.track_objects)
- self.removeTimelineObject(timeline_object)
+ self.removeTimelineObject(timeline_object, deep=True)
self.selection.setTo(new_track_objects, SELECT_ADD)
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 5021ee3..965b928 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -516,7 +516,9 @@ class Timeline(gtk.Table, Loggable, Zoomable):
def ungroupSelected(self, unused_action):
if self.timeline:
+ self.app.action_log.begin("ungroup")
self.timeline.ungroupSelection()
+ self.app.action_log.commit()
def groupSelected(self, unused_action):
if self.timeline:
diff --git a/tests/test_timeline_undo.py b/tests/test_timeline_undo.py
index 1db741f..e9449b4 100644
--- a/tests/test_timeline_undo.py
+++ b/tests/test_timeline_undo.py
@@ -25,7 +25,7 @@ import gobject
gobject.threads_init()
import gst
-from pitivi.timeline.timeline import Timeline, TimelineObject
+from pitivi.timeline.timeline import Timeline, TimelineObject, SELECT_ADD
from pitivi.timeline.track import Track, SourceTrackObject
from pitivi.factories.test import VideoTestSourceFactory
from pitivi.stream import VideoStream
@@ -197,3 +197,37 @@ class TestTimelineUndo(TestCase):
self.action_log.redo()
self.failUnlessEqual(self.timeline_object1.priority, 20)
+ def testUngroup(self):
+ self.timeline_object1.start = 5 * gst.SECOND
+ self.timeline_object1.duration = 20 * gst.SECOND
+
+ self.timeline.addTimelineObject(self.timeline_object1)
+ self.timeline.setSelectionToObj(self.track_object1, SELECT_ADD)
+
+ self.failUnlessEqual(len(self.timeline.timeline_objects), 1)
+ self.failUnlessEqual(self.timeline.timeline_objects[0].start,
+ 5 * gst.SECOND)
+ self.failUnlessEqual(self.timeline.timeline_objects[0].duration,
+ 20 * gst.SECOND)
+
+ self.action_log.begin("ungroup")
+ self.timeline.ungroupSelection()
+ self.action_log.commit()
+
+ self.failUnlessEqual(len(self.timeline.timeline_objects), 2)
+ self.failUnlessEqual(self.timeline.timeline_objects[0].start,
+ 5 * gst.SECOND)
+ self.failUnlessEqual(self.timeline.timeline_objects[0].duration,
+ 20 * gst.SECOND)
+ self.failUnlessEqual(self.timeline.timeline_objects[1].start,
+ 5 * gst.SECOND)
+ self.failUnlessEqual(self.timeline.timeline_objects[1].duration,
+ 20 * gst.SECOND)
+
+ self.action_log.undo()
+
+ self.failUnlessEqual(len(self.timeline.timeline_objects), 1)
+ self.failUnlessEqual(self.timeline.timeline_objects[0].start,
+ 5 * gst.SECOND)
+ self.failUnlessEqual(self.timeline.timeline_objects[0].duration,
+ 20 * gst.SECOND)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]