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


Python SourceTrackObject.priority方法代碼示例

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


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

示例1: testMaxPriority

# 需要導入模塊: from pitivi.timeline.track import SourceTrackObject [as 別名]
# 或者: from pitivi.timeline.track.SourceTrackObject import priority [as 別名]
    def testMaxPriority(self):
        track = self.track1
        factory = self.factory

        obj1 = SourceTrackObject(factory, self.stream)
        obj1.priority = 10

        self.failUnlessEqual(track.max_priority, 0)
        track.addTrackObject(obj1)
        self.failUnlessEqual(track.max_priority, 10)

        obj2 = SourceTrackObject(factory, self.stream)
        obj2.priority = 5
        track.addTrackObject(obj2)
        self.failUnlessEqual(track.max_priority, 10)

        obj3 = SourceTrackObject(factory, self.stream)
        obj3.priority = 14
        track.addTrackObject(obj3)
        self.failUnlessEqual(track.max_priority, 14)

        obj3.priority = 9
        self.failUnlessEqual(track.max_priority, 10)

        obj2.priority = 11
        self.failUnlessEqual(track.max_priority, 11)

        track.removeTrackObject(obj1)
        self.failUnlessEqual(track.max_priority, 11)

        track.removeTrackObject(obj2)
        self.failUnlessEqual(track.max_priority, 9)

        track.removeTrackObject(obj3)
        self.failUnlessEqual(track.max_priority, 0)
開發者ID:Mathieu69,項目名稱:Pitivi_Gargamel,代碼行數:37,代碼來源:test_track.py

示例2: testGetPreviousTrackObject

# 需要導入模塊: from pitivi.timeline.track import SourceTrackObject [as 別名]
# 或者: from pitivi.timeline.track.SourceTrackObject import priority [as 別名]
    def testGetPreviousTrackObject(self):
        factory = self.factory
        stream = self.stream
        track1 = self.track1

        obj1 = SourceTrackObject(factory, stream)
        track1.addTrackObject(obj1)

        obj2 = SourceTrackObject(factory, stream)
        track1.addTrackObject(obj2)

        obj3 = SourceTrackObject(factory, stream)
        track1.addTrackObject(obj3)

        obj4 = SourceTrackObject(factory, stream)
        track1.addTrackObject(obj4)

        obj1.start = 1 * gst.SECOND
        obj1.duration = 5 * gst.SECOND
        obj1.priority = 1

        obj2.start = 8 * gst.SECOND
        obj2.duration = 5 * gst.SECOND
        obj2.priority = 1

        obj3.start = 6 * gst.SECOND
        obj3.duration = 5 * gst.SECOND
        obj3.priority = 2

        obj4.start = 7 * gst.SECOND
        obj4.duration = 5 * gst.SECOND
        obj4.priority = 3

        # no previous object
        self.failUnlessRaises(TrackError, track1.getPreviousTrackObject, obj4)

        # same priority
        prev = track1.getPreviousTrackObject(obj2)
        self.failUnlessEqual(prev, obj1)

        # given priority
        prev = track1.getPreviousTrackObject(obj2, priority=2)
        self.failUnlessEqual(prev, obj3)

        # any priority
        prev = track1.getPreviousTrackObject(obj2, priority=None)
        self.failUnlessEqual(prev, obj4)

        obj3.start = 8 * gst.SECOND
        # same start
        prev = track1.getPreviousTrackObject(obj2, priority=None)
        self.failUnlessEqual(prev, obj3)
開發者ID:Mathieu69,項目名稱:Pitivi_Gargamel,代碼行數:54,代碼來源:test_track.py

示例3: testGetTrackObjectsGroupedByLayer

# 需要導入模塊: from pitivi.timeline.track import SourceTrackObject [as 別名]
# 或者: from pitivi.timeline.track.SourceTrackObject import priority [as 別名]
    def testGetTrackObjectsGroupedByLayer(self):
        factory = self.factory
        stream = self.stream
        track1 = self.track1

        test_data = [
            ("a", 0, 10, 0),
            ("b", 5, 15, 0),
            ("c", 20, 25, 0),
            ("d", 30, 35, 0),
            ("e", 30, 35, 2),
            ("f", 35, 45, 0),
            ("g", 40, 50, 0),
            ("h", 50, 60, 0),
            ("i", 55, 65, 1),
            ("j", 57, 60, 2),
            ("k", 62, 70, 3),
            ("l", 63, 67, 0),
        ]

        expected = [
            ["a", "b", "c", "d", "f", "g", "h", "l"],
            ["i"],
            ["e", "j"],
            ["k"]
        ]

        objs = {}

        for name, start, end, priority in test_data:
            obj = SourceTrackObject(factory, stream)
            obj.start = start * gst.SECOND
            obj.duration = end * gst.SECOND - obj.start
            obj.priority = priority
            track1.addTrackObject(obj)
            objs[obj] = name

        result = [[objs[obj] for obj in layer] for layer in
            track1.getTrackObjectsGroupedByLayer()]

        self.failUnlessEqual(result, expected)
開發者ID:bemasc,項目名稱:pitivi,代碼行數:43,代碼來源:test_transitions.py


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