/
loadTools.py
201 lines (130 loc) · 4.36 KB
/
loadTools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import FreeCADGui
import os, sys
import fakemodule
path = os.path.dirname(fakemodule.__file__)
iconPath = os.path.join(path, "Icons")
# ######################################################################################################################
class BOM():
def GetResources(self):
return {"Pixmap" : os.path.join(iconPath, "getDimensions.xpm"),
"Accel" : "",
"MenuText": "BOM",
"ToolTip" : "creates spreadsheet with dimensions to cut"}
def Activated(self):
import os, sys
import fakemodule
modulePath = sys.path
module = "getDimensions"
path = os.path.dirname(fakemodule.__file__)
path = os.path.join(path, "Tools")
path = os.path.join(path, module)
sys.path.append(path)
if module in sys.modules:
del sys.modules[module]
__import__(module, globals(), locals(), [], 0)
sys.path = modulePath
return
def IsActive(self):
# not needed now, maybe in the future
return True
FreeCADGui.addCommand("BOM", BOM())
# ######################################################################################################################
class HTML():
def GetResources(self):
return {"Pixmap" : os.path.join(iconPath, "sheet2export.xpm"),
"Accel" : "",
"MenuText": "HTML",
"ToolTip" : "exports spreadsheet to chosen file format"}
def Activated(self):
import os, sys
import fakemodule
modulePath = sys.path
module = "sheet2export"
path = os.path.dirname(fakemodule.__file__)
path = os.path.join(path, "Tools")
path = os.path.join(path, module)
sys.path.append(path)
if module in sys.modules:
del sys.modules[module]
__import__(module, globals(), locals(), [], 0)
sys.path = modulePath
return
def IsActive(self):
# not needed now, maybe in the future
return True
FreeCADGui.addCommand("HTML", HTML())
# ######################################################################################################################
class CODE():
def GetResources(self):
return {"Pixmap" : os.path.join(iconPath, "scanObjects.xpm"),
"Accel" : "",
"MenuText": "CODE",
"ToolTip" : "inspection tool for FreeCAD macro development & project debug"}
def Activated(self):
import os, sys
import fakemodule
modulePath = sys.path
module = "scanObjects"
path = os.path.dirname(fakemodule.__file__)
path = os.path.join(path, "Tools")
path = os.path.join(path, module)
sys.path.append(path)
if module in sys.modules:
del sys.modules[module]
__import__(module, globals(), locals(), [], 0)
sys.path = modulePath
return
def IsActive(self):
# not needed now, maybe in the future
return True
FreeCADGui.addCommand("CODE", CODE())
# ######################################################################################################################
class SETTEXTURES():
def GetResources(self):
return {"Pixmap" : os.path.join(iconPath, "setTextures.xpm"),
"Accel" : "",
"MenuText": "SETTEXTURES",
"ToolTip" : "store textures URL or load stored"}
def Activated(self):
import os, sys
import fakemodule
modulePath = sys.path
module = "setTextures"
path = os.path.dirname(fakemodule.__file__)
path = os.path.join(path, "Tools")
path = os.path.join(path, module)
sys.path.append(path)
if module in sys.modules:
del sys.modules[module]
__import__(module, globals(), locals(), [], 0)
sys.path = modulePath
return
def IsActive(self):
# not needed now, maybe in the future
return True
FreeCADGui.addCommand("SETTEXTURES", SETTEXTURES())
# ######################################################################################################################
class DEBUGINFO():
def GetResources(self):
return {"Pixmap" : os.path.join(iconPath, "debugInfo.xpm"),
"Accel" : "",
"MenuText": "DEBUGINFO",
"ToolTip" : "copy platform details to clipboard for bug report purposes"}
def Activated(self):
import os, sys
import fakemodule
modulePath = sys.path
module = "debugInfo"
path = os.path.dirname(fakemodule.__file__)
path = os.path.join(path, "Tools")
path = os.path.join(path, module)
sys.path.append(path)
if module in sys.modules:
del sys.modules[module]
__import__(module, globals(), locals(), [], 0)
sys.path = modulePath
return
def IsActive(self):
# not needed now, maybe in the future
return True
FreeCADGui.addCommand("DEBUGINFO", DEBUGINFO())