I tried using this plugin, but hit an annoying TypeError. It would seem that in both line 347 and 423 in the "action.py" file, the "x" and "y" variables can be floats (or maybe they just are by default?)... Anyway, here's the stack trace:
Code:
calibre, version 5.34.0
ERROR: Unhandled exception: <b>TypeError</b>:arguments did not match any overloaded call:
QRect(): too many arguments
QRect(int, int, int, int): argument 1 has unexpected type 'float'
QRect(QPoint, QPoint): argument 1 has unexpected type 'float'
QRect(QPoint, QSize): argument 1 has unexpected type 'float'
QRect(QRect): argument 1 has unexpected type 'float'
calibre 5.34 embedded-python: False is64bit: True
Linux-5.15.10-zen1-1-zen-x86_64-with-glibc2.33 Linux ('64bit', 'ELF')
('Linux', '5.15.10-zen1-1-zen', '#1 ZEN SMP PREEMPT Fri, 17 Dec 2021 11:17:39 +0000')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 46, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 46, 0) && Count Pages (1, 11, 1) && Goodreads Sync (1, 15, 1) && KFX metadata reader (from KFX Input) (1, 46, 0) && KFX Input (1, 46, 0) && KePub Input (3, 4, 3) && KePub Metadata Reader (3, 4, 3) && KePub Metadata Writer (3, 4, 3) && KePub Output (3, 5, 3) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 3) && Kobo Utilities (2, 14, 1) && KoboTouchExtended (3, 5, 4) && Obok DeDRM (7, 2, 1) && Prettify Cover (1, 5, 0)
Traceback (most recent call last):
File "calibre_plugins.prettify_cover.dialogs", line 132, in showEvent
self.generate_thumbs()
File "calibre_plugins.prettify_cover.dialogs", line 309, in generate_thumbs
tmp = self.ia.prettify_cover_for_book(self.cover, self.nwidth,
File "calibre_plugins.prettify_cover.action", line 347, in prettify_cover_for_book
target_rect = QRect(x, int(y), int(new_width), int(new_height))
TypeError: arguments did not match any overloaded call:
QRect(): too many arguments
QRect(int, int, int, int): argument 1 has unexpected type 'float'
QRect(QPoint, QPoint): argument 1 has unexpected type 'float'
QRect(QPoint, QSize): argument 1 has unexpected type 'float'
QRect(QRect): argument 1 has unexpected type 'float'
I decided to try tinkering with it, and simply wrapped the "x" and the "y" parameter in "int()", so line 347 for example changes from:
Code:
target_rect = QRect(x, y, new_width, new_height)
to:
Code:
target_rect = QRect(int(x), int(y), new_width, new_height)
This seems to have resolved my issue, and everything just works now.
This would of course be nice if it was properly resolved directly (and correctly) in the plugin, but for now I have been able to hack-fix it with the typecast.