当前位置: 首页>>代码示例>>Python>>正文


Python Timeline.setProject方法代码示例

本文整理汇总了Python中pitivi.timeline.timeline.Timeline.setProject方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.setProject方法的具体用法?Python Timeline.setProject怎么用?Python Timeline.setProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pitivi.timeline.timeline.Timeline的用法示例。


在下文中一共展示了Timeline.setProject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testLayerMoved

# 需要导入模块: from pitivi.timeline.timeline import Timeline [as 别名]
# 或者: from pitivi.timeline.timeline.Timeline import setProject [as 别名]
    def testLayerMoved(self):
        layer1 = self.layer
        layer2 = self.timeline.append_layer()
        layer3 = self.timeline.append_layer()
        self.assertEqual(self.timeline.get_layers(), [layer1, layer2, layer3])

        timeline_ui = Timeline(app=self.app, size_group=mock.Mock())
        timeline_ui.setProject(self.app.project_manager.current_project)

        # Click and drag a layer control box to move the layer.
        with mock.patch.object(Gtk, 'get_event_widget') as get_event_widget:
            event = mock.Mock()
            event.get_button.return_value = True, 1

            get_event_widget.return_value = layer1.control_ui
            timeline_ui._button_press_event_cb(None, event=event)

            with mock.patch.object(layer1.control_ui, "translate_coordinates") as translate_coordinates:
                translate_coordinates.return_value = (0, 0)
                with mock.patch.object(timeline_ui, "_get_layer_at") as _get_layer_at:
                    _get_layer_at.return_value = layer3, None
                    timeline_ui._motion_notify_event_cb(None, event=event)

            timeline_ui._button_release_event_cb(None, event=event)
        self.check_layers([layer2, layer3, layer1])

        self.action_log.undo()
        self.check_layers([layer1, layer2, layer3])

        self.action_log.redo()
        self.check_layers([layer2, layer3, layer1])
开发者ID:pitivi,项目名称:pitivi,代码行数:33,代码来源:test_undo_timeline.py

示例2: createTimeline

# 需要导入模块: from pitivi.timeline.timeline import Timeline [as 别名]
# 或者: from pitivi.timeline.timeline.Timeline import setProject [as 别名]
 def createTimeline(self, layers_heights):
     project_manager = ProjectManager(app=None)
     project_manager.newBlankProject()
     project = project_manager.current_project
     timeline = Timeline(container=None, app=None)
     timeline.get_parent = mock.MagicMock()
     timeline.setProject(project)
     y = 0
     for priority, height in enumerate(layers_heights):
         bLayer = timeline.createLayer(priority=priority)
         rect = Gdk.Rectangle()
         rect.y = y
         rect.height = height
         bLayer.ui.set_allocation(rect)
         y += height + SEPARATOR_HEIGHT
     return timeline
开发者ID:davlem,项目名称:pitivi,代码行数:18,代码来源:test_timeline_timeline.py


注:本文中的pitivi.timeline.timeline.Timeline.setProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。