-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathInitGui.py
190 lines (185 loc) · 14.4 KB
/
InitGui.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
#****************************************************************************
#* *
#* Dodo Workbench: *
#* substitute of flamingo for Py3 / Qt5 *
#* Copyright (c) 2019 Riccardo Treu LGPL *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#****************************************************************************
class dodo ( Workbench ):
import DraftSnap
import sys, FreeCAD
v=sys.version_info[0]
if v<3: FreeCAD.Console.PrintWarning('Dodo is written for Py3 and Qt5\n You may experience mis-behaviuors\n')
Icon = '''
/* XPM */
static char * dodo1_xpm[] = {
"98 98 2 1",
" c None",
". c #000000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .... ",
" ........ ",
" ........... ",
" ............. ",
" ............... ",
" ................. ",
" ..................... ",
" ......................... ",
" ............................. ",
" ................................ ",
" ................................ ",
" ................................. ",
" .................................. ",
" .................................. ",
" .................................. ",
" .................................. ",
" .................................. ",
" ................................. ",
" .......... .............. ",
" ...... ......... ........ ",
" ............ .......... ...... ",
" ................ .......... ",
" ................. .......... ",
" ................. ....... .......... ",
" .................. ................. ........... ",
" .................. ..................... ........... ",
" ........................................... ............ ",
" ............................................. ............. ",
" .............................................. ............. ",
" ................................................ .............. ",
" ................................................. ............... ",
" .................................................... ................. ",
" ....................................................................... ",
" ...................................................................... ",
" .................................................................... ",
" ................................................................ ",
" ............................................................... ",
" ................................................................ ",
" ................................................................ ",
" ................................................................ ",
" ................................................................ ",
" ................................................................. ",
" .................................................................. ",
" ................................................................. ",
" .................................................................. ",
" .................................................................. ",
" .................................................................. ",
" ................................................................... ",
" ................................................................... ",
" ................................................................... ",
" ................................................................ ",
" ............................................................... ",
" .............................................................. ",
" ............................................................. ",
" ............................................................ ",
" .......................................................... ",
" ......................................................... ",
" ....................................................... ",
" ...................................................... ",
" ................................................... ",
" .................................................. ",
" ............................................... ",
" ............................................. ",
" .......................................... ",
" ........................................ ",
" .................................... ",
" ................................ ",
" ............................ ",
" ......................... ",
" .................... ",
" .... ............ ",
" ... ... .. ",
" ... ... .... ",
" ... ................ ",
" ... .... ................. ",
" ... .................. ",
" ... .. ........ ",
" ... .... ..... ",
" .... .......... ....... ",
" ................... .... ",
" .................. . ",
" .... ....... ",
" ...... ",
" ...... ",
" ..... ",
" .. ",
" ",
" ",
" ",
" ",
" "};
'''
MenuText = "Dodo WB"
ToolTip = "Dodo workbench \n(substitute of flamingo for Py3/Qt5)"
def Initialize(self):
import CUtils
self.utilsList=["selectSolids","queryModel","moveWorkPlane","offsetWorkPlane","rotateWorkPlane","hackedL","moveHandle","dpCalc"]
self.appendToolbar("Utils",self.utilsList)
Log ('Loading Utils: done\n')
import CFrame
self.frameList=["FrameBranchManager","spinSect","reverseBeam","shiftBeam","pivotBeam","levelBeam","alignEdge","rotJoin","alignFlange","stretchBeam","extend","adjustFrameAngle","insertPath"]
self.appendToolbar("frameTools",self.frameList)
Log ('Loading Frame tools: done\n')
import CPipe
self.pypeList=["insertPipe","insertElbow","insertReduct","insertCap","insertValve","insertFlange","insertUbolt","insertPypeLine","insertBranch","insertTank","insertRoute","breakPipe","mateEdges","flat","extend2intersection","extend1intersection","laydown","raiseup","attach2tube","point2point","insertAnyz"]#,"joinPype"]
self.qm=["pipeQM","elbowQM","reductQM"]
self.appendToolbar("pipeTools",self.pypeList)
Log ('Loading Pipe tools: done\n')
self.appendMenu(["Frame tools"],self.frameList)
self.appendMenu(["Pype tools"],self.pypeList)
self.appendMenu(["Utils"],self.utilsList)
self.appendMenu(["QkMenus"], self.qm)
def ContextMenu(self, recipient):
self.appendContextMenu('Frames', self.frameList)
self.appendContextMenu('Pypes', self.pypeList)
self.appendContextMenu('Utils', self.utilsList)
def Activated(self):
if hasattr(FreeCADGui,"draftToolBar"):
FreeCADGui.draftToolBar.Activated()
if hasattr(FreeCADGui,"Snapper"):
FreeCADGui.Snapper.show()
FreeCAD.__activePypeLine__=None
FreeCAD.__activeFrameLine__=None
Msg("Created variables in FreeCAD module:\n")
Msg("__activePypeLine__\n")
Msg("__activeFrameLine__\n")
try:
import dodoPM
Msg("__dodoPMact__ \n")
FreeCAD.Console.PrintMessage(FreeCAD.__dodoPMact__.objectName()+' \'s shortcut = '+FreeCAD.__dodoPMact__.shortcuts()[0].toString()+'\n\t****\n')
except:
FreeCAD.Console.PrintError('dodoPM not loaded \n')
def Deactivated(self):
del FreeCAD.__activePypeLine__
Msg("__activePypeLine__ variable deleted\n")
del FreeCAD.__activeFrameLine__
Msg("__activeFrameLine__ variable deleted\n")
# mw=FreeCADGui.getMainWindow()
# mw.removeAction(FreeCAD.__dodoPMact__)
# Msg("dodoPM shortcut removed\n")
# del FreeCAD.__dodoPMact__
# Msg("__dodoPMact__ variable deleted\n")
# Msg("dodo deactivated()\n")
Gui.addWorkbench(dodo)