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


Python Workbench.get_manifest方法代码示例

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


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

示例1: Test_Prefs

# 需要导入模块: from enaml.workbench.api import Workbench [as 别名]
# 或者: from enaml.workbench.api.Workbench import get_manifest [as 别名]
class Test_Prefs(object):

    test_dir = ''

    @classmethod
    def setup_class(cls):
        print complete_line(__name__ +
                            ':{}.setup_class()'.format(cls.__name__), '-', 77)

    @classmethod
    def teardown_class(cls):
        print complete_line(__name__ +
                            ':{}.teardown_class()'.format(cls.__name__), '-',
                            77)

    def setup(self):
        self.workbench = Workbench()

    def test_closing(self):
        """ Test that validation stops as soon as the event is rejected.

        """
        self.workbench.register(HqcAppManifest())
        self.workbench.register(ClosingContributor1())
        self.workbench.register(ClosingContributor2())
        manifest1 = self.workbench.get_manifest('test.closing')
        manifest2 = self.workbench.get_manifest('test.closing2')
        window = Helper(self.workbench)

        plugin = self.workbench.get_plugin('hqc_meas.app')
        ev = CloseEvent()
        plugin.validate_closing(window, ev)

        assert_false(ev.is_accepted())
        assert_false(manifest2.called)

        manifest1.accept = True
        manifest2.accept = True

        plugin.validate_closing(window, ev)

        assert_true(ev.is_accepted())
        assert_true(manifest2.called)

        self.workbench.unregister(u'test.closing')
        self.workbench.unregister(u'hqc_meas.app')

    def test_check_registation1(self):
        """ Test that ClosingApp are properly found at start-up.

        """
        self.workbench.register(HqcAppManifest())
        self.workbench.register(ClosingContributor1())

        plugin = self.workbench.get_plugin('hqc_meas.app')
        assert_equal(len(plugin._closing_extensions), 1)
        assert_equal(len(plugin._closing_checks), 1)

        self.workbench.unregister(u'test.closing')

        assert_false(plugin._closing_extensions)
        assert_false(plugin._closing_checks)

        self.workbench.unregister(u'hqc_meas.app')

    def test_check_registration2(self):
        """ Test ClosingApp update when a new plugin is registered.

        """
        self.workbench.register(HqcAppManifest())

        plugin = self.workbench.get_plugin('hqc_meas.app')
        assert_false(plugin._closing_extensions)
        assert_false(plugin._closing_checks)

        self.workbench.register(ClosingContributor1())
        assert_equal(len(plugin._closing_extensions), 1)
        assert_equal(len(plugin._closing_checks), 1)
        
        self.workbench.register(ClosingContributor1ter())
        assert_equal(len(plugin._closing_extensions), 2)
        assert_equal(len(plugin._closing_checks), 2)

        self.workbench.unregister(u'test.closing')
        self.workbench.unregister(u'hqc_meas.app')

    def test_check_factory(self):
        """ Test getting the ClosingApp decl from a factory.

        """
        self.workbench.register(HqcAppManifest())
        self.workbench.register(ClosingContributor2())

        plugin = self.workbench.get_plugin('hqc_meas.app')
        assert_equal(len(plugin._closing_extensions), 1)
        assert_equal(len(plugin._closing_checks), 1)

        self.workbench.unregister(u'test.closing2')

        assert_false(plugin._closing_extensions)
#.........这里部分代码省略.........
开发者ID:MatthieuDartiailh,项目名称:HQCMeas,代码行数:103,代码来源:test_app_plugin.py


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