Skip to content

Commit

Permalink
fix: avoid duplicate toolbar creation. #28
Browse files Browse the repository at this point in the history
  • Loading branch information
knipknap committed Apr 29, 2024
1 parent e35c232 commit e603362
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions btl/ui/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ def on_workbench_activated(workbench):
if workbench not in ('PathWorkbench', 'CAMWorkbench'):
return

# Create a toolbar.
# Create a toolbar if it does not yet exist.
tb_name = "btl_toolbar"
mw = FreeCADGui.getMainWindow()
toolbar = mw.findChild(QtGui.QToolBar, tb_name)
if toolbar:
return
toolbar = QtGui.QToolBar(mw)
toolbar.setObjectName("btl_toolbar")
toolbar.setObjectName(tb_name)
mw.addToolBar(toolbar)

# Add the library editor button.
Expand Down

0 comments on commit e603362

Please sign in to comment.