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


Python Clip.filter方法代碼示例

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


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

示例1: test_add_clip

# 需要導入模塊: from classes.query import Clip [as 別名]
# 或者: from classes.query.Clip import filter [as 別名]
    def test_add_clip(self):
        """ Test the Clip.save method by adding multiple clips """

        # Import additional classes that need the app defined first
        from classes.query import Clip

        # Find number of clips in project
        num_clips = len(Clip.filter())

        # Create clip
        c = openshot.Clip(os.path.join(info.IMAGES_PATH, "AboutLogo.png"))

        # Parse JSON
        clip_data = json.loads(c.Json())

        # Insert into project data
        query_clip = Clip()
        query_clip.data = clip_data
        query_clip.save()

        self.assertTrue(query_clip)
        self.assertEqual(len(Clip.filter()), num_clips + 1)

        # Save the clip again (which should not change the total # of clips)
        query_clip.save()

        self.assertEqual(len(Clip.filter()), num_clips + 1)
開發者ID:JoOngle2,項目名稱:openshot-qt,代碼行數:29,代碼來源:query_tests.py

示例2: test_filter_clip

# 需要導入模塊: from classes.query import Clip [as 別名]
# 或者: from classes.query.Clip import filter [as 別名]
    def test_filter_clip(self):
        """ Test the Clip.filter method """

        # Import additional classes that need the app defined first
        from classes.query import Clip

        # Find all clips named file1
        clips = Clip.filter(id=TestQueryClass.clip_ids[0])
        self.assertTrue(clips)

        # Do not find a clip
        clips = Clip.filter(id="invalidID")
        self.assertEqual(len(clips), 0)
開發者ID:JoOngle2,項目名稱:openshot-qt,代碼行數:15,代碼來源:query_tests.py

示例3: actionRemoveEffect_trigger

# 需要導入模塊: from classes.query import Clip [as 別名]
# 或者: from classes.query.Clip import filter [as 別名]
    def actionRemoveEffect_trigger(self, event):
        log.info('actionRemoveEffect_trigger')

        # Loop through selected clips
        for effect_id in self.selected_effects:
            log.info("effect id: %s" % effect_id)

            # Find matching file
            clips = Clip.filter()
            found_effect = None
            for c in clips:
                found_effect = False
                log.info("c.data[effects]: %s" % c.data["effects"])

                for effect in c.data["effects"]:
                    if effect["id"] == effect_id:
                        found_effect = effect
                        break

                if found_effect:
                    # Remove found effect from clip data and save clip
                    c.data["effects"].remove(found_effect)
                    c.save()

                    # Clear selected effects
                    self.removeSelection(effect_id, "effect")
開發者ID:kkfong,項目名稱:openshot-qt,代碼行數:28,代碼來源:main_window.py

示例4: actionRemoveClip_trigger

# 需要導入模塊: from classes.query import Clip [as 別名]
# 或者: from classes.query.Clip import filter [as 別名]
    def actionRemoveClip_trigger(self, event):
        log.info('actionRemoveClip_trigger')

        # Loop through selected clips
        for clip_id in self.selected_clips:
            # Find matching file
            clips = Clip.filter(id=clip_id)
            for c in clips:
                # Clear selected clips
                self.removeSelection(clip_id, "clip")

                # Remove clip
                c.delete()
開發者ID:kkfong,項目名稱:openshot-qt,代碼行數:15,代碼來源:main_window.py

示例5: actionRemove_from_Project_trigger

# 需要導入模塊: from classes.query import Clip [as 別名]
# 或者: from classes.query.Clip import filter [as 別名]
    def actionRemove_from_Project_trigger(self, event):
        log.info("actionRemove_from_Project_trigger")

        # Loop through selected files
        for file_id in self.selected_files:
            # Find matching file
            f = File.get(id=file_id)
            if f:
                # Remove file
                f.delete()

                # Find matching clips (if any)
                clips = Clip.filter(file_id=file_id)
                for c in clips:
                    # Remove clip
                    c.delete()

        # Clear selected files
        self.selected_files = []
開發者ID:kkfong,項目名稱:openshot-qt,代碼行數:21,代碼來源:main_window.py


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