(path, err=False)
| 159 | return rst |
| 160 | |
| 161 | def build_tools(path, err=False): |
| 162 | root = err in (True, False) |
| 163 | if root: sta, err = err, [] |
| 164 | subtree = [] |
| 165 | cont = os.listdir(os.path.join(root_dir, path)) |
| 166 | |
| 167 | for i in cont: |
| 168 | subp = os.path.join(path,i) |
| 169 | if root and os.path.isdir(os.path.join(root_dir, subp)): |
| 170 | sub = build_tools(subp, err) |
| 171 | if len(sub)!=0:subtree.append(sub) |
| 172 | elif not root: |
| 173 | if i[len(i)-7:] in ('_tol.py', 'tols.py'): |
| 174 | subtree.append(i[:-3]) |
| 175 | elif i[-3:] in ('.mc', '.md', '.wf', 'rpt'): |
| 176 | subtree.append(i) |
| 177 | if len(subtree)==0:return [] |
| 178 | rpath = path.replace('/', '.').replace('\\','.') |
| 179 | #rpath = rpath[rpath.index('imagepy.'):] |
| 180 | pg = __import__('imagepy.' + rpath,'','',['']) |
| 181 | pg.title = os.path.basename(path) |
| 182 | if hasattr(pg, 'catlog'): |
| 183 | subtree = sort_tools(pg.catlog, subtree) |
| 184 | if not root:subtree = extend_tools(path, subtree, err) |
| 185 | elif sta and len(err)>0: |
| 186 | IPy.write('tools not loaded:') |
| 187 | for i in err: IPy.write('>>> %-50s%-20s%s'%i) |
| 188 | return (pg, subtree) |
| 189 | |
| 190 | def extend_widgets(path, lst, err): |
| 191 | rst = [] |
no test coverage detected