本文整理汇总了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)
示例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)
示例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)