Quote:
Originally Posted by kovidgoyal
Load the icons in your plugins as
I('plugin_name/image.png')
and they will automatically come from the configresources directory if present.
|
Please can you clarify the use of I('plugin_name/image.png') using this real-life example? I'm not clear where the 'I' goes related to 'get_icons'. Nor am I sure exactly what dir structure to use for the custom icons.
Note: Non-techies may want to skip this post ...
I have a plugin named 'TTS to MP3'. It's located as a .zip in
config/plugins/TTS to MP3.zip.
Inside the .zip is:
- a mandatory plugin .txt file (plugin-import-name-tts_to_mp3_plugin.txt)
- plugin icons are now in their own subdirectory (TTS to MP3), but I've always used the name images in the past.
In the plugin genesis() I have:
Code:
self.icons = get_icons(['TTS to MP3/plugin_icon.png',
'TTS to MP3/play.png',
'TTS to MP3/stop.png'])
self.qaction.setIcon(get_icons('TTS to MP3/plugin_icon.png'))
and if I want to use an icon somewhere in the plugin GUI, something like
Code:
button.setIcon(get_icons('TTS to MP3/play.png'))
I've copied a customised icon to:
Code:
config/resources/images/TTS to MP3/plugin_icon.png
So what needs to change above? Where do I use the 'I' and is the custom icon config directory location correct?