BIM: Fix BIM Views panel open behavior on WB activation (#15617)

* BIM: Fix BIM Views panel open behavior on WB activation

Fixes #15524.

* Something obvious was missed...
This commit is contained in:
Roy-043
2024-07-30 10:29:30 +02:00
committed by GitHub
parent e6863d0d15
commit 10f03c46fa
2 changed files with 15 additions and 6 deletions

View File

@@ -578,8 +578,8 @@ class BIMWorkbench(Workbench):
# store views widget state and vertical size
w = BimViews.findWidget()
PARAMS.SetBool("RestoreBimViews", bool(w))
if w:
PARAMS.SetBool("RestoreBimViews", w.isVisible())
PARAMS.SetInt("BimViewsSize", w.height())
w.hide()
w.toggleViewAction().setVisible(False)

View File

@@ -54,20 +54,19 @@ class BIM_Views:
mw = FreeCADGui.getMainWindow()
st = mw.statusBar()
statuswidget = st.findChild(QtGui.QToolBar, "BIMStatusWidget")
if statuswidget:
if hasattr(statuswidget, "bimviewsbutton"):
bimviewsbutton = statuswidget.bimviewsbutton
if statuswidget and hasattr(statuswidget, "bimviewsbutton"):
bimviewsbutton = statuswidget.bimviewsbutton
if vm:
if vm.isVisible():
vm.hide()
if bimviewsbutton:
bimviewsbutton.setChecked(False)
PARAMS.SetBool("RestoreBimViews", False)
PARAMS.SetBool("RestoreBimViews", False)
else:
vm.show()
if bimviewsbutton:
bimviewsbutton.setChecked(True)
PARAMS.SetBool("RestoreBimViews", True)
PARAMS.SetBool("RestoreBimViews", True)
self.update()
else:
vm = QtGui.QDockWidget()
@@ -76,6 +75,7 @@ class BIM_Views:
self.dialog = FreeCADGui.PySideUic.loadUi(":/ui/dialogViews.ui")
vm.setWidget(self.dialog)
vm.tree = self.dialog.tree
vm.closeEvent = self.onClose
# set context menu
self.dialog.tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
@@ -159,6 +159,15 @@ class BIM_Views:
self.update()
def onClose(self, event):
from PySide import QtGui
st = FreeCADGui.getMainWindow().statusBar()
statuswidget = st.findChild(QtGui.QToolBar, "BIMStatusWidget")
if statuswidget and hasattr(statuswidget, "bimviewsbutton"):
statuswidget.bimviewsbutton.setChecked(False)
PARAMS.SetBool("RestoreBimViews", False)
def connectDock(self):
"watch for dock location"