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.
This commit is contained in:
triplus 2017-12-21 18:44:25 +01:00 committed by GitHub
parent 3ac692a452
commit c96a562df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"