| 122 | return (pg, subtree) |
| 123 | |
| 124 | def extend_tools(path, lst, err): |
| 125 | rst = [] |
| 126 | for i in lst: |
| 127 | if i[-3:] in ('.mc', '.md', '.wf', 'rpt'): |
| 128 | pt = os.path.join(root_dir, path) |
| 129 | # if i[-3:] == '.md':print(pt) |
| 130 | f = open(pt+'/'+i) |
| 131 | cmds = f.readlines() |
| 132 | f.close() |
| 133 | rst.append((Macros(i[:-3], [getpath(pt, i) for i in cmds]), |
| 134 | os.path.join(root_dir, path)+'/'+i[:-3]+'.gif')) |
| 135 | else: |
| 136 | try: |
| 137 | rpath = path.replace('/', '.').replace('\\','.') |
| 138 | #rpath = rpath[rpath.index('imagepy.'):] |
| 139 | |
| 140 | plg = __import__('imagepy.'+rpath+'.'+i,'','',['']) |
| 141 | if hasattr(plg, 'plgs'): |
| 142 | for i,j in plg.plgs: rst.append((i, path+'/'+j)) |
| 143 | else: rst.append((plg.Plugin, |
| 144 | os.path.join(root_dir, path)+'/'+i.split('_')[0]+'.gif')) |
| 145 | except Exception as e: |
| 146 | err.append((path, i, sys.exc_info()[1])) |
| 147 | for i in rst:ToolsManager.add(i[0]) |
| 148 | return rst |
| 149 | |
| 150 | def sort_tools(catlog, lst): |
| 151 | rst = [] |