Understanding the QGIS plugin architecture
As we saw in Chapter 1, Getting Started with QGIS, QGIS plugins are stored as Python packages in the ~/.qgis2/python/plugins
directory.
Tip
Depending on your operating system and the version of QGIS you're using, the .qgis2
directory might be named .qgis
.
The plugin's package includes a number of Python modules and other files. At a minimum, the plugin package must include:
__init__.py
: This is a package initialization module that contains the class factory function, which creates and initializes the plugin.metadata.txt
: This is a text file that contains information about the plugin, including the plugin's version number, the name of the plugin, and the plugin's author.
In addition, most plugins will include:
A separate Python module that contains a class definition for the plugin. The plugin class implements a number of specially named methods that get called to start up and shut down the plugin.
One or more user-interface template files with the extension...