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


Python PluginManager.plugins方法代码示例

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


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

示例1: hook_media_manager_with_active_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_media_manager_with_active_plugin_test(self):
        """
        Test running the hook_media_manager() method with an active plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Active
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run hook_media_manager()
        plugin_manager.hook_media_manager()

        # THEN: The create_media_manager_item() method should have been called
        mocked_plugin.create_media_manager_item.assert_called_with()
开发者ID:crossroadchurch,项目名称:paul,代码行数:17,代码来源:test_pluginmanager.py

示例2: get_plugin_by_name_exists_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def get_plugin_by_name_exists_test(self):
        """
        Test running the get_plugin_by_name() method to find a plugin that exists
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.name = 'Mocked Plugin'
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run finalise_plugins()
        result = plugin_manager.get_plugin_by_name('Mocked Plugin')

        # THEN: The is_active() and finalise() methods should have been called
        self.assertEqual(result, mocked_plugin, 'The result for get_plugin_by_name should be the mocked plugin')
开发者ID:crossroadchurch,项目名称:paul,代码行数:17,代码来源:test_pluginmanager.py

示例3: hook_export_menu_with_active_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_export_menu_with_active_plugin_test(self):
        """
        Test running the hook_export_menu() method with an active plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Active
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run hook_export_menu()
        plugin_manager.hook_export_menu()

        # THEN: The add_export_menu_item() method should have been called
        mocked_plugin.add_export_menu_item.assert_called_with(self.mocked_main_window.file_export_menu)
开发者ID:crossroadchurch,项目名称:paul,代码行数:17,代码来源:test_pluginmanager.py

示例4: hook_settings_tabs_with_active_plugin_and_no_form_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_settings_tabs_with_active_plugin_and_no_form_test(self):
        """
        Test running the hook_settings_tabs() method with an active plugin and no settings form
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Active
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run hook_settings_tabs()
        plugin_manager.hook_settings_tabs()

        # THEN: The create_settings_tab() method should have been called
        mocked_plugin.create_settings_tab.assert_called_with(self.mocked_settings_form)
开发者ID:crossroadchurch,项目名称:paul,代码行数:17,代码来源:test_pluginmanager.py

示例5: hook_settings_tabs_with_disabled_plugin_and_no_form_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_settings_tabs_with_disabled_plugin_and_no_form_test(self):
        """
        Test running the hook_settings_tabs() method with a disabled plugin and no form
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Disabled
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run hook_settings_tabs()
        plugin_manager.hook_settings_tabs()

        # THEN: The hook_settings_tabs() method should have been called
        self.assertEqual(0, mocked_plugin.create_media_manager_item.call_count,
                         'The create_media_manager_item() method should not have been called.')
开发者ID:crossroadchurch,项目名称:paul,代码行数:18,代码来源:test_pluginmanager.py

示例6: hook_tools_menu_with_disabled_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_tools_menu_with_disabled_plugin_test(self):
        """
        Test running the hook_tools_menu() method with a disabled plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Disabled
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run hook_tools_menu()
        plugin_manager.hook_tools_menu()

        # THEN: The add_tools_menu_item() method should have been called
        self.assertEqual(0, mocked_plugin.add_tools_menu_item.call_count,
                         'The add_tools_menu_item() method should not have been called.')
开发者ID:crossroadchurch,项目名称:paul,代码行数:18,代码来源:test_pluginmanager.py

示例7: test_hook_upgrade_plugin_settings_with_active_plugin

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def test_hook_upgrade_plugin_settings_with_active_plugin(self):
        """
        Test running the hook_upgrade_plugin_settings() method with an active plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Active
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]
        settings = Settings()

        # WHEN: We run hook_upgrade_plugin_settings()
        plugin_manager.hook_upgrade_plugin_settings(settings)

        # THEN: The add_export_menu_item() method should have been called
        mocked_plugin.upgrade_settings.assert_called_with(settings)
开发者ID:imkernel,项目名称:openlp,代码行数:18,代码来源:test_pluginmanager.py

示例8: hook_media_manager_with_disabled_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_media_manager_with_disabled_plugin_test(self):
        """
        Test running the hook_media_manager() method with a disabled plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Disabled
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run hook_media_manager()
        plugin_manager.hook_media_manager()

        # THEN: The create_media_manager_item() method should have been called
        assert mocked_plugin.create_media_manager_item.call_count == 0, \
            'The create_media_manager_item() method should not have been called.'
