View Single Post
Old 12-08-2019, 03:50 PM   #38
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by kovidgoyal View Post
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?
jackie_w is offline   Reply With Quote