def test_register_plugin(self): p_name = _TestPlugin.name p_name_ = p_name # Simulates a new plugin and try registering on manager p_name_ += '_' _TestPlugin.name = p_name_ self.assertFalse(p_name_ in self._manager.available_plugins_names) self._manager._plugin_descriptions[p_name_] = p_name_ self._manager.register_plugin(_TestPlugin()) _TestPlugin.name = p_name self.assertTrue(p_name_ in self._manager.available_plugins_names) self.assertTrue(p_name_ in self._manager._plugins) # Simulates a new plugin and try registering using register_plugin p_name_ += '_' _TestPlugin.name = p_name_ self.assertFalse(p_name_ in self._manager.available_plugins_names) self._manager._plugin_descriptions[p_name_] = p_name_ register_plugin(_TestPlugin) _TestPlugin.name = p_name self.assertTrue(p_name_ in self._manager.available_plugins_names) self.assertTrue(p_name_ in self._manager._plugins) # Try to register to invalid plugins self.assertRaises(TypeError, self._manager.register_plugin, object()) self.assertRaises(TypeError, register_plugin, object)
def test_register_plugin(self): p_name = _TestPlugin.name p_name_ = p_name # Simulates a new plugin and try registering on manager p_name_ += '_' _TestPlugin.name = p_name_ self.assertFalse(p_name_ in self._manager.available_plugins_names) self._manager._plugin_descriptions[p_name_] = p_name_ self._manager.register_plugin(_TestPlugin()) _TestPlugin.name = p_name self.assertTrue(p_name_ in self._manager.available_plugins_names) self.assertTrue(p_name_ in self._manager._plugins) # Simulates a new plugin and try registering using register_plugin p_name_ += '_' _TestPlugin.name = p_name_ self.assertFalse(p_name_ in self._manager.available_plugins_names) self._manager._plugin_descriptions[p_name_] = p_name_ register_plugin(_TestPlugin) _TestPlugin.name = p_name self.assertTrue(p_name_ in self._manager.available_plugins_names) self.assertTrue(p_name_ in self._manager._plugins) # Try to register to invalid plugins self.assertRaises(TypeError, self._manager.register_plugin, object()) self.assertRaises(TypeError, register_plugin, object)
def _register_test_plugin(self): # Workaround to register _TestPlugin since it is not really a plugin. # Two plugins are instanced and setup to be used on this class' tests. # _dependend_plugin depends on _independent_plugin. ind_name = self._independent_plugin.name dep_name = self._dependent_plugin.name # Creating independent plugin description ind_desc = Settable(dependencies=[]) # Description that sets the dependency to the independent plugin. dep_desc = Settable(dependencies=[ind_name]) self._manager._plugin_descriptions[ind_name] = ind_desc self._manager._plugin_descriptions[dep_name] = dep_desc register_plugin(_TestPlugin) register_plugin(_TestDependentPlugin)
def _register_test_plugin(self): # Workaround to register _TestPlugin since is not really a plugin self._manager._plugin_descriptions[_TestPlugin.name] = None register_plugin(_TestPlugin)
implements(IPlugin) name = u'books' has_product_slave = True def __init__(self): self.ui = None # # IPlugin # def get_migration(self): environ.add_resource('booksql', os.path.join(plugin_root, 'sql')) return PluginSchemaMigration(self.name, 'booksql', ['*.sql']) def get_tables(self): return [('bookdomain', ['BookPublisher', 'Book'])] def activate(self): environ.add_resource('glade', os.path.join(plugin_root, 'glade')) self.ui = BooksUI() def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(BooksPlugin)
# # IPlugin # def get_migration(self): return PluginSchemaMigration(self.name, 'optical', 'sql', ['*.sql', '*.py']) def get_tables(self): return [('opticaldomain', [ 'OpticalMedic', 'OpticalProduct', 'OpticalWorkOrder', 'OpticalPatientHistory', 'OpticalPatientMeasures', 'OpticalPatientTest', 'OpticalPatientVisualAcuity' ])] def activate(self): self.ui = OpticalUI.get_instance() def get_server_tasks(self): return [] def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): # pragma: nocoverage assert False register_plugin(OpticalPlugin)
has_product_slave = True def __init__(self): self.ui = None # # IPlugin # def get_migration(self): environ.add_resource('opticalsql', os.path.join(os.path.dirname(__file__), 'sql')) return PluginSchemaMigration(self.name, 'opticalsql', ['*.sql']) def get_tables(self): return [('opticaldomain', ['WorkOrderOpticalDetails'])] def activate(self): environ.add_resource('glade', os.path.join(os.path.dirname(__file__), 'glade')) self.ui = OpticalUI() def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(OpticalPlugin)
def _register_test_plugin(self): # Workaround to register _TestPlugin since is not really a plugin self._manager._plugin_descriptions[_TestPlugin.name] = None register_plugin(_TestPlugin)
has_product_slave = True def __init__(self): self.ui = None # # IPlugin # def get_migration(self): return PluginSchemaMigration(self.name, 'books', 'sql', ['*.sql']) def get_tables(self): return [('booksdomain', ['BookPublisher', 'Book'])] def activate(self): from books.booksui import BooksUI self.ui = BooksUI() def get_server_tasks(self): return [] def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(BooksPlugin)
@implementer(IPlugin) class BikeShopPlugin(object): name = u'bikeshop' has_product_slave = True def __init__(self): self.ui = None # # IPlugin # def get_migration(self): pass def get_tables(self): return [] def activate(self): self.ui = BikeShopUI() def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(BikeShopPlugin)
class NFePlugin(object): name = u'nfe' def __init__(self): self.ui = None # # IPlugin # def get_migration(self): return PluginSchemaMigration(self.name, 'nfe', 'sql', ['*.sql']) def get_tables(self): return [] def activate(self): self.ui = NFeUI() def get_server_tasks(self): return [] def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(NFePlugin)
def __init__(self): self.ui = None # # IPlugin # def get_migration(self): environ.add_resource("ecfsql", os.path.join(os.path.dirname(__file__), "sql")) return PluginSchemaMigration(self.name, "ecfsql", ["*.sql"]) def get_tables(self): return [("ecfdomain", ["ECFPrinter", "DeviceConstant", "FiscalSaleHistory", "ECFDocumentHistory"])] def activate(self): environ.add_resource("glade", os.path.join(os.path.dirname(__file__), "glade")) # Do this in a nested import so we can import the plugin without # importing gtk. from ecf.ecfui import ECFUI self.ui = ECFUI() def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(ECFPlugin)
@implementer(IPlugin) class NFePlugin(object): name = u'nfe' def __init__(self): self.ui = None # # IPlugin # def get_migration(self): return PluginSchemaMigration(self.name, 'nfe', 'sql', ['*.sql']) def get_tables(self): return [] def activate(self): self.ui = NFeUI() def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(NFePlugin)
self.ui = None # # IPlugin # def get_migration(self): environ.add_resource('ecfsql', os.path.join(os.path.dirname(__file__), 'sql')) return PluginSchemaMigration(self.name, 'ecfsql', ['*.sql']) def get_tables(self): return [('ecfdomain', ["ECFPrinter", "DeviceConstant"])] def activate(self): environ.add_resource('glade', os.path.join(os.path.dirname(__file__), 'glade')) # Do this in a nested import so we can import the plugin without # importing gtk. from ecf.ecfui import ECFUI self.ui = ECFUI() def get_dbadmin_commands(self): return [] def handle_dbadmin_command(self, command, options, args): assert False register_plugin(ECFPlugin)