View Single Post
Old 04-09-2011, 05:07 AM   #2
kiwidude
calibre/Sigil 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,220
Karma: 1333994
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
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 online now   Reply With Quote