I created a plugin using QGIS Plugin Builder Plugin using the Template Tool Button with dock widget. Works fine, but I have to click the associated button each time I start QGIS in order to open the dock widget.
Question: How can I make QGIS open the dock widget at each start, or at least remind its state like those of the core plugins (GPS Information Panel for example)?
Then in the function which is associated with the button (in the example, run(self)), use some logic to hide everything excluding your plugin toolbar and dockwidget:
# Set toolbars visibility to False
for x in iface.mainWindow().findChildren(QToolBar):
if x.objectName() == 'Run_plugin':
# Set panels visibility to False
for x in iface.mainWindow().findChildren(QDockWidget):
# Define your dockwidget from its class
self.dockwidget = PluginDockWidget()
# Make your dockwidget visible
Create a startup.py script and use something like the following:
from qgis.utils import iface
from PyQt4.QtGui import QAction
Once QGIS has fully loaded, it will trigger the button from your plugin toolbar which should then hide everything excluding your plugin toolbar and dockwidget.
self.run()function into the
__init__of your plugin. However be aware, that functionality will work but QGIS won't open its own GUI till you close your plugin