def extend_plugins(currpath, lst, err): rst = [] currpath,rpath = _preprocess_path(currpath) # ====================================================== for item in lst: if isinstance(item, tuple) or item=='-': rst.append(item) elif item[-3:]=='.mc': with open(os.path.join(currpath,item)) as f: cmds = f.readlines() #print(cmds) rst.append(Macros(item[:-3], cmds)) else: try: #!TODO:Fixme! # importlib.import_module() plg = __import__(rpath+'.'+item[:-3],'','',['']) if hasattr(plg, 'plgs'): rst.extend([x for x in plg.plgs]) for x in plg.plgs: if not isinstance(x, str): PluginsManager.add(x) else: rst.append(plg.Plugin) PluginsManager.add(plg.Plugin) except Exception as e: err.append((currpath, item, sys.exc_info()[1])) return rst
def extend_tools(path, lst, err): rst = [] for i in lst: if i[-3:] == '.mc': f = open(path + '/' + i) cmds = f.readlines() f.close() rst.append((Macros(i[:-3], cmds), path + '/' + i[:-3] + '.gif')) else: try: rpath = path.replace('/', '.').replace('\\', '.') plg = __import__(rpath + '.' + i, '', '', ['']) if hasattr(plg, 'plgs'): for i, j in plg.plgs: rst.append((i, path + '/' + j)) else: rst.append( (plg.Plugin, path + '/' + i.split('_')[0] + '.gif')) except Exception, e: err.append((path, i, sys.exc_info()[1]))
def extend_tools(currpath, lst, err): currpath,rpath = _preprocess_path(currpath) rst = [] for item in lst: if item[-3:]=='.mc': with open(os.path.join(currpath,item)) as f: cmds = f.readlines() rst.append((Macros(item[:-3], cmds), os.path.join(currpath,item[:-3]+'.gif'))) else: try: plg = __import__(rpath+'.'+item,'','',['']) if hasattr(plg, 'plgs'): for k,v in plg.plgs: rst.append((k, os.path.join(currpath,v))) else: rst.append((plg.Plugin,os.path.join(currpath,item.split('_')[0]+'.gif')) ) except Exception as e: err.append((currpath, item, sys.exc_info()[1])) #! Todo: Fixme! for item in rst: ToolsManager.add(item[0]) return rst
def extend_plugins(path, lst, err): rst = [] for i in lst: if isinstance(i, tuple) or i == '-': rst.append(i) elif i[-3:] == '.mc': f = open(path + '/' + i) cmds = f.readlines() f.close() rst.append(Macros(i[:-3], cmds)) else: try: rpath = path.replace('/', '.').replace('\\', '.') plg = __import__(rpath + '.' + i[:-3], '', '', ['']) if hasattr(plg, 'plgs'): rst.extend([j for j in plg.plgs]) for p in plg.plgs: if not isinstance(p, str): PluginsManager.add(p) else: rst.append(plg.Plugin) PluginsManager.add(plg.Plugin) except Exception, e: err.append((path, i, sys.exc_info()[1]))
def f(path): return Macros(path, ["Open>{'path':%s}"%repr(path)])
def run_line(self, event): cmds = self.text.GetStringSelection().split('\n') Macros(None, cmds).start()
def run(self, event): cmds = self.text.GetValue().split('\n') Macros(None, cmds).start()