class BindingsPlugin(Plugin): """ A plugin that binds some names to values in the Python Shell View. """ bindings = List(contributes_to='envisage.plugins.python_shell.bindings') # The plugin's unique identifier. id = 'connectome.bindings' # The plugin's name (suitable for displaying to the user). name = 'Connectome File Bindings' mycfile = Service('cviewer.plugins.cff2.cfile.CFile') #analyze_node = Service('cviewer.plugins.analysis.analysis_node.AnalysisNode') def _bindings_default(self): """ Trait initializer. """ bindings = {'cfile' : self.mycfile } #, 'analyze_node' : self.analyze_node} return [bindings] def stop(self): """ When the plugins stops, clear all remaining volume and trackfiles """ # empty everything self.mycfile.close_cfile()
def test_service_str_representation(self): """ test the string representation of the service """ class Foo(HasTraits): pass service_repr = "Service(protocol={!r})" service = Service(Foo) self.assertEqual(service_repr.format(Foo), str(service)) self.assertEqual(service_repr.format(Foo), repr(service))
class Bar(HasTraits): foo = Service(Foo)
class PluginB(Plugin): id = 'B' foo = Service(Foo)
class PluginB(Plugin): id = "B" foo = Service(Foo)