forked from davesrocketshop/Rocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InitGui.py
90 lines (77 loc) · 5.08 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
# ***************************************************************************
# * Copyright (c) 2021-2024 David Carter <[email protected]> *
# * *
# * 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 *
# * *
# ***************************************************************************
__author__ = "David Carter"
__url__ = "https://www.davesrocketshop.com"
import FreeCAD
# import Fem # Requires the FEM workbench to be loaded
class RocketWorkbench ( Workbench ):
"Rocket workbench object"
Icon = FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/icons/RocketWorkbench.svg"
MenuText = "Rocket"
ToolTip = "Rocket workbench"
def _loadFemModule(self):
# load the FEM module
import Fem
import FemGui
import femcommands.commands
# dummy usage to get flake8 and lgtm quiet
False if Fem.__name__ else True
False if FemGui.__name__ else True
False if femcommands.commands.__name__ else True
def Initialize(self):
FreeCADGui.addLanguagePath(FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/translations")
# load the module
import RocketGui
import SketcherGui
from PySide.QtCore import QT_TRANSLATE_NOOP
self._loadFemModule()
self.appendToolbar(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
['Rocket_Rocket', 'Rocket_Stage', 'Rocket_ParallelStage', 'Rocket_Pod', 'Rocket_NoseCone', 'Rocket_Transition', 'Rocket_BodyTube', 'Rocket_InnerTube', 'Rocket_Coupler', 'Rocket_EngineBlock',
'Rocket_CenteringRing', 'Rocket_Bulkhead', 'Rocket_Fin', 'Rocket_FinCan', 'Rocket_LaunchLug', 'Rocket_RailButton', 'Rocket_RailGuide',
#'Rocket_Parachute',
])
self.appendToolbar(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
['Separator', 'Rocket_MoveUp', 'Rocket_MoveDown'])
self.appendToolbar(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
['Separator', 'Rocket_NewSketch', 'Sketcher_EditSketch', 'Separator', 'Rocket_Calculators'])
# self.appendToolbar(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
# ['Separator', 'Rocket_ParachuteGore'])
self.appendToolbar(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
# ['Separator', 'Rocket_FinFlutter', 'Rocket_FemAnalysis', 'FEM_MeshGmshFromShape', "Rocket_MaterialEditor", 'Rocket_MaterialMapping'])
['Separator', 'Rocket_FinFlutter', "Rocket_MaterialEditor"])
self.appendMenu(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
['Rocket_Rocket', 'Rocket_Stage', 'Rocket_ParallelStage', 'Rocket_Pod', 'Rocket_NoseCone', 'Rocket_Transition', 'Rocket_BodyTube', 'Rocket_InnerTube', 'Rocket_Coupler', 'Rocket_EngineBlock',
'Rocket_CenteringRing', 'Rocket_Bulkhead', 'Rocket_Fin', 'Rocket_FinCan', 'Rocket_LaunchLug', 'Rocket_RailButton', 'Rocket_RailGuide',
#'Rocket_Parachute'
])
self.appendMenu(QT_TRANSLATE_NOOP('Rocket', 'Rocket'),
['Separator'])
self.appendMenu([QT_TRANSLATE_NOOP("Rocket", "Rocket"),
QT_TRANSLATE_NOOP("Rocket", "Calculators")],
['Rocket_CalcBlackPowder', 'Rocket_CalcParachute', 'Rocket_CalcThrustToWeight', 'Rocket_CalcVentHoles'])
self.appendMenu([QT_TRANSLATE_NOOP("Rocket", "Rocket"),
QT_TRANSLATE_NOOP("Rocket", "Analysis")],
# ['Rocket_FinFlutter', 'Rocket_FemAnalysis', 'FEM_MeshGmshFromShape', "Rocket_MaterialEditor", 'Rocket_MaterialMapping'])
['Rocket_FinFlutter', "Rocket_MaterialEditor"])
def GetClassName(self):
return "Gui::PythonWorkbench"
Gui.addWorkbench(RocketWorkbench())
FreeCAD.__unit_test__ += ["TestRocketGui"]