From ca0630aa5091aa85557235b7e05e14172d3dd1eb Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Sun, 11 May 2025 14:15:51 +0200 Subject: [PATCH] BIM: close BIM_Library task panel on doc close Fixes #21179. This PR uses the built-in solution to close the task panel. I was not aware of this feature before. My 2 previous PRs related to the closing of task panels, #20719 and #21073, will (largely) have to be reverted/redone in favor of this solution. --- src/Mod/BIM/bimcommands/BimLibrary.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mod/BIM/bimcommands/BimLibrary.py b/src/Mod/BIM/bimcommands/BimLibrary.py index 3fe049503d..717fc59ec4 100644 --- a/src/Mod/BIM/bimcommands/BimLibrary.py +++ b/src/Mod/BIM/bimcommands/BimLibrary.py @@ -105,7 +105,9 @@ class BIM_Library: # save file paths with forward slashes even on windows pr.SetString("destination", addondir.replace("\\", "/")) libok = True - FreeCADGui.Control.showDialog(BIM_Library_TaskPanel(offlinemode=libok)) + task = FreeCADGui.Control.showDialog(BIM_Library_TaskPanel(offlinemode=libok)) + task.setDocumentName(FreeCAD.ActiveDocument.Name) + task.setAutoCloseOnDeletedDocument(True) class BIM_Library_TaskPanel: