aboutsummaryrefslogtreecommitdiff
path: root/InitGui.py
diff options
context:
space:
mode:
Diffstat (limited to 'InitGui.py')
-rw-r--r--InitGui.py160
1 files changed, 81 insertions, 79 deletions
diff --git a/InitGui.py b/InitGui.py
index fe85dd3..c210802 100644
--- a/InitGui.py
+++ b/InitGui.py
@@ -1,105 +1,107 @@
class MakeBoxCommandClass():
- def GetResources(self):
- return {#'Pixmap' : os.path.join( iconPath , 'AddWall.svg') , # the name of a svg file available in the resources
- 'MenuText': "Make Box" ,
- 'ToolTip' : "Extends a wall from a side face of metal sheet"}
-
- def Activated(self):
- from Boxer import BoxCfg, makeBox
- # TODO: put all objects in a group:
- # group = doc.addObject("App::DocumentObjectGroup","Group")
+ def GetResources(self):
+ return { #'Pixmap' : os.path.join( iconPath , 'AddWall.svg') , # the name of a svg file available in the resources
+ 'MenuText': "Make Box",
+ 'ToolTip': "Extends a wall from a side face of metal sheet"
+ }
- cfg = BoxCfg().outerDimmensions(300, 100, 50)
- # cfg.notches = 2
- cfg.notchUnitWidth = 10
- cfg.thickness = 10
- cfg.prt()
+ def Activated(self):
+ from Boxer import BoxCfg, makeBox
+ # TODO: put all objects in a group:
+ # group = doc.addObject("App::DocumentObjectGroup","Group")
+
+ cfg = BoxCfg().outerDimmensions(300, 100, 50)
+ # cfg.notches = 2
+ cfg.notchUnitWidth = 10
+ cfg.thickness = 10
+ cfg.prt()
+
+ doc = FreeCAD.ActiveDocument
+ makeBox(doc, cfg)
- doc = FreeCAD.ActiveDocument
- makeBox(doc, cfg)
+ doc.recompute()
+ Gui.SendMsgToActiveView("ViewFit")
- doc.recompute()
- Gui.SendMsgToActiveView("ViewFit")
+ return
- return
+ def IsActive(self):
+ return FreeCAD.ActiveDocument is not None
- def IsActive(self):
- return FreeCAD.ActiveDocument is not None
class RemoveBoxCommandClass():
- def GetResources(self):
- return {
- 'MenuText': "Remove Box",
- 'ToolTip' : "Remove the box"}
-
- def Activated(self):
- import BoxerGui
- BoxerGui.gui.removeBox()
-
- def IsActive(self):
- return FreeCAD.ActiveDocument is not None
+ def GetResources(self):
+ return {'MenuText': "Remove Box", 'ToolTip': "Remove the box"}
+
+ def Activated(self):
+ import BoxerGui
+ BoxerGui.gui.removeBox()
+
+ def IsActive(self):
+ return FreeCAD.ActiveDocument is not None
+
class ShowPanelCommandClass():
- def GetResources(self):
- return {
- 'MenuText': "Show Panel"}
-
- def Activated(self):
- from PySide import QtCore
- import BoxerGui
- print('ShowPanelCommandClass.Activated')
-
- #dockWidget = QtGui.QDockWidget()
- #dockWidget.setWindowTitle("Boxer 3")
- #dockWidget.resize(656, 300)
- #dockWidget.setObjectName("BoxerDockWidget")
- #verticalLayout = QtGui.QVBoxLayout(dockWidget)
- #verticalLayout.setObjectName("verticalLayout")
- #tabSizeLabel = QtGui.QLabel(dockWidget)
- #tabSizeLabel.setObjectName("tabSizeLabel")
- #tabSizeLabel.setText("Tab size")
-
- window = FreeCADGui.getMainWindow()
- window.addDockWidget(QtCore.Qt.RightDockWidgetArea, BoxerGui.gui.dockWidget)
- BoxerGui.gui.dockWidget.show()
-
-# app = QtGui.qApp
-# window = app.activeWindow()
-# window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dockWidget)
-
-# d = QtGui.QWidget()
-# d.ui = BoxerDockWidget.Ui_BoxerDockWidget()
-# d.ui.setupUi(d)
-# d.show()
-
- return
-
- def IsActive(self):
- return True
+ def GetResources(self):
+ return {'MenuText': "Show Panel"}
+
+ def Activated(self):
+ from PySide import QtCore
+ import BoxerGui
+ print('ShowPanelCommandClass.Activated')
+
+ #dockWidget = QtGui.QDockWidget()
+ #dockWidget.setWindowTitle("Boxer 3")
+ #dockWidget.resize(656, 300)
+ #dockWidget.setObjectName("BoxerDockWidget")
+ #verticalLayout = QtGui.QVBoxLayout(dockWidget)
+ #verticalLayout.setObjectName("verticalLayout")
+ #tabSizeLabel = QtGui.QLabel(dockWidget)
+ #tabSizeLabel.setObjectName("tabSizeLabel")
+ #tabSizeLabel.setText("Tab size")
+
+ window = FreeCADGui.getMainWindow()
+ window.addDockWidget(QtCore.Qt.RightDockWidgetArea, BoxerGui.gui.dockWidget)
+ BoxerGui.gui.dockWidget.show()
+
+ # app = QtGui.qApp
+ # window = app.activeWindow()
+ # window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dockWidget)
+
+ # d = QtGui.QWidget()
+ # d.ui = BoxerDockWidget.Ui_BoxerDockWidget()
+ # d.ui.setupUi(d)
+ # d.show()
+
+ return
+
+ def IsActive(self):
+ return True
+
class BoxerWorkbench(Workbench):
-
+
MenuText = "Boxer"
ToolTip = "Box Maker"
-
+
def Initialize(self):
- self.list = ["BoxerMakeBox", "BoxerRemoveBox", "BoxerShowPanel"]
- self.appendToolbar("Boxer Commands", self.list)
- import BoxerGui # Loads the Boxer modules
+ self.list = ["BoxerMakeBox", "BoxerRemoveBox", "BoxerShowPanel"]
+ self.appendToolbar("Boxer Commands", self.list)
+ import BoxerGui # Loads the Boxer modules
def Activated(self):
- Gui.runCommand('BoxerShowPanel')
- return
-
+ Gui.runCommand('BoxerShowPanel')
+ return
+
def Deactivated(self):
return
-
+
def ContextMenu(self, recipient):
self.appendContextMenu("Boxer", self.list)
-
- def GetClassName(self):
+
+ def GetClassName(self):
return "Gui::PythonWorkbench"
+
Gui.addCommand('BoxerMakeBox', MakeBoxCommandClass())
Gui.addCommand('BoxerRemoveBox', RemoveBoxCommandClass())
Gui.addCommand('BoxerShowPanel', ShowPanelCommandClass())