Puede usar la llamada a la API addToolBar () a través de QgisInterface (es decir, iface) para crear una barra de herramientas personalizada:
class MyPlugin:
def __init__(self, iface):
# Save reference to the QGIS interface
self.iface = iface
def initGui(self):
# Add toolbar
self.toolbar = self.iface.addToolBar("My_ToolBar")
# Create actions
self.someact = QAction(QIcon(":/plugins/MyPlugin/icons/someactionicon.png"),
QCoreApplication.translate("MyPlugin", "My Action"),
self.iface.mainWindow())
# Connect action signals to slots
self.someact.triggered.connect(self.doSomething)
# Add actions to the toolbar
self.toolbar.addAction(self.someact)
def unload(self):
# remove toolbar on plugin unload
del self.toolbar
def doSomething(self):
# slot for action
pass