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 12-15-2010, 04:59 AM   #1
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Create area for plugin images in config directory

Update: This feature already exists.

All that was needed was for me to create a resources\images path under my calibre configuration directory and move the plugin thumbnails there.

Update Complete

Recently the ability to create GUI plugins was added to calibre. Many of these plugins add thumbnails to the Calibre2\resources\images folder. This works great but has one drawback. Previously all plugins, tweaks, and settings were stored in the calibre config directory. This meant I could run calibre from any computer and point to this configuration and have the exact same setup from every computer. Now the thumbnail images are hanging out in a separate spot and have to be accounted for or updated on each computer.

I don't know how feasible this is but it would be convenient if there was a image area in the config directory where the added plugins could stash their thumbnails. Thus keeping all updated configuration files in the configuration directory.

If this is something worth doing I'll be glad to create the ticket (most I can do given my programming knowledge is nil).

Last edited by DoctorOhh; 12-15-2010 at 06:30 AM.
DoctorOhh is offline   Reply With Quote
Old 12-15-2010, 05:50 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Can't the images be put into the config_dir\resources\images, like the other image replacements?
chaley is offline   Reply With Quote
Advert
Old 12-15-2010, 05:50 AM   #3
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
I'd love to have some way to keep the plugin as self contained as possible. I was reluctant to add icons to menus for the messiness it adds to installation. If it was possible for the plugin zip file to contain not just the .py code file but also the images it needs and then Calibre does "whatever it has to" after that when you install a plugin would be ideal from my perspective.
kiwidude is offline   Reply With Quote
Old 12-15-2010, 05:56 AM   #4
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by kiwidude View Post
I'd love to have some way to keep the plugin as self contained as possible. I was reluctant to add icons to menus for the messiness it adds to installation. If it was possible for the plugin zip file to contain not just the .py code file but also the images it needs and then Calibre does "whatever it has to" after that when you install a plugin would be ideal from my perspective.
That sounds like a very good solution, because it would also minimize installation on the user end of things. Just importing a new plugin is way easier than also having to copy the needed graphics files into some directory.
Manichean is offline   Reply With Quote
Old 12-15-2010, 06:16 AM   #5
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
If there is a solution for both fully self-contained plugin zips (a simple menu item with an icon) and user configurable plugins (like search the internet, where users want to also be able to add their own images after the plugin is installed) that sounds good to me.

What is config_dir\resources\images ? Not come across that before?
kiwidude is offline   Reply With Quote
Advert
Old 12-15-2010, 06:19 AM   #6
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by chaley View Post
Can't the images be put into the config_dir\resources\images, like the other image replacements?
My configuration folder doesn't have a resources\images folder. If this is a proper alternative then my question is moot.

I created the path you mentioned and moved the plugin thumbnails. Then I started calibre and the thumbnails were in the menu as expected. Unless calibre somehow caches these thumbnails I guess all that is needed is to change the directions of the plugin posts to reflect placing these images in the config\resources\images folder.

Thanks Chaley for the scoop.
DoctorOhh is offline   Reply With Quote
Old 12-15-2010, 06:21 AM   #7
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
What is config_dir\resources\images ? Not come across that before?
If you create a parallel resources directory tree in your calibre configuration directory and put some things in it, then calibre will use those things in preference over the other resource directories (source, then binary). This was done during the foohaa about toolbar icons so that people could use their own images, but it works in general. For example, I have used it to debug javascript used by calibre's server.

Last edited by chaley; 12-15-2010 at 07:10 AM.
chaley is offline   Reply With Quote
Old 12-15-2010, 07:03 AM   #8
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
Hmmm, ok, that is good to know. I did as dwanthny did of creating a resources\images subfolder, moving all the stip_* images in there, removed them from my other directories (Program Files and source code), restarted Calibre and the Search the Internet plugin worked fine. So no coding changes needed.

However before I update any instructions for gui plugins that still leaves my suggestion about installing a plugin. I think it would be nice if when you install it checks the zip for any images and if present puts them in this resources\images folder for you, to remove the manual steps.

Does such functionality exist already, or should I create a ticket?
kiwidude is offline   Reply With Quote
Old 12-15-2010, 07:06 AM   #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
Quote:
Originally Posted by chaley View Post
This was done during the foohaa about toolbar icons so that people could use their own images, but it works in general.
Again nice to know, thanks. That icon Calibre has for "trash" gives me the willies, it looks like a Refresh button. And yeah I know it is meant to symbolise "Recycle" but as Calibre has zero undo capabilities that is misleading too. Clearly my brain works in mysterious ways...
kiwidude is offline   Reply With Quote
Old 12-15-2010, 08:19 AM   #10
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,496
Karma: 424697
Join Date: Mar 2009
Device: iPad
Quote:
Originally Posted by kiwidude View Post
However before I update any instructions for gui plugins that still leaves my suggestion about installing a plugin. I think it would be nice if when you install it checks the zip for any images and if present puts them in this resources\images folder for you, to remove the manual steps.

Does such functionality exist already, or should I create a ticket?
Why not add code in genesis() that does this?

G
GRiker is offline   Reply With Quote
Old 12-15-2010, 08:28 AM   #11
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
Quote:
Originally Posted by GRiker View Post
Why not add code in genesis() that does this?

G
Because it would be code repeated in every single plugin anyone writes.
kiwidude is offline   Reply With Quote
Old 12-15-2010, 09:22 AM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
self.plugin_path in the plugin points to the zip file. You can add code to genesis() to load images from the zip file. If you're worried about it becoming necessary for every plugin, write the code for one of your plugins and send it to me, I'll put it into a method in the GUI plugin base class so other plugins can use it easily.
kovidgoyal is offline   Reply With Quote
Old 12-15-2010, 10:11 AM   #13
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
Quote:
Originally Posted by kovidgoyal View Post
self.plugin_path in the plugin points to the zip file. You can add code to genesis() to load images from the zip file. If you're worried about it becoming necessary for every plugin, write the code for one of your plugins and send it to me, I'll put it into a method in the GUI plugin base class so other plugins can use it easily.
Ok, I'll have a stab at doing it that way. Though I'm still not convinced that inside the plugin is the right place for this code, as it means it will execute every time Calibre starts up which sounds unnecessary overhead? Particularly given the work you are doing trying to speed up Calibre load times. I would have thought this is an activity that as it only needs to be run once and hence should do so only when the plugin is installed?

But if that's the only accepted approach so be it. If I try to write it generically, can you give me any hints as to the sort of api/behaviour you would prefer to see so both of us don't end up rewriting it?
kiwidude is offline   Reply With Quote
Old 12-15-2010, 10:36 AM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I added a load_resource method to the InterfaceAction class. See method docstring.

And as for load time, store the images in the zip file without compression then loading them from the zip file will be just as fast as loading them from the filesystem.

Last edited by kovidgoyal; 12-15-2010 at 10:41 AM.
kovidgoyal is offline   Reply With Quote
Old 12-15-2010, 10:47 AM   #15
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
And as for load time, store the images in the zip file without compression then loading them from the zip file will be just as fast as loading them from the filesystem.
Wouldn't it be even faster if the method took a list of names and returned a dict {name: file_contents, }? That would permit the zip to be opened once to retrieve all the resources. Instead of ValueError, it could return {name: None} if it can't find a particular resource.
chaley 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
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM
Multicomputer Sync users - Do you sync the Config directory? Starson17 Calibre 4 07-29-2010 01:07 AM
How do I Create a Python Plugin? Sydney's Mom Plugins 25 01-27-2010 06:26 AM
How do I do create a directory on a PRS-500? JSWolf Calibre 5 11-25-2009 11:53 AM
Statusbar config? tselling PocketBook 0 11-13-2009 10:47 AM


All times are GMT -4. The time now is 09:26 PM.


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