Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-10-2022, 11:15 AM   #1
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 26,547
Karma: 188377810
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Sigil Qt6 and GUI plugin development changes

You may or may not know that Sigil is planning to move from Qt5 to Qt6 in a near-future release. This will effect plugins that currently utilize PyQt5 for their GUI interfaces. Note that plugins that use tkinter, or don't use a GUI interface will be unaffected by this change.

For all plugin devs whose plugins will be affected:

For reasons that are not really up for debate, Sigil has chosen to move to PySide6 for its preferred Python wrapper to Qt in the bundled Python that comes with the Windows and macOS Sigil packages.

In order to maintain compatibility with older versions of Sigil (Qt5/PyQt5) and newer versions of Sigil (Qt6/PySide6), I've come up with a compatibility module that can be included in your plugin to make things easier. If you don't update your plugin, you and your users will still have the option of using an external Python with PyQt5 installed for your plugin. No one will be left completely out in the cold. You can also use your own homegrown solution to remain compatible with Sigil-Qt5 and Sigil-Qt6. There are less differences than you would think between PyQt5 and PySide6. And where there are differences, I've coded some helper utilities in the plugin_utils module to facilitate things.

The plugin_utils module can be found in my personal github repository for it.

I use the module extensively in my own TagMechanic plugin (which has been updated to work with PyQt5 and PySide6), so feel free to use it as an example.

I've also made a Sigil Qt Plugin template that makes use of the plugin_utils module so that is another resource for plugin devs to modify their Gui Qt plugins. It's full of comments in the code to explain what is happening.

Several of @Doitsu's GUI plugins have already been updated to work with the coming change to Sigil as well. His Epub2LegacyMetaData plugin alone makes use of nearly all of the features of the plugin_utils module. So make use of his code examples as well.

Our own EPUB3 reader plugins have also been updated. That code is available for your perusal.

And of course myself and Kevin will be able to offer advice to those plugin devs who may run into trouble accommodating the upcoming changes.

Last edited by DiapDealer; 04-11-2022 at 11:23 AM.
DiapDealer is offline   Reply With Quote
Old 04-10-2022, 11:24 AM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 26,547
Karma: 188377810
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
In order to assist plugin devs in their testing, we have beta Qt6 versions of Sigil (for Windows and macOS) that can be installed at the same time as the regular release (Qt5) version of Sigil.

We've gone to great lengths to make sure these betas are safe, but please back up your Sigil preferences/INIs just to be safe.

Go here to download them.

The Windows installer is named Sigil-b907db5-Windows-Qt6-Beta-x64-Setup.exe
The macOS package is named Sigil.app-b907db5-Mac-Qt6-Beta.txz

These betas may change from time to time.

Last edited by DiapDealer; 04-11-2022 at 11:25 AM.
DiapDealer is offline   Reply With Quote
Advert
Old 04-11-2022, 10:35 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 26,547
Karma: 188377810
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
All links and announcements seem to check out, so I'm going to open the thread to comments/questions. Please try to limit the discussion to questions about (or improvements to) the plugin_utils module, or specific questions about how to modify plugin code to work with both PyQt5/PySide6.
DiapDealer is offline   Reply With Quote
Old 12-12-2022, 09:50 AM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,519
Karma: 22718641
Join Date: Dec 2010
Device: Kindle PW2
How to best handle import Pyside import errors

I've created a simple plugin that requires PySide.QWebEngineView, which isn't available in PyQt5. What's the most elegant way to handle Pyside import errors?

The following code works, but I'm also getting an Error Parsing Result XML. Start tag expected. error message.

Code:
import sys
try:
    from PySide.QtWebEngineWidgets import QWebEngineView
    # more PySide imports
except ModuleNotFoundError:
    print('This plugin requires PySide.')
    sys.exit()
Is there an easy way to suppress the Error Parsing Result XML. Start tag expected. error message?

Last edited by Doitsu; 12-12-2022 at 09:52 AM.
Doitsu is offline   Reply With Quote
Old 12-12-2022, 11:05 AM   #5
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 26,547
Karma: 188377810
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
It is my understanding that QWebEngineView is available in both PySide6 and PyQt5 via the QtWebEngineWidgets class:

Code:
from from PyQt5.QtWebEngineWidgets import QWebEngineView

from from PySide6.QtWebEngineWidgets import QWebEngineView
Using my helper module (plugin_utils.py), you should be able to unify that with:

include plugin_utils
from plugin_utils import QtWebEngineWidgets

weview = QtWebEngineWidget.QWebEngineView()

As for the "Error Parsing Result XML" ... that is a plugin launcher/wrapper error that typically occurs when there's an issue with the data being returned from the Python plugin process to Sigil's C++ routines.

See any of the three Sigil ePub3 reader plugins (EpubJSReader, BibiReader, ReadiumReader) for examples of QWebEngineView being used in a plugin that supports both Qt5/PyQt5 and Qt6/PySide6 versions of Sigil.

Last edited by DiapDealer; 12-12-2022 at 11:26 AM.
DiapDealer is offline   Reply With Quote
Advert
Old 12-12-2022, 11:11 AM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 6,889
Karma: 4526138
Join Date: Nov 2009
Device: many
Not sure if this helps, but the PyQt5 PyQtWebEngine (separate module) module includes QWebEngineView under QWebEngineWidgets just like PySide6.

See for example on how to use it via the plugin_utils here:

https://github.com/Sigil-Ebook/Readi.../plugin.py#L57

The Windows and macOS Sigil builds under Qt5 included it as part of the standard install beginning with Sigil 1.60 back in April of 2021.

Last edited by KevinH; 12-12-2022 at 11:20 AM.
KevinH is online now   Reply With Quote
Old 12-12-2022, 11:28 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 26,547
Karma: 188377810
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineSettings modules moved from QtWebEngineWidgets in PyQt5 to QtWebEngineCore in PySide6, so if you need to use those in conjunction with QWebEngineView, you'll need to account for that, or just use the utility module which does it for you.
DiapDealer is offline   Reply With Quote
Old 12-12-2022, 12:25 PM   #8
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,519
Karma: 22718641
Join Date: Dec 2010
Device: Kindle PW2
Thanks for your helpful replies! The QWebEngineView is indeed available in both PySide6 and PyQt5 via the QtWebEngineWidgets class. I'll have another look at the code example by KevinH.
Doitsu is offline   Reply With Quote
Old 12-12-2022, 04:37 PM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 26,547
Karma: 188377810
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Let us know if you run into trouble! The "Error Parsing Result XML" error can be difficult to debug at times. How the PyQt5 app/gui is deleted/destroyed can cause the plugin process to crash in the background with anything less than Qt5.14. It was a problem with PyQt up until Qt5.14.

In the off chance that that's the issue, just make sure to force the order of how objects get destroyed (after everything is all done) to work around it.

Code:
del window, app
The above usually does the trick for me. "window" being your MainWindow or other widget gui object, and "app" being your QtWidgets.QApplication object.
DiapDealer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] KindleUnpack - The Plugin DiapDealer Plugins 492 10-25-2022 08:13 AM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 09:03 PM.


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