-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInitGui.py
49 lines (39 loc) · 1.72 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
import os
import FreeCAD as App
class CadbaseLibrary(Workbench):
from CdbsModules.Translate import translate
MenuText = translate('InitGui', 'CADBase Library')
ToolTip = translate(
'InitGui',
'The workbench is designed to use components (parts) from CADBase in the FreeCAD interface. \
Component modifications contain sets of files for various CAD systems. \
This workbench will work with data from the FreeCAD set, without downloading documentation and data from other file sets.'
)
Icon = os.path.join(
App.getUserAppDataDir() + 'Mod/CadbaseLibrary/Icons',
'CadbaseLibrary.xpm'
)
def Initialize(self):
"""This function is executed when the workbench is first activated.
It is executed once in a FreeCAD session followed by the Activated function.
"""
import CadbaseMacro
def Activated(self):
"""This function is executed whenever the workbench is activated"""
from PySide import QtGui
m = Gui.getMainWindow()
w = m.findChild(QtGui.QDockWidget, 'CADBaseLibrary')
if w and hasattr(w, 'isVisible') and not w.isVisible():
w.show()
return
def Deactivated(self):
"""This function is executed whenever the workbench is deactivated"""
return
def ContextMenu(self, recipient):
"""This function is executed whenever the user right-clicks on screen"""
# "recipient" will be either "view" or "tree"
def GetClassName(self):
# This function is mandatory if this is a full Python workbench
# This is not a template, the returned string should be exactly "Gui::PythonWorkbench"
return 'Gui::PythonWorkbench'
Gui.addWorkbench(CadbaseLibrary())