Skip to content

Commit 385f750

Browse files
committed
Fix error dialig during activation from commandline (FreeCAD Ribbon)
1 parent 09b7ed7 commit 385f750

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

FastenerBase.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,18 @@ def FSGetToolbarItem(tname, iname):
238238
"""Get instance of a toolbar item."""
239239
mw = QtGui.QApplication.activeWindow()
240240
tb = None
241-
for c in mw.children():
242-
if isinstance(c, QtGui.QToolBar) and c.windowTitle() == tname:
243-
tb = c
244-
break
245-
if tb is None:
246-
return None
247-
for c in tb.children():
248-
if isinstance(c, QtGui.QToolButton) and c.text() == iname:
249-
return c
241+
try
242+
for c in mw.children():
243+
if isinstance(c, QtGui.QToolBar) and c.windowTitle() == tname:
244+
tb = c
245+
break
246+
if tb is None:
247+
return None
248+
for c in tb.children():
249+
if isinstance(c, QtGui.QToolButton) and c.text() == iname:
250+
return c
251+
except Exception as e:
252+
FreeCAD.Console.PrintError(e)
250253
return None
251254

252255

0 commit comments

Comments
 (0)