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:
parent
3ac692a452
commit
c96a562df6
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user