Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 01-01-2022, 09:30 AM   #16
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 929
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
I've just noticed that my plugin icons are being drawed with a lower quality then before. Also noticed a shadow on some checkboxes (why not all? ).

5.34 / 5.99(Beta)
Click image for larger version

Name:	5.34 - Menu.png
Views:	211
Size:	19.0 KB
ID:	191233Click image for larger version

Name:	5.99 - Menu.jpg
Views:	202
Size:	860.8 KB
ID:	191234
Click image for larger version

Name:	5.34 - Config Window.png
Views:	177
Size:	47.6 KB
ID:	191235Click image for larger version

Name:	5.99 - Config Window.jpg
Views:	185
Size:	702.9 KB
ID:	191236

There are also some separators missing on the beta, although using the same code (m.addSeparator()) for all of them.

Last edited by thiago.eec; 01-01-2022 at 09:36 AM.
thiago.eec is offline   Reply With Quote
Old 01-01-2022, 11:45 AM   #17
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,639
Karma: 61234567
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I'm not really a dev, but I do wonder what this will mean for some of DaltonST's plugins -- seeing as they've been absent for nearly a year, should the plugins be considered unmaintained at this point?
ownedbycats is offline   Reply With Quote
Advert
Old 01-01-2022, 12:10 PM   #18
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,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This will fix the drop/hover event errors: https://github.com/kovidgoyal/calibr...c60100810b09e5

@thiago.eec: No clue about your icons, most likely a DPI thing. Try using larger icons.
kovidgoyal is offline   Reply With Quote
Old 01-01-2022, 12:14 PM   #19
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 929
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
This will fix the drop/hover event errors: https://github.com/kovidgoyal/calibr...c60100810b09e5

@thiago.eec: No clue about your icons, most likely a DPI thing. Try using larger icons.
Strange, since it renders ok on calibre 5.34 and older versions.
Also, what about the missing separators?
thiago.eec is offline   Reply With Quote
Old 01-01-2022, 12:47 PM   #20
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
I'm just going to raise problems as I find them, rather than save them up for a mega post ...

I'm having a few problems with QTextBrowser widgets. Simplifying the sample code to:
Code:
from qt.core import (QTextBrowser, QTextCursor, QTextEdit)
self.browser = QTextBrowser()

self.browser.setLineWrapMode(QTextEdit.NoWrap)
self.browser.setLineWrapMode(QTextEdit.WidgetWidth)
self.browser.moveCursor(QTextCursor.End)
self.browser.moveCursor(QTextCursor.StartOfLine)
I get AttributeError for missing QTextEdit/QTextCursor constants(???) when I try to use any of the last 4 lines. They all work OK in standard v5.34
jackie_w is offline   Reply With Quote
Advert
Old 01-01-2022, 12:51 PM   #21
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
I hope it will be useful to someone, so please don't hit me.

Easy quick and dirty fix for many plugins that use functions from common_utils.py). Of course, the following advice only makes sense for beta users before the plugin maintainers release new versions.

1. Edit file common_utils.py
2. Remove (twice) QRegExpValidator, QRegExp from imports
3. Delete this fragment* (if it exists):

Spoiler:
Code:
class NumericLineEdit(QLineEdit):
    '''
    Allows a numeric value up to two decimal places, or an integer
    '''
    def __init__(self, *args):
        QLineEdit.__init__(self, *args)
        self.setValidator(QRegExpValidator(QRegExp(r'(^\d*\.[\d]{1,2}$)|(^[1-9]\d*[\.]$)'), self))

[*] I haven't found a single plugin that uses this code, so it won't be a big deal.

In this way, I managed to modify about 90% of the plugins that I use and now work normally in the beta version.

The remaining plugins require minor or major changes, especially if they are to be backward compatible with previous versions of Calibre.
BeckyEbook is offline   Reply With Quote
Old 01-01-2022, 01:48 PM   #22
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
I think this may be similar to my post #20. This code for a general utility class used as part of creating a read-only table widget:
Code:
from qt.core import QTableWidgetItem
class ReadOnlyTableWidgetItem(QTableWidgetItem):
    def __init__(self, text): 
        if text is None:
            text = ''
        QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType)
        self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
gives error
Code:
AttributeError: type object 'QTableWidgetItem' has no attribute 'UserType'
in v5.99

Last edited by jackie_w; 01-01-2022 at 01:51 PM.
jackie_w is offline   Reply With Quote
Old 01-01-2022, 09:32 PM   #23
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 929
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
This will fix the drop/hover event errors: https://github.com/kovidgoyal/calibr...c60100810b09e5

@thiago.eec: No clue about your icons, most likely a DPI thing. Try using larger icons.
Found the solution on their porting guide.

Quote:
Qt 6 changes the default scale factor rounding policy from Qt::HighDpiScaleFactorRoundingPolicy::Round to Qt::HighDpiScaleFactorRoundingPolicy::PassThrough in order to track operating system DPI settings accurately. Applications that use Qt Widgets may encounter graphical glitches at non-integer scale factors, for example on Windows with a display configured for 175%. In that case, set the rounding policy to Round to restore Qt 5 behavior.
Since I use a non-integer scale factor on my windows machine, this was causing the problem. So, to correct it, i restored Qt 5 behavior setting the policy to Round:

