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"
|
pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar"
|
||||||
pTB = FreeCAD.ParamGet(pathTB)
|
pTB = FreeCAD.ParamGet(pathTB)
|
||||||
n = 1
|
n = 1
|
||||||
while n and n < 999:
|
while n < 30:
|
||||||
group = "Custom_" + str(n)
|
group = "Custom_" + str(n)
|
||||||
if pTB.HasGroup(group):
|
if pTB.HasGroup(group):
|
||||||
if pTB.GetGroup(group).GetString("Name") == "Selector":
|
if pTB.GetGroup(group).GetString("Name") == "Selector":
|
||||||
pTB.RemGroup(group)
|
pTB.RemGroup(group)
|
||||||
n += 1
|
n += 1
|
||||||
else:
|
|
||||||
n = None
|
|
||||||
|
|
||||||
# Create toolbar.
|
# Create toolbar.
|
||||||
pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar/Selector"
|
pathTB = "User parameter:BaseApp/Workbench/Global/Toolbar/Selector"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user