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


Python ProjectManager.newBlankProject方法代码示例

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


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

示例1: _createRealProject

# 需要导入模块: from pitivi.project import ProjectManager [as 别名]
# 或者: from pitivi.project.ProjectManager import newBlankProject [as 别名]
def _createRealProject(name=None):
    app = Pitivi()
    project_manager = ProjectManager(app)
    project_manager.newBlankProject()
    if name:
        project_manager.current_project.name = name
    return project_manager.current_project
开发者ID:davlem,项目名称:pitivi,代码行数:9,代码来源:test_project.py

示例2: _createRealProject

# 需要导入模块: from pitivi.project import ProjectManager [as 别名]
# 或者: from pitivi.project.ProjectManager import newBlankProject [as 别名]
def _createRealProject(name=None):
    app = common.getPitiviMock(proxyingStrategy=ProxyingStrategy.NOTHING)
    project_manager = ProjectManager(app)
    project_manager.newBlankProject()
    project = project_manager.current_project
    if name:
        project.name = name
    return project
开发者ID:dimart,项目名称:pitivi,代码行数:10,代码来源:test_project.py

示例3: createTimeline

# 需要导入模块: from pitivi.project import ProjectManager [as 别名]
# 或者: from pitivi.project.ProjectManager import newBlankProject [as 别名]
    def createTimeline(self):
        app = common.getPitiviMock()
        project_manager = ProjectManager(app)
        project_manager.newBlankProject()
        project = project_manager.current_project

        timeline_container = TimelineContainer(app)
        timeline_container.setProject(project)

        timeline = timeline_container.timeline
        timeline.get_parent = mock.MagicMock()

        timeline.app.settings.leftClickAlsoSeeks = False

        return timeline
开发者ID:linganesan,项目名称:pitivi,代码行数:17,代码来源:test_timeline_timeline.py

示例4: createTimeline

# 需要导入模块: from pitivi.project import ProjectManager [as 别名]
# 或者: from pitivi.project.ProjectManager import newBlankProject [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

示例5: TestProjectManager

# 需要导入模块: from pitivi.project import ProjectManager [as 别名]
# 或者: from pitivi.project.ProjectManager import newBlankProject [as 别名]
class TestProjectManager(TestCase):

    def setUp(self):
        self.manager = ProjectManager(None)
        self.listener = ProjectManagerListener(self.manager)
        self.signals = self.listener.signals

    def testLoadProjectFailedUnknownFormat(self):
        """
        Check that new-project-failed is emitted when we don't have a suitable
        formatter.
        """
        uri = "file:///Untitled.meh"
        self.manager.loadProject(uri)

        # loading
        name, args = self.signals[0]
        self.assertEqual(uri, args[0], self.signals)

        # failed
        name, args = self.signals[1]
        self.assertEqual("new-project-failed", name)
        signalUri, unused_message = args
        self.assertEqual(uri, signalUri, self.signals)

    def testLoadProjectClosesCurrent(self):
        """
        Check that new-project-failed is emited if we can't close the current
        project instance.
        """
        state = {"tried-close": False}

        def close():
            state["tried-close"] = True
            return False
        self.manager.closeRunningProject = close

        uri = "file:///Untitled.xptv"
        self.manager.current_project = MockProject()
        self.manager.loadProject(uri)

        self.assertEqual(0, len(self.signals))
        self.assertTrue(state["tried-close"], self.signals)

    def testLoadProject(self):
        self.manager.newBlankProject()

        name, args = self.signals[0]
        self.assertEqual("new-project-loading", name, self.signals)

        name, args = self.signals[1]
        self.assertEqual("new-project-created", name, self.signals)

        name, args = self.signals[2]
        self.assertEqual("new-project-loaded", name, self.signals)

    def testMissingUriForwarded(self):
        def quit(mainloop):
            mainloop.quit()

        def missingUriCb(self, project, error, clip_asset, mainloop, result):
            print(project, error, clip_asset, mainloop, result)
            result[0] = True
            mainloop.quit()

        self.mainloop = GLib.MainLoop()

        result = [False]
        self.manager.connect(
            "missing-uri", missingUriCb, self.mainloop, result)

        # Load a project with a missing asset.
        unused, xges_path = tempfile.mkstemp()
        with open(xges_path, "w") as xges:
            xges.write("""<ges version='0.1'>
  <project>
    <ressources>
      <asset id='file:///icantpossiblyexist.png' extractable-type-name='GESUriClip' />
    </ressources>
    <timeline>
      <track caps='video/x-raw' track-type='4' track-id='0' />
      <layer priority='0'>
        <clip id='0' asset-id='file:///icantpossiblyexist.png' type-name='GESUriClip' layer-priority='0' track-types='4' start='0' duration='2590000000' inpoint='0' rate='0' />
      </layer>
    </timeline>
</project>
</ges>""")
        uri = "file://%s" % xges_path
        try:
            self.assertTrue(self.manager.loadProject(uri))

            GLib.timeout_add_seconds(5, quit, self.mainloop)
            self.mainloop.run()
            self.assertTrue(result[0], "missing not missing")
        finally:
            os.remove(xges_path)

    def testCloseRunningProjectNoProject(self):
        self.assertTrue(self.manager.closeRunningProject())
        self.assertFalse(self.signals)
