View Single Post
Old 04-09-2011, 05:07 AM   #2
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Hi Steppa, welcome to MobileRead.

I'm afraid AFAIK the only way to replace images for plugins currently is to place them inside the plugin zip itself. I know that all my plugins (and likely many others which were based on code I used) retrieve all the icons from the zip file into memory when they start up. Then when the plugin code asks for an icon to retrieve it first checks the memory cache if found in there, and if not falls back to looking in Calibre's resource folders. Unfortunately that is the wrong order that you would want for skinning.

To support that I would need to change all the plugins. I would also want to put in place some standard like using the plugin name as a subfolder both to ensure image names remain unique and to make it easier for people skinning to keep a set of icons for a plugin together.

So for example the Goodreads Sync plugin currently loads all it's plugin specific images from an images subfolder within the zip file, like "images/add_to_shelf.png".

To override this icon, you would place your new png in this folder:
AppData/Roaming/calibre/resources/images/Goodreads Sync/

Then I would have my plugin code that is being asked for an icon check to see if it is being asked with an "images/" prefix, e.g. "images/xxx.png". If it is, then it would first check the Calibre resources folder using "Goodreads Sync/xxx.png". If not found there, it would fall back to retrieving it from the resources retrieved from the zip.

Perhaps the other plugin developers or Kovid may have an improved suggestion on this. It is a fair bit of work to re-release all my plugins yet again so I only want to do this once.
kiwidude is offline   Reply With Quote