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


Python Track.removeTrackObject方法代碼示例

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


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

示例1: TestAlpha

# 需要導入模塊: from pitivi.timeline.track import Track [as 別名]
# 或者: from pitivi.timeline.track.Track import removeTrackObject [as 別名]

#.........這裏部分代碼省略.........
        self.failUnlessAlphaIsSet()

        # two alpha < 1.0 keyframes
        set_one_keyframe(track_object2, 0.5)
        self.failUnlessAlphaIsSet()

        # one alpha < 1.0 keyframe
        set_one_keyframe(track_object1, 1.0)
        self.failUnlessAlphaIsSet()

        # no alpha < 1.0 keyframes
        set_one_keyframe(track_object2, 1.0)

        self.failUnlessAlphaIsNotSet()

    def testKeyframesOnSameObject(self):
        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)
        self.failUnlessAlphaIsNotSet()

        track_object1 = self.track1.track_objects[0]
        interpolator1 = track_object1.getInterpolator("alpha")

        keyframe1 = interpolator1.newKeyframe(1 * gst.SECOND, 0.8)
        self.failUnlessAlphaIsSet()

        keyframe2 = interpolator1.newKeyframe(2 * gst.SECOND, 0.5)
        self.failUnlessAlphaIsSet()

        interpolator1.setKeyframeValue(keyframe1, 1.0)
        self.failUnlessAlphaIsSet()

        interpolator1.removeKeyframe(keyframe2)
        self.failUnlessAlphaIsNotSet()

    def testRemoveTrackObjects(self):
        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)

        self.failUnlessAlphaIsNotSet()

        track_object1 = self.track1.track_objects[0]
        track_object2 = self.track1.track_objects[1]

        # set one keyframe below 1.0
        set_one_keyframe(track_object1, 0.8)
        self.failUnlessAlphaIsSet()

        # track_object2 has no alpha < 1.0 keyframes, removing it shouldn't
        # trigger an alpha change
        self.track1.removeTrackObject(track_object2)
        self.failUnlessAlphaIsSet()

        # track_object1 does have an alpha < 1.0 keyframe, removing it should
        # trigger an alpha change
        self.track1.removeTrackObject(track_object1)

        self.failUnlessAlphaIsNotSet()

    def testRequestPads(self):
        # requesting a new pad should never trigger an alpha change

        template = gst.PadTemplate("sink_%u", gst.PAD_SINK, gst.PAD_REQUEST,
                gst.Caps("video/x-raw-yuv;video/x-raw-rgb"))

        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)

        # when unset, should remain unset
        self.failUnlessAlphaIsNotSet()
        test_pad1 = self.svmbin.do_request_new_pad(template)
        self.failUnlessAlphaIsNotSet()

        obj = self.track1.track_objects[0]
        set_one_keyframe(obj, 0.8)

        # when set, should remain set
        self.failUnlessAlphaIsSet()
        test_pad2 = self.svmbin.do_request_new_pad(template)
        self.failUnlessAlphaIsSet()

    def testTransitions(self):
        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)
        self.failUnlessAlphaIsNotSet()

        track_object1 = self.track1.track_objects[0]
        track_object2 = self.track1.track_objects[1]

        track_object1.start = 0
        track_object2.start = 10 * gst.SECOND

        old_priority = track_object2.priority
        track_object2.priority = track_object1.priority
        self.track1.updateTransitions()
        self.failUnlessAlphaIsSet()

        track_object2.priority = old_priority
        self.track1.updateTransitions()
        self.failUnlessAlphaIsNotSet()
開發者ID:Mathieu69,項目名稱:Pitivi_Gargamel,代碼行數:104,代碼來源:test_alpha_passthrough.py


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