当前位置: 首页>>代码示例>>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;未经允许,请勿转载。