#.........这里部分代码省略.........
开发者ID:davlem,项目名称:pitivi,代码行数:103,代码来源:test_project.py

示例6: TestProjectManager

# 需要导入模块: from pitivi.project import ProjectManager [as 别名]
# 或者: from pitivi.project.ProjectManager import newBlankProject [as 别名]
class TestProjectManager(TestCase):

    def setUp(self):
        app = mock.MagicMock()
        self.manager = ProjectManager(app)
        self.listener = ProjectManagerListener(self.manager)
        self.signals = self.listener.signals

    def testLoadProjectFailedUnknownFormat(self):
        """
        Check that new-project-failed is emitted when we don't have a suitable
        formatter.
        """
        uri = "file:///Untitled.meh"
        self.manager.loadProject(uri)

        # loading
        name, args = self.signals[0]
        self.assertEqual(uri, args[0].get_uri(), self.signals)

        # failed
        name, args = self.signals[1]
        self.assertEqual("new-project-failed", name)
        signalUri, unused_message = args
        self.assertEqual(uri, signalUri, self.signals)

    def testLoadProjectClosesCurrent(self):
        """
        Check that new-project-failed is emited if we can't close the current
        project instance.
        """
        state = {"tried-close": False}

        def close():
            state["tried-close"] = True
            return False
        self.manager.closeRunningProject = close

        uri = "file:///Untitled.xptv"
        self.manager.current_project = mock.Mock()
        self.manager.loadProject(uri)

        self.assertEqual(0, len(self.signals))
        self.assertTrue(state["tried-close"], self.signals)

    def testLoadProject(self):
        self.manager.newBlankProject()

        name, args = self.signals[0]
        self.assertEqual("new-project-loading", name, self.signals)

        name, args = self.signals[1]
        self.assertEqual("new-project-created", name, self.signals)

        name, args = self.signals[2]
        self.assertEqual("new-project-loaded", name, self.signals)

    def testMissingUriForwarded(self):
        mainloop = common.create_main_loop()

        def missingUriCb(self, project, error, clip_asset, result):
            result[0] = True
            mainloop.quit()

        result = [False]
        self.manager.connect("missing-uri", missingUriCb, result)

        with common.created_project_file() as uri:
            self.assertTrue(self.manager.loadProject(uri))
            mainloop.run()
        self.assertTrue(result[0], "missing-uri has not been emitted")

    def testLoaded(self):
        mainloop = common.create_main_loop()

        def new_project_loaded_cb(project_manager, project):
            mainloop.quit()

        self.manager.connect("new-project-loaded", new_project_loaded_cb)

        asset_uri = common.get_sample_uri("flat_colour1_640x480.png")
        with common.created_project_file(asset_uri=asset_uri) as uri:
            self.assertTrue(self.manager.loadProject(uri))
            mainloop.run()

        project = self.manager.current_project
        self.assertFalse(project.at_least_one_asset_missing)
        self.assertTrue(project.loaded)
        self.assertFalse(project.hasUnsavedModifications())

    def testCloseRunningProjectNoProject(self):
        self.assertTrue(self.manager.closeRunningProject())
        self.assertFalse(self.signals)

    def testCloseRunningProjectRefuseFromSignal(self):
        def closing(manager, project):
            return False

        self.manager.current_project = mock.Mock()
        self.manager.current_project.uri = "file:///ciao"
#.........这里部分代码省略.........
开发者ID:jubayed,项目名称:pitivi,代码行数:103,代码来源:test_project.py


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