File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -238,15 +238,18 @@ def FSGetToolbarItem(tname, iname):
238
238
"""Get instance of a toolbar item."""
239
239
mw = QtGui .QApplication .activeWindow ()
240
240
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 )
250
253
return None
251
254
252
255
You can’t perform that action at this time.
0 commit comments