Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MorphMan doesn't work with PyQt5 anymore #286

Open
MNastri opened this issue Jan 13, 2023 · 15 comments
Open

MorphMan doesn't work with PyQt5 anymore #286

MNastri opened this issue Jan 13, 2023 · 15 comments

Comments

@MNastri
Copy link

MNastri commented Jan 13, 2023

I got the message below after updating MorphMan:

Error

An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.

When loading '⁨MorphMan for Anki 21⁩':
⁨Traceback (most recent call last):
File "aqt.addons", line 247, in loadAddons
File "C:\Users\marce\AppData\Roaming\Anki2\addons21\900801631_init_.py", line 2, in
from PyQt6.QtWidgets import *
ModuleNotFoundError: No module named 'PyQt6'

I read that support for PyQt6 was just added, but I'm confused if PyQt5 was dropped by mistake or not.

@MNastri
Copy link
Author

MNastri commented Jan 14, 2023

About Anki Debug Info

Anki 2.1.56 (07fd88dd) Python 3.9.15 Qt 5.15.2 PyQt 5.15.5
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2023-01-13 16:20:50


===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['slackers_delight', 0, 'None', '']
Auto Ease Factor ['1672712021', 2021-03-21T15:11, 'None', '']
Autosync 21 ['1726633659', 2019-03-08T20:58, 'None', '']
Deck name in title 21 ['699175524', 2019-05-31T22:05, 'None', '']
Highlight Search Results in the Browser ['225180905', 2021-03-10T14:06, 'None', '']
Mini Format Pack ['295889520', 2018-07-24T14:45, 'None', '']
Minimize to tray ['85158043', 2022-04-30T14:57, 'None', '']
Review Heatmap ['1771074083', 2022-06-29T22:43, 'None', '']
Searching PDF Reading  Note-Taking in Add Dialog ['1781298089', 2022-08-15T04:22, 'None', mod]
Syntax Highlighting for Code ['1463041493', 2018-10-06T22:31, 'None', '']
avgEase for Anki  2141 ['1129477042', 2021-06-27T08:58, 'None', '']
load balancer ['1417170896', 2020-08-05T20:58, 'None', '']

===IDs of active AnkiWeb add-ons===
1129477042 1417170896 1463041493 1672712021 1726633659 1771074083 1781298089 225180905 295889520 699175524 85158043

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Incremental Reading v4103 ['935264945', 2019-04-21T09:54, 'None', '']
MorphMan for Anki 21 ['900801631', 2023-01-10T17:01, 'None', '']

@landonepps
Copy link
Collaborator

It was not intentional. I'll update it to add back Qt5 support.

Out of curiosity, why are you using the Qt5 release of Anki? I thought the Qt6 version had backward compatibility with Qt5 for addons.

@MNastri
Copy link
Author

MNastri commented Feb 3, 2023

Thank you!

To answer your question: I was not aware of that backwards compatibility. I have not read into this update yet and was afraid that moving to Qt6 would break everything but now I know. Thank you a second time 🙂

@galantra
Copy link

galantra commented Feb 23, 2023

https://docs.ankiweb.net/platform/windows/installing.html?highlight=qt6#qt5-vs-qt6

Some add-ons currently only work with the Qt5 version.

I have experienced myself that some add-ons don't work anymore when I use Qt6

@quietmansoath
Copy link

It was not intentional. I'll update it to add back Qt5 support.

Out of curiosity, why are you using the Qt5 release of Anki? I thought the Qt6 version had backward compatibility with Qt5 for addons.

@landonepps, I am also having this issue. Currently using: Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5
Platform: Windows 10

Does this mean I should upgrade to the Qt6 version for now? I just downloaded the addon as-is from the anki add-ons page since it didn't seem like there was a release on the github page.

@quietmansoath
Copy link

If anyone comes to see this, yes, you need to upgrade to Qt6. I also upgraded to Anki 2.1.58 when doing so but it's working now.

@rameauv
Copy link
Contributor

rameauv commented Jul 6, 2023

Shouldn't we be using "aqt.qt" instead of directly using "PyQt6" or "PyQt6"?
Like in the anki plugin doc.
https://addon-docs.ankiweb.net/qt.html

@rameauv
Copy link
Contributor

rameauv commented Jul 6, 2023

We could probably support both qt5 and qt6 at the same time by doing that way. What do you think?

@rameauv
Copy link
Contributor

rameauv commented Jul 6, 2023

I did a POC to see if this would work. Seems fine. If you wanna take a look.
rameauv@03e3318

@landonepps
Copy link
Collaborator

landonepps commented Jul 6, 2023

Using aqt.qt, which handles backward compatibility, is the correct solution here.
I've been distracted by other projects lately so I haven't had time to make the change.
@rameauv Are you able to make a PR for this? If not, I can make the change in a day or two.

FYI, looking at the generated python files in rameauv@03e3318, it seems like your line endings are messed up.

@rameauv
Copy link
Contributor

rameauv commented Jul 7, 2023

I'll refactor this and make a pr 👌

@rameauv
Copy link
Contributor

rameauv commented Jul 7, 2023

Should I start from the master branch?

landonepps pushed a commit that referenced this issue Aug 11, 2023
* When possible use aqt instead of directly using PyQt.
* This will make morphman compatible with anki-qt5 and anki-qt6.

Motivation: #291 #286
@landonepps
Copy link
Collaborator

I merged your changes to master, but unfortunately it's not true backwards compatibility.
The auto-generated UI files will need to be manually updated to use aqt's compatibility layer.
We'll probably have to write a script to generate it for PyQt6 and then patch it for backwards compatibility.

What addons are people using that don't support PyQt6?

@rameauv
Copy link
Contributor

rameauv commented Aug 13, 2023

Yes exact. As long as anki qt6 support qt5 addons with the compatibility mode enabled by default it should work.

landonepps added a commit that referenced this issue Aug 13, 2023
* When possible use aqt instead of directly using PyQt.
* This will make morphman compatible with anki-qt5 and anki-qt6.

Motivation: #291 #286
Co-authored-by: rameauv <valentin.rameau@outlook.fr>
@landonepps
Copy link
Collaborator

If someone who uses the Qt5 version of Anki could test the lastest AnkiWeb version of MorphMan, I'd really appreciate it.
The latest GitHub release works, too. https://github.com/kaegi/MorphMan/releases/tag/v5.0-qt6-alpha.4

I believe it should now be backwards compatible with Qt5. Please let us know here if you're still experiencing issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants