aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-06-15 14:20:26 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-06-15 14:20:26 +0200
commit26bb9a0623a37a3bf235648cd48252b1b2d4d669 (patch)
tree01648b4e816ffdacb22a9ff9514bb2dea0e1181b
parentcdd68eb10a962891a2cc2c1e1e05986ab046abf8 (diff)
downloadfreecad-boxer-26bb9a0623a37a3bf235648cd48252b1b2d4d669.tar.gz
freecad-boxer-26bb9a0623a37a3bf235648cd48252b1b2d4d669.tar.bz2
freecad-boxer-26bb9a0623a37a3bf235648cd48252b1b2d4d669.tar.xz
freecad-boxer-26bb9a0623a37a3bf235648cd48252b1b2d4d669.zip
o Reusing the same instance of the dock widget. Controlling visibility instead of using show().
-rw-r--r--InitGui.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/InitGui.py b/InitGui.py
index 316d1ea..978950f 100644
--- a/InitGui.py
+++ b/InitGui.py
@@ -1,15 +1,20 @@
class ShowPanelCommandClass():
+
+ def __init__(self):
+ self.widgetAdded = False
+
def GetResources(self):
return {'MenuText': "Show Panel"}
def Activated(self):
from PySide import QtCore
import BoxerGui
- print('ShowPanelCommandClass.Activated')
- window = FreeCADGui.getMainWindow()
- window.addDockWidget(QtCore.Qt.RightDockWidgetArea, BoxerGui.gui.dockWidget)
- BoxerGui.gui.dockWidget.show()
+ if not self.widgetAdded:
+ window = FreeCADGui.getMainWindow()
+ window.addDockWidget(QtCore.Qt.RightDockWidgetArea, BoxerGui.gui.dockWidget)
+ self.widgetAdded = True
+ BoxerGui.gui.dockWidget.setVisible(True)
return
@@ -24,7 +29,7 @@ class BoxerWorkbench(Workbench):
def Initialize(self):
self.list = ["BoxerShowPanel"]
- self.appendToolbar("Boxer Commands", self.list)
+ self.appendToolbar("Boxer", self.list)
import BoxerGui # Loads the Boxer modules
def Activated(self):