Graphics Reference
In-Depth Information
cp -vf $(RESOURCE_FILES) $(HOME)/.qgis2/python/plugins/
$(PLUGINNAME)
cp -vf $(EXTRAS) $(HOME)/.qgis2/python/plugins/
$(PLUGINNAME)
clean:
rm $(RESOURCE_FILES)
You may need to modify the paths in this file to suit your development setup. Notice that
because our plugin won't have any UI templates, we've removed the portions of the Make-
file that compile and deploy the template files.
Now that we've created the framework for our plugin, let's start writing the code that does
the actual work. The final file we need for our plugin will be named geo-
metryInfo.py . Create this file and put the following code into it:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import resources
from qgis.core import *
from qgis.gui import *
class GeometryInfoPlugin:
def __init__(self, iface):
self.iface = iface
def initGui(self):
icon = QIcon(":/plugins/geometryInfo/icon.png")
self.action = QAction(icon, "Get Geometry Info",
self.iface.mainWindow())
QObject.connect(self.action, SIGNAL("triggered()"),
self.onClick)
self.iface.addPluginToMenu("Geometry Info", self.action)
self.iface.addToolBarIcon(self.action)
def unload(self):
self.iface.removePluginMenu("Geometry Info",
self.action)
self.iface.removeToolBarIcon(self.action)
Search WWH ::




Custom Search