Monday, 27 November 2017

Changing QGIS plugin's icon, why doesn't it change in the menu/toolbar?


I've been writing a QGIS plugin (using the "Plugin Builder" plugin), and decided I wanted to change the icon (icon.png).


After running make deploy to rebuild the plugin locally, the new icon appears in the Plugin Manager (both in the list of plugins, and the plugin description panel). So far, so good.


However, the old icon persists in the menu, and toolbar icons.


I've established that the icon.png is correct in the metadata.txt, and is getting copied into my ~/.qgis/python/plugins/myplugin directory.


This is especially puzzling - I'm not replacing the default plugin icon, but an icon I previously created to replace the default plugin icon. So this has worked before... :/


I've tried these...




  • restarting QGIS

  • uninstall, then reinstall plugin using plugin manager

  • destroy the plugin using make derase followed by make deploy

  • reload the plugin using the "Plugin reloader" plugin


Does QGIS cache icons somewhere? That's the only explanation I can think of. If it does, is there any way to flush the cache?


I'm using QGIS 2.10.1 Pisa on Ubuntu 14.04. I'm using "Plugin Builder" version 2.8.3


I suspect it won't be a problem for anyone who hasn't installed the plugin before, but it's a bit strange.



Answer




Your plugin icon was converted to a byte array and saved in resources.py


So if you want to change this icon you have to compile your resources again:


pyrcc4 -o resources.py resources.qrc 

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...