MCPcopy Create free account
hub / github.com/Image-Py/imagepy / extend_tools

Function extend_tools

imagepy/core/loader/loader.py:124–148  ·  view source on GitHub ↗
(path, lst, err)

Source from the content-addressed store, hash-verified

122 return (pg, subtree)
123
124def 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
150def sort_tools(catlog, lst):
151 rst = []

Callers 1

build_toolsFunction · 0.85

Calls 5

appendMethod · 0.80
getpathFunction · 0.70
MacrosClass · 0.50
closeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected