Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 04-09-2011, 12:57 AM   #1
Steppa
Junior Member
Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.
 
Posts: 7
Karma: 366
Join Date: Mar 2011
Device: Nook Color
How do I change Plugin Images/Icons?

I have managed to "skin" Calibre by changing the icons using in:

AppData/Roaming/calibre/resources/images folder

However I was only able to change the main GUI icons. Where would I place the icons for the plugins?
If I place my new plugin icons in the resources / images folder Calibre does not recognise them.

Appreciate the help.
Steppa is offline   Reply With Quote
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,601
Karma: 2092290
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
Advert
Old 04-09-2011, 08:37 AM   #3
Steppa
Junior Member
Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.
 
Posts: 7
Karma: 366
Join Date: Mar 2011
Device: Nook Color
Funny as I actually tried this thinking that I mis-undertood the procedure for skinning but off course it didn't work.

I hope that you and the other plugin developers can implement this solution. This will make it simple for skinners like us to easily share icon packages with everyone.

Thanks for your quick response.
Steppa is offline   Reply With Quote
Old 04-09-2011, 09:12 PM   #4
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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Ok, I've just released new versions of all of my plugins so they will support the possibility of skinning. Give me a yell if you experience any issues with that but it seemed to work ok from my quick testing.

Clearly there are other UI plugins by other developers that will not as yet made changes to support skinning in this way. Whether they do or not is obviously up to them and if/when they plan to release a new version.

To the other plugin developers - if you want to just "borrow" code, take a look in any of my UI plugins at the top of common_utils.py at these functions (with two variables plugin_name and plugin_icon_resources). I am sure you can simplify them if you want to but I re-use each of these functions individually for other purposes too.
Code:
set_plugin_icon_resources()
get_icon()
get_pixmap()
get_local_images_dir()
The assumption I make in all my plugins is that all images will exist within an images subfolder within the zip, so any request to get_icon or get_pixmap that starts with "images/" is believed to be for plugin icon.

The initialisation of the resources for the plugin is in the InterfaceAction derived class in action.py in the genesis method, with code like this:
Code:
from calibre_plugins.foo.common_utils import set_plugin_icon_resources, get_icon
PLUGIN_ICONS = ['images/foo.png']
...
    def genesis(self):
        ...
        icon_resources = self.load_resources(PLUGIN_ICONS)
        set_plugin_icon_resources(self.name, icon_resources)
        ...
Then anywhere I need an icon, I just use:
Code:
    image=get_icon('images/foo.png')
And as described in post 2 above, it will first look in the local Calibre resource images folder for a subfolder of the plugin name for that icon, and if not then use that found from resources loaded from the zip.

Hope that helps.
kiwidude is offline   Reply With Quote
Old 04-14-2011, 08:14 AM   #5
Steppa
Junior Member
Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.
 
Posts: 7
Karma: 366
Join Date: Mar 2011
Device: Nook Color
This works great. Thank you very much.
Steppa is offline   Reply With Quote
Advert
Old 04-14-2011, 02:44 PM   #6
Steppa
Junior Member
Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.Steppa has a complete set of Star Wars action figures.
 
Posts: 7
Karma: 366
Join Date: Mar 2011
Device: Nook Color
Here is a preview:

Last edited by WT Sharpe; 04-14-2011 at 06:17 PM. Reason: Graphics way too large (removed).
Steppa is offline   Reply With Quote
Old 04-15-2011, 02:59 AM   #7
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Quote:
Originally Posted by kiwidude View Post
To the other plugin developers - if you want to just "borrow" code...
Code borrowed Works great. Thanks.
meme is offline   Reply With Quote
Old 01-22-2013, 05:19 PM   #8
Riva3000
Calibre fan
Riva3000 began at the beginning.
 
Riva3000's Avatar
 
Posts: 30
Karma: 10
Join Date: Jul 2011
Location: Europe
Device: iRex 800SG, iPhone 3GS (shelved: iRex iLiad, KindleDX, Adam tablet)
I just started skinning (updated a Metro icons pack) and hit this.
Thanks for the plugins updates !

Maybe a list of (3rd party) plugins that support skinning ?
And / or update of this plugin list with indicatinon of which plugin supports icon skinning already ?
(please )
Riva3000 is offline   Reply With Quote
Old 01-22-2013, 06:37 PM   #9
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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@Riva3000 - I would be surprised if there are many UI plugins here at MobileRead that do *not* support skinning. As the majority are either mine, or are based on code from one of my plugins. The only way to know is to either try it or take a look at the plugin code.
kiwidude is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM
Is there a way to change the "sleep" images on my Kindle 3? Cordanim Amazon Kindle 7 03-11-2011 11:25 PM
Create area for plugin images in config directory DoctorOhh Plugins 19 12-15-2010 12:28 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM
Sony Reader Icons, Other Reader Icons and much more! TheHeartlessHero Deals and Resources (No Self-Promotion or Affiliate Links) 27 11-21-2008 06:21 AM


All times are GMT -4. The time now is 11:41 AM.


MobileRead.com is a privately owned, operated and funded community.