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


Python PluginManager.hook_export_menu方法代码示例

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


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

示例1: hook_export_menu_with_active_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import hook_export_menu [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

示例2: hook_export_menu_with_disabled_plugin_test

# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import hook_export_menu [as 别名]
    def hook_export_menu_with_disabled_plugin_test(self):
        """
        Test running the hook_export_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_export_menu()
        plugin_manager.hook_export_menu()

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


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