One feature I would love to have are some context menu items for looking up various things from the selected book on external websites in a separate browser window. For instance looking up the author on fantasticfiction.co.uk (so I can see other titles by the author or missing books in series), or looking up the book on Amazon to read reviews on it.
Reading about the lovely "plugin architecture" I thought I would look into dabbling myself with it. I've "had a go" with trial & error but stumped I think with the wrapper class.
Has anyone successfully attempted this and if so could they share their code or experiences? Is there an equivalent of the "HelloWorld" plugin example for an interface action? I have a bunch of questions but a simple example would solve most of them I am sure.
This is what I have so far (simplified) - all classes in the same file:
Filename: foo_plugin.py,
Zipped into: foo_plugin.zip
Code:
import webbrowser
from calibre.customize import InterfaceActionBase
from calibre.gui2.actions import InterfaceAction
from calibre.gui2 import error_dialog
class ActionFoo(InterfaceActionBase):
name = 'Foo'
actual_plugin = 'FooAction'
class FooAction(InterfaceAction)
name = ... etc with implementation
I had a few compile errors which I corrected, so I know the UI is now processing the foo_plugin.py file. Now there are no more errors but the plugin doesn't appear in the list or context menu. I suspect (one of) the problems is setting the value of actual_plugin. What value do I use when what I want to point to is in the same file? Am I missing something else as well? Also do I need to restart Calibre after installing to get it to appear?
Many thanks for help - first time at trying to write Python (.NET developer in the day job) so please be gentle