Code:
QApplication.setHighDpiScaleFactorRoundingPolicy(QtCore.Qt.HighDpiScaleFactorRoundingPolicy.Round)
thiago.eec is offline   Reply With Quote
Old 01-01-2022, 09:42 PM   #24
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 929
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by jackie_w View Post
Code:
        QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType)
        self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
Not tested, but a suggestion based on the problems I found porting my plugins... maybe you should use:
Code:
QTableWidgetItem.ItemType.UserType
https://doc.qt.io/qt-6/qtablewidgeti...#ItemType-enum

I noticed this change on setting flags, maybe this is the same case.
For example, on Qt 5, you could use this:
Code:
QApplication.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents)
On Qt 6, you need to be more explicit:
Code:
QApplication.processEvents(QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
thiago.eec is offline   Reply With Quote
Old 01-01-2022, 09:51 PM   #25
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,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@jackie_w You need to use fully qualified names for enums in PyQt6, as thiago pointed out. I have added compatibility layers for the most common enums in calibre so they can continue to be used as before, but not for all of them.
kovidgoyal is offline   Reply With Quote
Old 01-01-2022, 09:55 PM   #26
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,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by thiago.eec View Post
Found the solution on their porting guide.



Since I use a non-integer scale factor on my windows machine, this was causing the problem. So, to correct it, i restored Qt 5 behavior setting the policy to Round:

Code:
QApplication.setHighDpiScaleFactorRoundingPolicy(QtCore.Qt.HighDpiScaleFactorRoundingPolicy.Round)
That doesnt explain why it affects only plugin icons though. Is it because they are too small?
kovidgoyal is offline   Reply With Quote
Old 01-01-2022, 09:59 PM   #27
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,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@BeckyEbook: A better fix is to use

Code:
QRegularExpressionValidator(QRegularExpression(r'(^\d*\.[\d]{1,2}$)|(^[1-9]\d*[\.]$)'))
kovidgoyal is offline   Reply With Quote
Old 01-01-2022, 10:27 PM   #28
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 929
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
That doesnt explain why it affects only plugin icons though. Is it because they are too small?
I'm guessing* this is it.

Anyway, my fix backfired, since it sets the Policy for QApplication, messing with whole calibre. I guess I'll have to change all my icons for larger versions.

P.S.: The shadow on checkboxes borders happens on main calibre either.

* Confirmed. Using larger images fixes the problem.

Last edited by thiago.eec; 01-01-2022 at 10:44 PM. Reason: Add comments
thiago.eec is offline   Reply With Quote
Old 01-02-2022, 05:25 PM   #29
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
An error message from the Editor ...

Code:
calibre, version 5.99.0
ERROR: Unhandled exception: <b>TypeError</b>:int() argument must be a string, a bytes-like object or a real number, not 'KeyboardModifier'

calibre 5.99 Portable embedded-python: True
Windows-10-10.0.19042 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19042')
Python 3.10.1
Windows: ('10', '10.0.19042', '', 'Multiprocessor Free')
Interface language: en_GB
Successfully initialized third party plugins: EpubCheck (0, 2, 3) && EpubMetadata (0, 0, 6) && EpubXCustomMetadata (0, 0, 7) && JS_Editor_Tools (0, 3, 16) && JS_Editor_Utils (0, 0, 9) && JS_Modify_Epub (0, 0, 22) && KoboTouchExtended (3, 5, 4) && ScrambleEbook (0, 5, 0) && Smart_Device_App_CSSAdd (0, 0, 12) && TTS to MP3 (0, 5, 10)
Traceback (most recent call last):
  File "calibre\gui2\tweak_book\editor\text.py", line 950, in keyPressEvent
  File "calibre\gui2\tweak_book\editor\smarts\html.py", line 738, in handle_key_press
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'KeyboardModifier'
I'm not 100% sure of the rules to make this happen but here's an example where it did.

If the html is:
Code:
<p class="noindent">First paragraph.</p>
<p class="indent">Second paragraph.</p>
To trigger the error, double-click noindent to select it, then try to manually type indent. The error happens as I try to type the last 't'.

Changing classname via copy/paste doesn't trigger the error. Neither does changing noindent to indent by manually deleting the first 2 chars with the [Delete] key or the [Backspace] key.
jackie_w is offline   Reply With Quote
Old 01-02-2022, 05:32 PM   #30
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by kovidgoyal View Post
@jackie_w You need to use fully qualified names for enums in PyQt6, as thiago pointed out. I have added compatibility layers for the most common enums in calibre so they can continue to be used as before, but not for all of them.
and @thiago.eec

Thanks for the info and examples about needing fully qualifed names.
jackie_w is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestion for PI Devs BetterRed Plugins 11 09-27-2020 06:18 PM
Attn plugin devs: porting to python 3 kovidgoyal Plugins 129 06-16-2020 01:31 AM
Attention All Plugin Devs: Remove vestiges from python 2? KevinH Plugins 11 05-29-2020 03:16 PM
Plugin Devs: Should we include a License or COPYING file? KevinH Plugins 3 08-15-2017 01:09 PM
New Plugin Features in the upcoming Sigil 0.8.900 KevinH Plugins 6 09-14-2015 02:48 PM


All times are GMT -4. The time now is 08:12 AM.


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