[Qgis-developer] Programmatically enable a python plugin.
Martin Dobias
wonder.sk at gmail.com
Thu Apr 8 17:05:39 EDT 2010
On Thu, Apr 8, 2010 at 5:33 PM, Stefan Kiefer <st_kiefer at web.de> wrote:
> For me it worked like this:
>
> settings=QSettings()
> settings.setValue('PythonPlugins/yourplugin', QVariant(True))
>
> where you must replace "yourplugin" with the class name of your plugin in
> lower case!
Just to add, when the above code is run, it only stores in settings
that "yourplugin" should be loaded next time.
Development version (svn trunk, will be 1.5) has a better way to
directly load and start a plugin:
import qgis.utils
qgis.utils.loadPlugin("myplugin")
qgis.utils.startPlugin("myplugin")
The first call makes sure the plugin is loaded, the second one
actually starts it. There are few more methods for playing with
plugins, such as isPluginLoaded or unloadPlugin.
Martin
More information about the Qgis-developer
mailing list