Graphics Reference
In-Depth Information
A copy of this icon is available with the sample code that comes with this topic, though
you can create your own icon or find a different one to use somewhere; just make sure
that the resulting image file is named
icon.png
, and that the icon is 24 x 24 pixels.
Place this file into your
geometryInfo
directory along with the other files.
We next need to define the
resources.qrc
file that tells QGIS about our icon. Create
this file and put the following text into it:
<RCC>
<qresource prefix="/plugins/geometryInfo">
<file>icon.png</file>
</qresource>
</RCC>
Finally, let's create a Makefile to automate the process of compiling and deploying our
plugin. Here's a suitable Makefile to get you started:
PLUGINNAME = geometryInfo
PY_FILES = geometryInfo.py __init__.py
EXTRAS = icon.png metadata.txt
RESOURCE_FILES = resources.py
default: compile
compile: $(RESOURCE_FILES)
%.py : %.qrc
pyrcc4 -o $@ $<
deploy: compile
mkdir -p $(HOME)/.qgis2/python/plugins/$(PLUGINNAME)
cp -vf $(PY_FILES) $(HOME)/.qgis2/python/plugins/
$(PLUGINNAME)