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-04-2022, 09:36 AM   #46
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
No idea, I've never used user types with QtableWidgetItems. IIRC its needed to disable some builtin functionality, so that the custom types are treated specially by Qt.
kovidgoyal is offline   Reply With Quote
Old 01-04-2022, 10:43 AM   #47
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
No idea, I've never used user types with QtableWidgetItems. IIRC its needed to disable some builtin functionality, so that the custom types are treated specially by Qt.
Well, if you've never needed them I'm not sure why I'd need them either.

Unless someone comes up with a good reason not to I think, from now on, I'll just go with the simple option, i.e
Code:
QTableWidgetItem.__init__(self, text)
jackie_w is offline   Reply With Quote
Advert
Old 01-04-2022, 10:47 AM   #48
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,497
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
I found a minor issue in beta 5.99.1. When looking at the log for a running job the scroll bar keeps jumping back to the beginning of the log whenever it is updated.
jhowell is offline   Reply With Quote
Old 01-04-2022, 11:23 AM   #49
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
In the Editor when trying to use
Tools > Remove unused CC > [See what changed?] button

I get these 2 errors:
Code:
calibre 5.99.1 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: EpubMetadata (0, 0, 6) && EpubXCustomMetadata (0, 0, 7) && JS_Editor_Tools (0, 3, 16) && JS_Editor_Utils (0, 0, 9) && KePub Input (3, 4, 3) && KoboTouchExtended (3, 5, 4) && ScrambleEbook (0, 5, 1) && Smart_Device_App_CSSAdd (0, 0, 12) && TTS to MP3 (0, 5, 10)
Traceback (most recent call last):
  File "calibre\gui2\tweak_book\diff\view.py", line 358, in paintEvent
TypeError: QPainter.drawText(): arguments did not match any overloaded call:
  overload 1: argument 1 has unexpected type 'int'
  overload 2: argument 1 has unexpected type 'int'
  overload 3: argument 1 has unexpected type 'int'
  overload 4: argument 1 has unexpected type 'int'
  overload 5: argument 1 has unexpected type 'int'
  overload 6: argument 2 has unexpected type 'float'
  overload 7: argument 2 has unexpected type 'float'
Code:
calibre 5.99.1 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: EpubMetadata (0, 0, 6) && EpubXCustomMetadata (0, 0, 7) && JS_Editor_Tools (0, 3, 16) && JS_Editor_Utils (0, 0, 9) && KePub Input (3, 4, 3) && KoboTouchExtended (3, 5, 4) && ScrambleEbook (0, 5, 1) && Smart_Device_App_CSSAdd (0, 0, 12) && TTS to MP3 (0, 5, 10)
Traceback (most recent call last):
  File "calibre\gui2\tweak_book\diff\view.py", line 481, in paintEvent
TypeError: QPainter.boundingRect(): arguments did not match any overloaded call:
  overload 1: argument 1 has unexpected type 'int'
  overload 2: argument 1 has unexpected type 'int'
  overload 3: argument 1 has unexpected type 'int'
  overload 4: argument 2 has unexpected type 'float'
jackie_w is offline   Reply With Quote
Old 01-04-2022, 11:49 AM   #50
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
Holy moly, it was a bit difficult, but my plugins are Qt6 compatible.
Work, perfectly good. Here my Qt 5-6 compatibility workarounds, I let you judge if it is necessary to add a global retro-compatibility. Ask me for detail.

Code:
try:   ## PyQt6
    QtItemFlags = Qt.ItemFlag
    QPolicy = QSizePolicy.Policy
    QShape = QFrame.Shape
    QShadow = QFrame.Shadow
    QSizeConstraint = QLayout.SizeConstraint
    QTableWidgetType = QTableWidgetItem.ItemType.UserType
    
except:   ## PyQt5
    QtItemFlags = Qt.ItemFlags
    QPolicy = QSizePolicy
    QShape = QFrame
    QShadow = QFrame
    QSizeConstraint = QLayout
    QTableWidgetType = QTableWidgetItem.UserType

QTableWidgetType = 1000
Qt.ItemFlags => Qt.ItemFlag
QSizePolicy => QSizePolicy.Policy ✅ (for enum values: Minimum, Maximum...)
QFrame => QFrame.Shape ✅ (for enum values: NoFrame, HLine...)
QFrame => QFrame.Shadow ✅ (for enum values: Sunken, Plain...)
QLayout => QLayout.SizeConstraint ✅ (for enum values: SetMinimumSize...)

QTableWidgetItem.UserType => QTableWidgetItem.ItemType.UserType

Theoretically, QTableWidgetItem.ItemType.UserType should be the new valid value, but apparently not (throw a error). Fortunately, it's just a numerical constant, so I hard-coded its value to what it should be.
Spoiler:
Error when using QTableWidgetItem.ItemType.UserType
Code:
calibre, version 5.99.1
ERREUR : Exception non gérée: <b>TypeError</b>: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'

