#1 Mon 30 May 2016 15:25
- Ferreira_Guillaume
- Participant occasionnel
- Date d'inscription: 19 Jan 2015
- Messages: 10
QGIS & Plugin python: icone barre d'outils
Bonjour,
Voici mon problème , j'arrive à la fin de la conception de mon plugin, mais j'ai un problème plutôt gênant. Dans la barre d'outils, je n arrive toujours pas à faire apparaitre l icon souhaité , à vrai dire je n arrive à rien afficher d ailleurs. ( image en pièce jointe )
Si j'ai bien compris, l'adresse de l image que l 'on veux, doit être changer dans ma class principale comme ceci :
Code:
def __init__(self, iface):
# Save reference to the QGIS interface
self.iface = iface
def initGui(self):
# Create action that will start plugin configuration
self.action = QAction(QIcon(":/plugins/Bio/icon.png"), \
"Bio", self.iface.mainWindow())
# connect the action to the run method
QObject.connect(self.action, SIGNAL("activated()"), self.run)
# Add toolbar button and menu item
self.iface.addToolBarIcon(self.action)
self.iface.addPluginToMenu("&Bio", self.action)
def unload(self):
# Remove the plugin menu item and icon
self.iface.removePluginMenu("&Bio",self.action)
self.iface.removeToolBarIcon(self.action)
# run method that performs all the real work
def run(self):
# create and show the dialog
dlg = BioDialog()
# show the dialog
dlg.show()
result = dlg.exec_()
# See if OK was pressed
if result == 1:
# do something useful (delete the line containing pass and
# substitute with your code
passSeulement rien ne change , toujours rien. Pourquoi ?
Hors ligne
#2 Mon 30 May 2016 16:48
- romainbh
- Participant assidu
- Date d'inscription: 20 Aug 2013
- Messages: 355
Re: QGIS & Plugin python: icone barre d'outils
Hello,
Et en supprimant les ":" au début de l'adresse ? Comme ceci :
Code:
"/plugins/Bio/icon.png"
À tout hasard...
Hors ligne
#3 Mon 30 May 2016 16:54
- Ferreira_Guillaume
- Participant occasionnel
- Date d'inscription: 19 Jan 2015
- Messages: 10
Re: QGIS & Plugin python: icone barre d'outils
Merci, non je n 'ai pas eu besoin de supprimer ":" . J'ai recompilé le fichier ressources avec cette commande :
Code:
pyrcc4 -o resources.py resources.qrc
avec la console OSGeo4W qui ce trouve dans le fichier ou est installé Qgis .
Dernière modification par Ferreira_Guillaume (Mon 30 May 2016 17:07)
Hors ligne


