PostGIS Raster : Extending PostgreSQL for The Support of ... - CoDE
PostGIS Raster : Extending PostgreSQL for The Support of ... - CoDE
PostGIS Raster : Extending PostgreSQL for The Support of ... - CoDE
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Appendix B<br />
Python Plugin in QGIS<br />
B.1 Necessary Files<br />
<strong>The</strong> directory structure <strong>of</strong> a plugin is as follows:<br />
PYTHON_PLUGINS_PATH/<br />
testplug/<br />
__init__.py<br />
plugin.py<br />
metadata.txt<br />
resources.qrc<br />
resources.py<br />
<strong>for</strong>m.ui<br />
<strong>for</strong>m.py<br />
Where:<br />
__init__.py: contains some basic in<strong>for</strong>mation about the plugin such as its name, version and<br />
main class.<br />
plugin.py: plugin body that contains main code <strong>for</strong> all the actions describing the plugin.<br />
metadata.txt: Required <strong>for</strong> QGIS >= 1.8.0. Contains general in<strong>for</strong>mation, version, name and<br />
some other metadata used by plugins website and plugin infrastructure. Metadata in metadata.txt is<br />
preferred to the methods in __init__.py. From QGIS 2.0 the metadata from __init__.py will not<br />
be accepted and the metadata.txt file will be required.<br />
resources.qrc: a .xml document containing relative paths to resources <strong>of</strong> the <strong>for</strong>ms.<br />
resources.py: <strong>The</strong> translation <strong>of</strong> the resources.qrc file to Python.<br />
<strong>for</strong>m.ui: a <strong>for</strong>m in QT-Designer with its resources.qrc.<br />
<strong>for</strong>m.py: <strong>The</strong> translation <strong>of</strong> the <strong>for</strong>m.ui file to Python.<br />
<strong>The</strong>re are also two automated ways <strong>of</strong> creating the basic files (or skeleton) <strong>of</strong> a typical QGIS Python<br />
plugin: the first one using a QGIS Plugin Builder and the second one come from a web application.<br />
B.2 Python Code<br />
B.2.1 __init__.py<br />
def name():<br />
return "My testing plugin"<br />
def description():<br />
return "This plugin has no real use."<br />
def version():<br />
89