diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-06-15 14:20:26 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-06-15 14:20:26 +0200 |
commit | 26bb9a0623a37a3bf235648cd48252b1b2d4d669 (patch) | |
tree | 01648b4e816ffdacb22a9ff9514bb2dea0e1181b | |
parent | cdd68eb10a962891a2cc2c1e1e05986ab046abf8 (diff) | |
download | freecad-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.py | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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): |