-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathInitGui.py
More file actions
65 lines (48 loc) · 2.71 KB
/
InitGui.py
File metadata and controls
65 lines (48 loc) · 2.71 KB
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
# -*- coding: utf-8 -*-
__title__='FreeCAD CurvedShapes Workbench - Init file'
__author__ = 'Christian Bergmann'
__url__ = ['http://www.freecadweb.org']
class CurvedShapesWB (Workbench):
def __init__(self):
import os
import CurvedShapes
translate = FreeCAD.Qt.translate
translations_path = os.path.join(os.path.join(CurvedShapes.get_module_path(), 'Resources', "translations"))
FreeCADGui.addLanguagePath(translations_path)
FreeCADGui.updateLocale()
self.__class__.MenuText = 'Curved Shapes'
self.__class__.ToolTip = translate("Workbench", 'Creates 3D designs from 2D curves')
self.__class__.Icon = os.path.join(CurvedShapes.get_module_path(), 'Resources', 'icons', 'curvedArray.svg')
def Initialize(self):
'This function is executed when FreeCAD starts'
# import here all the needed files that create your FreeCAD commands
import CurvedShapes
import CurvedSegment
import CurvedArray
import CurvedPathArray
import InterpolatedMiddle
import Horten_HIX
import FlyingWingS800
import SurfaceCut
import NotchConnector
from PySide.QtCore import QT_TRANSLATE_NOOP
self.examples = ['Horten_HIX', 'FlyingWingS800'] # A list of command names created in the line above
self.list = ['CurvedArray', 'CurvedPathArray', 'CurvedSegment', 'CurvedPathSegment', 'InterpolatedMiddle', 'SurfaceCut', 'NotchConnector'] # A list of command names created in the line above
self.appendToolbar(QT_TRANSLATE_NOOP('Curved Shapes', 'Curved Shapes'), self.list) # creates a new toolbar with your commands
self.appendMenu(QT_TRANSLATE_NOOP('Curved Shapes', 'Curved Shapes'), self.list) # creates a new menu 'Curved Functions'
self.appendMenu('Curved Shapes', 'Separator') # creates a new menu separator
self.appendMenu(QT_TRANSLATE_NOOP('Curved Shapes', 'Examples'), self.examples) # creates a new menu
def Activated(self):
'This function is executed when the workbench is activated'
return
def Deactivated(self):
'This function is executed when the workbench is deactivated'
return
def ContextMenu(self, recipient):
'This is executed whenever the user right-clicks on screen'
# 'recipient' will be either 'view' or 'tree'
self.appendContextMenu(QT_TRANSLATE_NOOP('Curved Shapes', 'Curved Shapes'), self.list) # add commands to the context menu
def GetClassName(self):
# this function is mandatory if this is a full python workbench
return 'Gui::PythonWorkbench'
Gui.addWorkbench(CurvedShapesWB())