From c96a562df6ef6f40769404b981e481df8a2526a3 Mon Sep 17 00:00:00 2001 From: triplus Date: Thu, 21 Dec 2017 18:44:25 +0100 Subject: [PATCH] More robust duplicate toolbars detection More then one module can do the same check. It can lead to race condition. Better to check through a range of possible custom toolbars groups. --- InitGui.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/InitGui.py b/InitGui.py index 67e22c9..811a401 100644 --- a/InitGui.py +++ b/InitGui.py @@ -27,14 +27,12 @@ if p.GetBool("Enabled", 1): pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar" pTB = FreeCAD.ParamGet(pathTB) n = 1 - while n and n < 999: + while n < 30: group = "Custom_" + str(n) if pTB.HasGroup(group): if pTB.GetGroup(group).GetString("Name") == "Selector": pTB.RemGroup(group) - n += 1 - else: - n = None + n += 1 # Create toolbar. pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar/Selector"