當前位置: 首頁>>代碼示例>>Python>>正文


Python Timeline.removeTimelineObject方法代碼示例

本文整理匯總了Python中pitivi.timeline.timeline.Timeline.removeTimelineObject方法的典型用法代碼示例。如果您正苦於以下問題:Python Timeline.removeTimelineObject方法的具體用法?Python Timeline.removeTimelineObject怎麽用?Python Timeline.removeTimelineObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pitivi.timeline.timeline.Timeline的用法示例。


在下文中一共展示了Timeline.removeTimelineObject方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testConnectionAndDisconnection

# 需要導入模塊: from pitivi.timeline.timeline import Timeline [as 別名]
# 或者: from pitivi.timeline.timeline.Timeline import removeTimelineObject [as 別名]
    def testConnectionAndDisconnection(self):
        timeline = Timeline()
        stream = new_stream()
        factory = new_source_factory()
        track = Track(stream)
        track_object1 = SourceTrackObject(factory, stream)
        track.addTrackObject(track_object1)
        timeline.addTrack(track)
        timeline_object1 = TimelineObject(factory)
        timeline_object1.addTrackObject(track_object1)
        timeline.addTimelineObject(timeline_object1)

        self.observer.startObserving(timeline)
        self.failUnless(timeline.connected)
        self.failUnless(timeline_object1.connected)

        timeline.removeTimelineObject(timeline_object1)
        self.failIf(timeline_object1.connected)

        timeline.addTimelineObject(timeline_object1)
        self.failUnless(timeline_object1)

        self.observer.stopObserving(timeline)
        self.failIf(timeline.connected)
        self.failIf(timeline_object1.connected)
開發者ID:kyotobay,項目名稱:pitivi,代碼行數:27,代碼來源:test_timeline_undo.py

示例2: TestTimelineUndo

# 需要導入模塊: from pitivi.timeline.timeline import Timeline [as 別名]
# 或者: from pitivi.timeline.timeline.Timeline import removeTimelineObject [as 別名]
class  TestTimelineUndo(TestCase):
    def setUp(self):
        self.stream = new_stream()
        self.factory = new_source_factory()
        self.effect_factory = TestEffectFactory(self.stream)
        self.track1 = Track(self.stream)
        self.track2 = Track(self.stream)
        self.timeline = Timeline()
        self.timeline.addTrack(self.track1)
        self.timeline.addTrack(self.track2)
        self.track_object1 = SourceTrackObject(self.factory, self.stream)
        self.track_object2 = SourceTrackObject(self.factory, self.stream)
        self.track_effect1 = TrackEffect(self.effect_factory, self.stream)
        self.track_effect2 = TrackEffect(self.effect_factory, self.stream)
        self.track1.addTrackObject(self.track_object1)
        self.track2.addTrackObject(self.track_object2)
        self.timeline_object1 = TimelineObject(self.factory)
        self.timeline_object1.addTrackObject(self.track_object1)
        self.timeline_object1.addTrackObject(self.track_object2)
        self.action_log = UndoableActionLog()
        self.observer = TestTimelineLogObserver(self.action_log)
        self.observer.startObserving(self.timeline)

    def testAddTimelineObject(self):
        stacks = []

        def commitCb(action_log, stack, nested):
            stacks.append(stack)
        self.action_log.connect("commit", commitCb)

        self.action_log.begin("add clip")
        self.timeline.addTimelineObject(self.timeline_object1)
        self.action_log.commit()

        self.failUnlessEqual(len(stacks), 1)
        stack = stacks[0]
        self.failUnlessEqual(len(stack.done_actions), 1)
        action = stack.done_actions[0]
        self.failUnless(isinstance(action, TimelineObjectAdded))

        self.failUnless(self.timeline_object1 \
                in self.timeline.timeline_objects)
        self.action_log.undo()
        self.failIf(self.timeline_object1 \
                in self.timeline.timeline_objects)

        self.action_log.redo()
        self.failUnless(self.timeline_object1 \
                in self.timeline.timeline_objects)

    def testRemoveTimelineObject(self):
        stacks = []

        def commitCb(action_log, stack, nested):
            stacks.append(stack)
        self.action_log.connect("commit", commitCb)

        self.timeline.addTimelineObject(self.timeline_object1)
        self.action_log.begin("remove clip")
        self.timeline.removeTimelineObject(self.timeline_object1, deep=True)
        self.action_log.commit()

        self.failUnlessEqual(len(stacks), 1)
        stack = stacks[0]
        self.failUnlessEqual(len(stack.done_actions), 1)
        action = stack.done_actions[0]
        self.failUnless(isinstance(action, TimelineObjectRemoved))

        self.failIf(self.timeline_object1 \
                in self.timeline.timeline_objects)
        self.action_log.undo()
        self.failUnless(self.timeline_object1 \
                in self.timeline.timeline_objects)

        self.action_log.redo()
        self.failIf(self.timeline_object1 \
                in self.timeline.timeline_objects)

    def testAddEffectToTimelineObject(self):
        stacks = []
        pipeline = Pipeline()

        def commitCb(action_log, stack, nested):
            stacks.append(stack)
        self.action_log.connect("commit", commitCb)
        self.observer.pipeline = pipeline

        #FIXME Should I commit it and check there are 2 elements
        #in the stacks
        self.timeline.addTimelineObject(self.timeline_object1)
        self.track1.addTrackObject(self.track_effect1)

        self.action_log.begin("add effect")
        self.timeline_object1.addTrackObject(self.track_effect1)
        self.action_log.commit()

        self.failUnlessEqual(len(stacks), 1)
        stack = stacks[0]
        self.failUnlessEqual(len(stack.done_actions), 1)
        action = stack.done_actions[0]
#.........這裏部分代碼省略.........
開發者ID:kyotobay,項目名稱:pitivi,代碼行數:103,代碼來源:test_timeline_undo.py


注:本文中的pitivi.timeline.timeline.Timeline.removeTimelineObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。