04-09-2011, 12:57 AM | #1 |
Junior Member
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. |
04-09-2011, 05:07 AM | #2 |
calibre/Sigil Developer
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. |
Advert | |
|
04-09-2011, 08:37 AM | #3 |
Junior Member
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. |
04-09-2011, 09:12 PM | #4 |
calibre/Sigil Developer
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 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) ... Code:
image=get_icon('images/foo.png') Hope that helps. |
04-14-2011, 08:14 AM | #5 |
Junior Member
Posts: 7
Karma: 366
Join Date: Mar 2011
Device: Nook Color
|
This works great. Thank you very much.
|
Advert | |
|
04-14-2011, 02:44 PM | #6 |
Junior Member
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). |
04-15-2011, 02:59 AM | #7 |
Sigil developer
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
|
01-22-2013, 05:19 PM | #8 |
Calibre fan
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 ) |
01-22-2013, 06:37 PM | #9 |
calibre/Sigil Developer
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.
|
Thread Tools | Search this Thread |
|
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 |