开发者ID:marmyshev,项目名称:bug_1117098,代码行数:18,代码来源:test_pluginmanager.py

示例9: new_service_created_with_active_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def new_service_created_with_active_plugin_test(self):
        """
        Test running the new_service_created() method with an active plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Active
        mocked_plugin.is_active.return_value = True
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run new_service_created()
        plugin_manager.new_service_created()

        # THEN: The is_active() and finalise() methods should have been called
        mocked_plugin.is_active.assert_called_with()
        mocked_plugin.new_service_created.assert_called_with()
开发者ID:crossroadchurch,项目名称:paul,代码行数:19,代码来源:test_pluginmanager.py

示例10: finalise_plugins_with_disabled_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def finalise_plugins_with_disabled_plugin_test(self):
        """
        Test running the finalise_plugins() method with a disabled plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Disabled
        mocked_plugin.is_active.return_value = False
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]

        # WHEN: We run finalise_plugins()
        plugin_manager.finalise_plugins()

        # THEN: The is_active() method should have been called, and initialise() method should NOT have been called
        mocked_plugin.is_active.assert_called_with()
        self.assertEqual(0, mocked_plugin.finalise.call_count, 'The finalise() method should not have been called.')
开发者ID:crossroadchurch,项目名称:paul,代码行数:19,代码来源:test_pluginmanager.py

示例11: hook_upgrade_plugin_settings_with_disabled_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_upgrade_plugin_settings_with_disabled_plugin_test(self):
        """
        Test running the hook_upgrade_plugin_settings() method with a disabled plugin
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Disabled
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]
        settings = Settings()

        # WHEN: We run hook_upgrade_plugin_settings()
        plugin_manager.hook_upgrade_plugin_settings(settings)

        # THEN: The upgrade_settings() method should not have been called
        self.assertEqual(0, mocked_plugin.upgrade_settings.call_count,
                         'The upgrade_settings() method should not have been called.')
开发者ID:crossroadchurch,项目名称:paul,代码行数:19,代码来源:test_pluginmanager.py

示例12: hook_settings_tabs_with_active_plugin_and_mocked_form_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def hook_settings_tabs_with_active_plugin_and_mocked_form_test(self):
        """
        Test running the hook_settings_tabs() method with an active plugin and a mocked settings form
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Active
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]
        mocked_settings_form = MagicMock()
        # Replace the autoloaded plugin with the version for testing in real code this would error
        mocked_settings_form.plugin_manager = plugin_manager

        # WHEN: We run hook_settings_tabs()
        plugin_manager.hook_settings_tabs()

        # THEN: The create_media_manager_item() method should have been called with the mocked settings form
        self.assertEqual(1, mocked_plugin.create_settings_tab.call_count,
                         'The create_media_manager_item() method should have been called once.')
        self.assertEqual(plugin_manager.plugins, mocked_settings_form.plugin_manager.plugins,
                         'The plugins on the settings form should be the same as the plugins in the plugin manager')
开发者ID:crossroadchurch,项目名称:paul,代码行数:23,代码来源:test_pluginmanager.py

示例13: test_hook_settings_tabs_with_disabled_plugin_and_mocked_form

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import plugins [as 别名]
    def test_hook_settings_tabs_with_disabled_plugin_and_mocked_form(self):
        """
        Test running the hook_settings_tabs() method with a disabled plugin and a mocked form
        """
        # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
        mocked_plugin = MagicMock()
        mocked_plugin.status = PluginStatus.Disabled
        plugin_manager = PluginManager()
        plugin_manager.plugins = [mocked_plugin]
        mocked_settings_form = MagicMock()
        # Replace the autoloaded plugin with the version for testing in real code this would error
        mocked_settings_form.plugin_manager = plugin_manager

        # WHEN: We run hook_settings_tabs()
        plugin_manager.hook_settings_tabs()

        # THEN: The create_settings_tab() method should not have been called, but the plugins lists should be the same
        self.assertEqual(0, mocked_plugin.create_settings_tab.call_count,
                         'The create_media_manager_item() method should not have been called.')
        self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins,
                         'The plugins on the settings form should be the same as the plugins in the plugin manager')
开发者ID:imkernel,项目名称:openlp,代码行数:23,代码来源:test_pluginmanager.py


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