02-03-2021, 06:32 AM | #1 |
Member
Posts: 16
Karma: 10
Join Date: Jun 2020
Device: nook simple touch
|
Start "edit book" plugin in Calibre 5
Hi everyone!
I would like to make sure my "edit book" plugin works correctly on Calibre 5, but I am having trouble starting the plugin. Calibre loads normally, I can modify the plugin preferences in Calibre Preferences, but when I start the book editor I can't see the plugin tab in the toolbar nor I can start the plugin via keyboard shortcut. The plugin works correctly in Calibre 3 and 4. Here is the debug log (I fire up Calibre and open the book editor): Code:
calibre 5.10.1 [64bit] embedded-python: True is64bit: True Windows-10-10.0.18362 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.18362') Python 3.8.5 Windows: ('10', '10.0.18362', '', 'Multiprocessor Free') Interface language: en_GB Successfully initialized third party plugins: Access Aide (0, 1, 2) && KindleUnpack - The Plugin (0, 82, 1) Turning on automatic hidpi scaling devicePixelRatio: 1.0 logicalDpi: 96.0 x 96.0 physicalDpi: 102.23899371069182 x 102.35820895522387 Using calibre Qt style: True [0.00] Starting up... [0.00] Showing splash screen... [1.41] splash screen shown [1.41] Initializing db... [1.42] db initialized [1.42] Constructing main UI... [2.30] main UI initialized... [2.30] Hiding splash screen Starting QuickView [2.45] splash screen hidden [2.45] Started up in 2.45 seconds with 1 books Worker Launch took: 0.00 seconds Thanks! |
02-03-2021, 07:30 AM | #2 |
creator of calibre
Posts: 44,532
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
run
calibre-debug -t to ge tthe debug output for the editor. |
Advert | |
|
02-03-2021, 09:12 AM | #3 |
Member
Posts: 16
Karma: 10
Join Date: Jun 2020
Device: nook simple touch
|
Thank you so much!!
There were two python3 compatibility issues. The plugin now works correctly. If this could be useful to others, I debugged the file using 2to3 Code:
$ 2to3-2.7 main.py RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored main.py --- main.py (original) +++ main.py (refactored) @@ -12,7 +12,7 @@ from calibre_plugins.access_aide.config import prefs # My modules -from lib.stats import Stats +from .lib.stats import Stats class AccessAide(Tool): @@ -61,7 +61,7 @@ blacklist = ['toc.xhtml'] # iterate over book files - for name, media_type in container.mime_map.items(): + for name, media_type in list(container.mime_map.items()): if media_type in OEB_DOCS \ and name not in blacklist: RefactoringTool: Files that need to be modified: RefactoringTool: main.py |
02-03-2021, 10:01 AM | #4 | |
Wizard
Posts: 1,080
Karma: 1221485
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
I was going to say that it worked here, but seems like I got the fixed version.
By the way: 1) The plugin seems not to handle multiple epub:type's. Ex.: epub:type="bodymatter chapter". In this case, it does not add the 'doc-chapter' role. 2) When you execute the plugin, the editor doesn't seem to notice the changes (the save buttons stays greyed out). Also, when closing, it does not ask to save, and you loose the changes. Quote:
|
|
02-05-2021, 06:46 AM | #5 | |
Member
Posts: 16
Karma: 10
Join Date: Jun 2020
Device: nook simple touch
|
Quote:
I will definitely look into point 2. I'll check if the documentation mentions something about this. Regarding point 1, I feel you have more experience than I do here. Is it OK to overload (add multiple values in) epub:type? Do I risk to subsequently overload aria roles? Many thanks!! |
|
Advert | |
|
02-05-2021, 08:36 AM | #6 | ||
Wizard
Posts: 1,080
Karma: 1221485
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
No, you can use multiple values for epub:type:
Quote:
For instance, you can use multiple values to define Document Partition and Section, like these examples: Code:
<section epub:type="frontmatter preface" role="doc-preface">...</section> <section epub:type="backmatter colophon" role="doc-colophon">...</section> Quote:
So, you would have to detect multiple values for epub:type and use only the appropriate one while mapping to aria roles. Usually, only one of the epub:type values has a corresponding aria role. Last edited by thiago.eec; 02-05-2021 at 08:43 AM. |
||
02-05-2021, 09:06 AM | #7 | |
Member
Posts: 16
Karma: 10
Join Date: Jun 2020
Device: nook simple touch
|
Quote:
I've just [added a feature](https://github.com/OpenBookPublisher...d6105f8c6a5a82) to allow this behaviour. It will be included in the next plugin release. Thanks so much!! |
|
Tags |
book editor, calibre, plugin |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
In Edit Metadata, both "Number" field and "Next" button have letter N underlined. | droopy | Library Management | 6 | 05-24-2020 04:46 AM |
I imported a "kepub.ebub" book into Calibre, but Calibre converted to "epub". Why? | droopy | Calibre | 5 | 12-23-2019 08:33 AM |
Calibre 4.0 - qt.qpa.pluginCould not load the Qt platform plugin "xcb" in "" even tho | PaceyIV | Calibre | 3 | 10-04-2019 09:58 PM |
How to define the "Start" or "Beginning" page in Calibre | paul_01 | Conversion | 5 | 08-12-2016 07:58 AM |
Alter Double-click behaviour to "edit metadata" instead of "open ebook?" | Feather_Qwill | Library Management | 5 | 09-15-2013 12:20 PM |