Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-10-2022, 12:15 PM   #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: 28,040
Karma: 199464182
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 12:23 PM.
DiapDealer is offline   Reply With Quote
Old 04-10-2022, 12:24 PM   #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: 28,040
Karma: 199464182
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.

Sigil-2.0.0-Windows-Qt6-Beta-x64-Setup.exe

A pre-release Qt6 Beta version of Sigil-2.0.0 for Mac (x86_64)

These betas may change from time to time.

Last edited by KevinH; 08-05-2023 at 11:19 AM.
DiapDealer is offline   Reply With Quote
Advert
Old 04-11-2022, 11: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: 28,040
Karma: 199464182
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, 10: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,640
Karma: 23191067
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 10:52 AM.
Doitsu is offline   Reply With Quote
Old 12-12-2022, 12:05 PM   #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: 28,040
Karma: 199464182
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 12:26 PM.
DiapDealer is offline   Reply With Quote
Advert
Old 12-12-2022, 12:11 PM   #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: 8,160
Karma: 5450818
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 12:20 PM.
KevinH is offline   Reply With Quote
Old 12-12-2022, 12:28 PM   #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: 28,040
Karma: 199464182
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, 01: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,640
Karma: 23191067
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, 05: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: 28,040
Karma: 199464182
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
Old 08-05-2023, 11:22 AM   #10
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: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
A Qt6 based pre-release of Sigil.app-2.0.0-Beta-Mac-x86_64.txz that can be used to test Qt based gui plugins on MacOS has been added to this post

https://www.mobileread.com/forums/sh...27&postcount=2
KevinH is offline   Reply With Quote
Old 08-05-2023, 01:39 PM   #11
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,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
If you're using one of the following plugins and want to test the Sigil Qt6 beta, please install the latest plugin versions that I uploaded today.

AddIDs
Epub2LegacyMetaData
KindleGenQt
LanguageTool
MarkdownImport
ShowSemantics

(Thanks to a special Python library that DiapDealer kindly provided, they're all backwards-compatible with previous Sigil 1.x versions.)

Last edited by Doitsu; 08-07-2023 at 03:04 PM.
Doitsu is offline   Reply With Quote
Old 08-05-2023, 02:13 PM   #12
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: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
My most popular Qt plugins should also be ready for Sigil 2.x and 1.x :

TagMechanic
DOCXImport
KindleImport

I tried to indicate in the plugins' first posts that when Linux users upgrade to (or build) Sigil 2.0 with Qt6, they'll need to install PySide6 (to use these Qt plugins). Since Linux Sigil relies on the system Python for plugins.
DiapDealer is offline   Reply With Quote
Old 08-07-2023, 02:15 AM   #13
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,697
Karma: 5514284
Join Date: Mar 2015
Device: Kindle, iOS
Hi Doitsu,

I downloaded the new ShowSemantics and MarkdownImport plugins and installed on current Sigil 1.9.30 on macOS Ventura.

ShowSemantics worked fine, however MarkdownImport threw the following error. On further testing, I also get an error with v0.1.2. Obviously I haven't used this plugin for a while. Anyway, let me know if the error is on my end and if so, how I fix it

Spoiler:
Status: failed

Converting test.md...
Traceback (most recent call last):
File "/Applications/Sigil.app/Contents/plugin_launchers/python/launcher.py", line 142, in launch
self.exitcode = target_script.run(container)
File "/Users/o/Library/Application Support/sigil-ebook/sigil/plugins/MarkdownImport/plugin.py", line 214, in run
stdout, stderr, returncode = md_wrapper(*args)
File "/Users/o/Library/Application Support/sigil-ebook/sigil/plugins/MarkdownImport/plugin.py", line 100, in md_wrapper
process = subprocess.Popen(list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
File "subprocess.py", line 951, in __init__
File "subprocess.py", line 1821, in _execute_child
PermissionError: [Errno 13] Permission denied: '/Users/O/Library/Application Support/sigil-ebook/sigil/plugins/MarkdownImport/cmark-gfm'
Error: [Errno 13] Permission denied: '/Users/O/Library/Application Support/sigil-ebook/sigil/plugins/MarkdownImport/cmark-gfm'


Also, FYI to DiapDealer, I quickly tested the new TagMechanic, KindleImport and DOCXImport, which worked fine on 1.9.30 (i.e., backward compatiblility is fine)

Quote:
Originally Posted by Doitsu View Post
If you're using one of the following plugins and want to test the Sigil Qt6 beta, please install the latest plugin versions that I uploaded today.

AddIDs
Epub2LegacyMetaData
KindleGenQt
LanguageTool
MarkdownImport
ShowSemantics

(Thanks to a special Python library that DiapDealer kindly provided, they're all backwards-compatible with previous Sigil 1.x versions.)
Quote:
Originally Posted by DiapDealer View Post
My most popular Qt plugins should also be ready for Sigil 2.x and 1.x :

TagMechanic
DOCXImport
KindleImport

I tried to indicate in the plugins' first posts that when Linux users upgrade to (or build) Sigil 2.0 with Qt6, they'll need to install PySide6 (to use these Qt plugins). Since Linux Sigil relies on the system Python for plugins.
odamizu is offline   Reply With Quote
Old 08-07-2023, 06:16 AM   #14
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,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by odamizu View Post
ShowSemantics worked fine, however MarkdownImport threw the following error.
The Markdown import plugin is using a binary file (cmark-gfm) that KevinH compiled for use with the plugin.
Most likely, Ventura blocked the execution of that binary for security reasons and you'll need to manually mark it as safe.
Hopefully, KevinH, can help you with this.
Doitsu is offline   Reply With Quote
Old 08-07-2023, 10:28 AM   #15
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: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
That or the plugin needs to mark that binary as having executable permission using os.chmod immediately before first run. I will take a peek at it.

I will need to add an arm64 binary for macos as well.

KevinH
KevinH is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 02:05 AM.


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