01-02-2022, 10:32 PM | #31 |
creator of calibre
Posts: 44,001
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@jackie_w: Thanks, fixed by: https://github.com/kovidgoyal/calibr...3d57adaa187c3c
|
01-03-2022, 04:00 AM | #32 |
creator of calibre
Posts: 44,001
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Released version 5.99.1 with fixes for all issues reported so far (other than thiago's checkbox shadows)
|
Advert | |
|
01-03-2022, 08:11 AM | #33 | |
Guru
Posts: 946
Karma: 1183425
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
This causes some graphical glitches. In my case: - Kind of a shadow on some checkboxes - Missing separators - Small icons are drawed with poor quality (the same ones that looked ok on Qt5). - The whole calibre interface got "bigger". I have bigger icons, bigger line spaces, etc. For the icons on my plugins, I just used larger ones, but the rest of the problems remained. So, I dealed with it by setting this environment variable: Code:
QT_ENABLE_HIGHDPI_SCALING = 0 After setting the environment variable. |
|
01-03-2022, 05:51 PM | #34 |
Guru
Posts: 733
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
|
Excellent. Is the beta? in the beta section?
|
01-03-2022, 07:21 PM | #35 |
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
@DNSB reported to me an error on some of the plugins I look after. The error was:
Code:
ModuleNotFoundError: No module named 'PyQt4' When I looked the original error was: Code:
Traceback (most recent call last): File "calibre_plugins.goodreads.config", line 16, in <module> ImportError: cannot import name 'Qt' from 'qt' (E:\CalibrePortable599\Calibre Portable\Calibre\app\bin\python-lib.bypy.frozen\qt\__init__.pyc) Code:
from PyQt5 import Qt as QtGui |
Advert | |
|
01-03-2022, 07:59 PM | #36 | |
Grand Sorcerer
Posts: 6,553
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
Quote:
Should I change this to QTextEdit.LineWrapMode.NoWrap or will you add that to the compatibility layer? If I change it to the fully qualified enum will it be backward compatible with older versions of calibre? Last edited by jhowell; 01-03-2022 at 08:18 PM. |
|
01-03-2022, 09:33 PM | #37 |
creator of calibre
Posts: 44,001
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@davidfor: The PyQt5.Qt module was a shortcut module for importing other Qt classes from a common namespace that was removed in PyQt6. It should not be used and and definitely not aliased as QtGui which is a different module altogether.
Indeed, from calibre 5.13 onwards you can simply do all Qt related imports as from qt.core import whatever It works on qt 5 and qt 6. This is what is used in calibre source code itself. @jhowell: Yes, QTextEdit is rather too specialised for me too add a compat layer for it. Ans yes, the fully qualified names work with calibre 5.x as well. Not sure about even earlier versions though. |
01-03-2022, 09:34 PM | #38 |
creator of calibre
Posts: 44,001
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
01-04-2022, 12:31 AM | #39 | |
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Code:
try: from PyQt5 import Qt as QtGui from PyQt5.Qt import (QTableWidgetItem, QVBoxLayout, Qt, QGroupBox, QTableWidget, QCheckBox, QAbstractItemView, QHBoxLayout, QIcon, QInputDialog) except ImportError: from PyQt4 import QtGui from PyQt4.Qt import (QTableWidgetItem, QVBoxLayout, Qt, QGroupBox, QTableWidget, QCheckBox, QAbstractItemView, QHBoxLayout, QIcon, QInputDialog) Code:
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem1) remove_mapping_button = QtGui.QToolButton(self) And that's pretty common in the plugins. I assume the first line was a cheat so that we didn't have to change the code that was using QtGui from Qt4. I'll have a look to see how easy it is to change, but, it might be time to drop the Qt4 support. |
|
01-04-2022, 12:38 AM | #40 |
creator of calibre
Posts: 44,001
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes, its definitely time to drop Qt4 support. Though if you dont want to, you could in theory do this:
Code:
try: import qt.core as QtGui except ImportError: try: from PyQt5 import Qt as QtGui except ImportError: from PyQt4 import QtGui |
01-04-2022, 04:38 AM | #41 | |
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Code:
QTableWidgetItem.ItemType.UserType.value Code:
AttributeError: 'ItemType' object has no attribute 'value' And with out the ".value", with Qt6, the error is: Code:
TypeError: QTableWidgetItem(): arguments did not match any overloaded call: overload 1: argument 1 has unexpected type 'str' overload 2: argument 2 has unexpected type 'ItemType' overload 3: argument 1 has unexpected type 'str' overload 4: argument 1 has unexpected type 'str' Code:
super(ReadOnlyTableWidgetItem, self).__init__(text, QTableWidgetItem.ItemType.UserType) What have I missed? |
|
01-04-2022, 05:53 AM | #42 | |
eReader Wrangler
Posts: 7,538
Karma: 48453105
Join Date: Mar 2013
Location: Boise, ID
Device: PB HD3, GL3, Tolino Vision 4, Voyage, Clara HD
|
Quote:
|
|
01-04-2022, 06:11 AM | #43 |
creator of calibre
Posts: 44,001
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@davidfor: That's a bug in PyQt6. Just use the literal 1000 it should work in both. Or if you want to be elegant:
Code:
try: MyType = QTableWidgetItem.ItemType.UserType.value except AttributeError: MyType = QTableWidgetItem.UserType |
01-04-2022, 07:34 AM | #44 | |
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
|
|
01-04-2022, 08:26 AM | #45 | |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Code:
QTableWidgetItem.__init__(self, text, 1000) I'm fairly sure the code both @davidfor and myself are using originates from @kiwidude's early plugins. Sorry if this is a dumb question, is there a good reason why a UserType needs to be specified at all, because this also appears to work? Presumably it defaults to a UserType of zero: Code:
QTableWidgetItem.__init__(self, text) |
|
|
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 |