本文整理汇总了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)
#.........这里部分代码省略.........