def loadPlugins(self, pluginFolder): os.chdir(getMainDir()) pluginModulePath = pluginFolder.replace('/', '.') if runningExecutable(): if platform.system() == 'Windows': # windows plugin folder pluginFolder = 'library/' + pluginFolder else: # os x plugin folder pluginFolder = './lib/python2.6/site-packages/' + pluginFolder dict = {} for filename in os.listdir(pluginFolder): if os.path.isdir(os.path.join (pluginFolder, filename)): continue extension = filename[filename.rfind('.')+1:len(filename)] if extension == 'py' and filename != '__init__.py': pluginModule = filename[0:filename.rfind('.')] theModule = __import__(pluginModulePath + pluginModule, fromlist='*') theClass = getattr(theModule, pluginModule) theObject = theClass(self.preferences) dict[theObject.name] = theObject return dict
def loadPlugins(self, pluginFolder): os.chdir(getMainDir()) pluginModulePath = pluginFolder.replace('/', '.') if runningExecutable(): if platform.system() == 'Windows': # windows plugin folder pluginFolder = 'library/' + pluginFolder else: # os x plugin folder pluginFolder = './lib/python2.6/site-packages/' + pluginFolder dict = {} for filename in os.listdir(pluginFolder): if os.path.isdir(os.path.join(pluginFolder, filename)): continue extension = filename[filename.rfind('.') + 1:len(filename)] if extension == 'py' and filename != '__init__.py': pluginModule = filename[0:filename.rfind('.')] theModule = __import__(pluginModulePath + pluginModule, fromlist='*') theClass = getattr(theModule, pluginModule) theObject = theClass(self.preferences) dict[theObject.name] = theObject return dict
def loadPlots(self, preferences, pluginFolder): os.chdir(getMainDir()) pluginModulePath = pluginFolder.replace('/', '.') if runningExecutable(): if platform.system() == 'Windows': # windows plugin folder pluginFolder = 'library/' + pluginFolder else: # os x plugin folder pluginFolder = './lib/python2.6/site-packages/' + pluginFolder for filename in os.listdir(pluginFolder): if os.path.isdir(os.path.join (pluginFolder, filename)): continue extension = filename[filename.rfind('.')+1:len(filename)] if extension == 'py' and filename != '__init__.py': pluginModule = filename[0:filename.rfind('.')] theModule = __import__(pluginModulePath + pluginModule, fromlist='*') theClass = getattr(theModule, pluginModule) plot = theClass(preferences) self.plotClassDict[plot.name] = theClass self.plotDict[plot.name] = plot exploratoryPlots = [] statisticalPlots = [] for key in self.plotDict: if self.plotDict[key].type == 'Exploratory': exploratoryPlots.append(key) else: statisticalPlots.append(key) exploratoryPlots.sort(lambda a,b:cmp(a.upper(), b.upper())) statisticalPlots.sort(lambda a,b:cmp(a.upper(), b.upper())) for plotName in exploratoryPlots: self.cboPlots.addItem(plotName) self.cboPlots.insertSeparator(self.cboPlots.count()) for plotName in statisticalPlots: self.cboPlots.addItem(plotName) self.display(self.defaultPlot, None, None) self.cboPlots.setCurrentIndex(self.cboPlots.findText(self.defaultPlot))
def loadPlugins(self, pluginFolder): pluginModulePath = pluginFolder.replace('/', '.') if runningExecutable(): pluginFolder = 'library/' + pluginFolder dict = {} for filename in os.listdir(pluginFolder): if os.path.isdir(os.path.join(pluginFolder, filename)): continue extension = filename[filename.rfind('.') + 1:len(filename)] if extension == 'py' and filename != '__init__.py': pluginModule = filename[0:filename.rfind('.')] theModule = __import__(pluginModulePath + pluginModule, fromlist='*') theClass = getattr(theModule, pluginModule) theObject = theClass(self.preferences) dict[theObject.name] = theObject return dict
def loadPlots(self, preferences, pluginFolder): pluginModulePath = pluginFolder.replace('/', '.') if runningExecutable(): pluginFolder = 'library/' + pluginFolder for filename in os.listdir(pluginFolder): if os.path.isdir(os.path.join(pluginFolder, filename)): continue extension = filename[filename.rfind('.') + 1:len(filename)] if extension == 'py' and filename != '__init__.py': pluginModule = filename[0:filename.rfind('.')] theModule = __import__(pluginModulePath + pluginModule, fromlist='*') theClass = getattr(theModule, pluginModule) plot = theClass(preferences) self.cboPlots.addItem(plot.name) self.plotClassDict[plot.name] = theClass self.plotDict[plot.name] = plot self.display(self.defaultPlot, None) self.cboPlots.setCurrentIndex(self.cboPlots.findText(self.defaultPlot))