From 3ac692a4526f4cc2349bdef4c198f77d9d4aa914 Mon Sep 17 00:00:00 2001 From: triplus Date: Thu, 21 Dec 2017 18:01:03 +0100 Subject: [PATCH] Delete duplicate toolbars Duplicate toolbars can be added by customize dialog (reported by @DeepSOIC): https://forum.freecadweb.org/viewtopic.php?f=10&t=25945&start=10#p205190 --- InitGui.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/InitGui.py b/InitGui.py index 57c3982..67e22c9 100644 --- a/InitGui.py +++ b/InitGui.py @@ -23,6 +23,19 @@ p = FreeCAD.ParamGet("User parameter:BaseApp/SelectorToolbar") if p.GetBool("Enabled", 1): + # Delete duplicate toolbars (can be added by customize dialog). + pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar" + pTB = FreeCAD.ParamGet(pathTB) + n = 1 + while n and n < 999: + group = "Custom_" + str(n) + if pTB.HasGroup(group): + if pTB.GetGroup(group).GetString("Name") == "Selector": + pTB.RemGroup(group) + n += 1 + else: + n = None + # Create toolbar. pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar/Selector" pTB = FreeCAD.ParamGet(pathTB)