Ciao a tutti!<br>Sto scrivendo un plugin e sto seguendo le indicazioni del sito <a href="http://www.qgis.org/wiki/Writing_Python_Plugins">http://www.qgis.org/wiki/Writing_Python_Plugins</a><br>I problema sono vari: non riesco ad associare un'icona (penso di mettere il percorso giusto, l'icona si trova nella cartella del mio pluging e al posto di testplug sostituisco il nome del mio plug/nome dell'icona.png ma niente...dove sbaglio???)<br>
Inoltre nel run (6 ultima riga) durante il print mi dà errore d'indentazione ma è la stessa del renderTest dove non ottengo alcun errore. <br>Potete aiutarmi? vi riporti il codice di seguito e grazie in anticipo<br><pre>
#!python<br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br>from qgis.core import *<br># initialize Qt resources from file resouces.py<br>import resources<br>class TestPlugin:<br> def __init__(self, iface):<br>
   # save reference to the QGIS interface<br>   self.iface = iface<br> def initGui(self):<br>   # create action that will start plugin configuration<br>   self.action = QAction(QIcon(<span style="background-color: rgb(255, 255, 102);">":/plugins/testplug/icon.png"</span>), "Test plugin", self.iface.mainWindow())<br>
   self.action.setWhatsThis("Configuration for test plugin")<br>   self.action.setStatusTip("This is status tip")<br>   QObject.connect(self.action, SIGNAL("triggered()"), self.run)<br>   # add toolbar button and menu item<br>
   self.iface.addToolBarIcon(self.action)<br>   self.iface.addPluginToMenu("&Test plugins", self.action)<br>   # connect to signal renderComplete which is emitted when canvas rendering is done<br>   QObject.connect(self.iface.mapCanvas(), SIGNAL("renderComplete(QPainter *)"), self.renderTest)<br>
 def unload(self):<br>   # remove the plugin menu item and icon<br>   self.iface.removePluginMenu("&Test plugins",self.action)<br>   self.iface.removeToolBarIcon(self.action)<br>   # disconnect form signal of the canvas<br>
   QObject.disconnect(self.iface.MapCanvas(), SIGNAL("renderComplete(QPainter *)"), self.renderTest)<br> def run(self):<br>   # create and show a configuration dialog or something similar<br>  <span style="background-color: rgb(255, 255, 102);"> print "TestPlugin: run called!"</span><br>
 def renderTest(self, painter):<br>   # use painter for drawing to map canvas<br>   print "TestPlugin: renderTest called!"<br></pre><br clear="all"><br>-- <br>Michela<br>