def __init__(self, parent): self.parent = parent # Set up pubsub pub.subscribe(self.OnUpdatePatient, 'patient.updated.raw_data') # Load the XRC file for our gui resources self.res = XmlResource(util.GetBasePluginsPath('anonymize.xrc'))
def pluginLoader(parent): """Function to load the plugin.""" # Load the XRC file for our gui resources res = XmlResource(util.GetBasePluginsPath('treeview.xrc')) panelTreeView = res.LoadPanel(parent, 'pluginTreeView') panelTreeView.Init(res) return panelTreeView
def pluginLoader(parent): """Function to load the plugin.""" # Load the XRC file for our gui resources res = XmlResource(util.GetBasePluginsPath("dvh.xrc")) panelDVH = res.LoadPanel(parent, "pluginDVH") panelDVH.Init(res) return panelDVH
def import_plugins(userpath=None): """Find and import available plugins.""" # Get the base plugin path basepath = util.GetBasePluginsPath('') # Get the user plugin path if it has not been set if (userpath == None): datapath = guiutil.get_data_dir() userpath = os.path.join(datapath, 'plugins') # Get the list of possible plugins from both paths possibleplugins = [] for i in os.listdir(userpath): possibleplugins.append({'plugin': i, 'location': 'user'}) for i in os.listdir(basepath): possibleplugins.append({'plugin': i, 'location': 'base'}) modules = [] plugins = [] for p in possibleplugins: module = p['plugin'].split('.')[0] if module not in modules: if not ((module == "__init__") or (module == "")): # only try to import the module once modules.append(module) try: f, filename, description = \ imp.find_module(module, [userpath, basepath]) except ImportError: # Not able to find module so pass pass else: # Try to import the module if no exception occurred try: m = imp.load_module(module, f, filename, description) except ImportError: logger.exception("%s could not be loaded", module) else: plugins.append({ 'plugin': m, 'location': p['location'] }) logger.debug("%s loaded", module) # If the module is a single file, close it if not (description[2] == imp.PKG_DIRECTORY): f.close() return plugins