def create_toolbar(self, toolbar_id): """ Create and add an auxiliary toolbar to the top of the plugin. Parameters ---------- toolbar_id: str Unique toolbar string identifier. Returns ------- SpyderPluginToolbar The auxiliary toolbar that was created and added to the plugin interface. """ toolbar = MainWidgetToolbar(parent=self) toolbar.ID = toolbar_id TOOLBAR_REGISTRY.register_reference( toolbar, toolbar_id, self.PLUGIN_NAME, self.CONTEXT_NAME) self._auxiliary_toolbars[toolbar_id] = toolbar self._toolbars_layout.addWidget(toolbar) return toolbar
def create_toolbar(self, toolbar_id): """ Create and add an auxiliary toolbar to the top of the plugin. Parameters ---------- toolbar_id: str Unique toolbar string identifier. Returns ------- SpyderPluginToolbar The auxiliary toolbar that was created and added to the plugin interface. """ if toolbar_id in self._toolbars: raise SpyderAPIError( 'Toolbar "{}" already exists!'.format(toolbar_id)) toolbar = MainWidgetToolbar(parent=self) toolbar.ID = toolbar_id self._toolbars[toolbar_id] = toolbar self._auxiliary_toolbars[toolbar_id] = toolbar self._toolbars_layout.addWidget(toolbar) return toolbar