calibre 5.99.1  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: fr
Successfully initialized third party plugins: Comments Cleaner (1, 6, 0) && Mass Search-Replace (1, 2, 2)
Traceback (most recent call last):
  File "calibre_plugins.mass_search_replace.action", line 156, in quickSearchReplace
  File "calibre_plugins.mass_search_replace.config", line 946, in __init__
  File "calibre\gui2\widgets2.py", line 223, in __init__
  File "calibre_plugins.mass_search_replace.config", line 966, in setup_ui
  File "calibre_plugins.mass_search_replace.config", line 1129, in __init__
  File "calibre_plugins.mass_search_replace.config", line 1142, in populate_table
  File "calibre_plugins.mass_search_replace.config", line 1152, in populate_table_row
  File "calibre_plugins.mass_search_replace.common_utils", line 305, in __init__
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'


QTableWidgetType is used in a inherited class from QTableWidgetItem:
Code:
class ReadOnlyTableWidgetItem(QTableWidgetItem):
    def __init__(self, text):
        if text is None:
            text = ''
        QTableWidgetItem.__init__(self, text, QTableWidgetType)
        self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
EDIT:
For fix the QTableWidgetItem.ItemType.UserType issue, use this code:
Code:
try:
    QTableWidgetType = QTableWidgetItem.ItemType.UserType.value
except:
    QTableWidgetType = QTableWidgetItem.UserType
Thanks you @kovidgoyal

Last edited by un_pogaz; 01-04-2022 at 02:00 PM.
un_pogaz is offline   Reply With Quote
Advert
Old 01-04-2022, 12:14 PM   #51
democrite
Evangelist
democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.
 
Posts: 425
Karma: 77256
Join Date: Sep 2011
Device: none
If it is ok to report non plugin issues, on macOS switching between light and dark mode has issues. Currently in light mode and text on many controls, e.g. buttons, is white as if it did not properly switch to light.

Last edited by democrite; 01-04-2022 at 12:15 PM. Reason: ed
democrite is offline   Reply With Quote
Old 01-04-2022, 02:26 PM   #52
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,328
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by kovidgoyal View Post
Yes, its definitely time to drop Qt4 support.
Just to remind myself and everybody else, Qt5 came in with Calibre v2. Past thread.
JimmXinu is offline   Reply With Quote
Old 01-04-2022, 03:14 PM   #53
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,497
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by kovidgoyal View Post
@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.
In case anyone else is interested the full enum works with calibre 4.0 or later.

Those making similar changes to their plugins might want to either update the minimum calibre version supported or do additional coding for backward compatibility.
jhowell is offline   Reply With Quote
Old 01-04-2022, 10:49 PM   #54
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by JimmXinu View Post
Just to remind myself and everybody else, Qt5 came in with Calibre v2. Past thread.
I honestly couldn't remember which it version of calibre it was. That's far to old to give serious support to. I don't think I will remove it from any plugins that keep working, but, I'm not going to put much effort into doing it.
davidfor is offline   Reply With Quote
Old 01-04-2022, 10:57 PM   #55
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by jackie_w View Post
Well, if you've never needed them I'm not sure why I'd need them either.

Unless someone comes up with a good reason not to I think, from now on, I'll just go with the simple option, i.e
Code:
QTableWidgetItem.__init__(self, text)
The Qt docs say:

Quote:
You can define new user types in QTableWidgetItem subclasses to ensure that custom items are treated specially.
It's probably for plases where you can get a QTableWidgetItem subclass without knowing what it is. And you can use the type to cast or otherwise handle it appropriately. But, I can't find an example that does anything other than set the value.

Looking at the examples I have, that isn't going to happen. Most set flags and the data and don't do anything else.
davidfor is offline   Reply With Quote
Old 01-04-2022, 10:57 PM   #56
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 jackie_w View Post
In the Editor when trying to use
Tools > Remove unused CC > [See what changed?] button
https://github.com/kovidgoyal/calibr...6a9b480ea41796
kovidgoyal is offline   Reply With Quote
Old 01-04-2022, 11:10 PM   #57
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 jhowell View Post
I found a minor issue in beta 5.99.1. When looking at the log for a running job the scroll bar keeps jumping back to the beginning of the log whenever it is updated.
https://github.com/kovidgoyal/calibr...894cd0a8d91d70
kovidgoyal is offline   Reply With Quote
Old 01-04-2022, 11:16 PM   #58
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
@un_pogaz: Itemglags and QFrame enums should already be compatible. I have added QSizePolicy and QLayout compatibility layers.
kovidgoyal is offline   Reply With Quote
Old 01-05-2022, 03:05 AM   #59
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 democrite View Post
If it is ok to report non plugin issues, on macOS switching between light and dark mode has issues. Currently in light mode and text on many controls, e.g. buttons, is white as if it did not properly switch to light.
https://github.com/kovidgoyal/calibr...adcfae4c9e015d
kovidgoyal is offline   Reply With Quote
Old 01-05-2022, 04:09 AM   #60
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
Released version 5.99.2 with fixes for all reported issues.
kovidgoyal 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 05:08 AM.


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