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

Fixed Qt6 errors #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fixed Qt6 errors #82

wants to merge 1 commit into from

Conversation

49Indium
Copy link

An import in __init__.py and some of the enums used in utils/dialog.py use the PyQt5 bindings rather than the new PyQt6 versions (or the aqt version arbitrary versions). As recently (October 2023 AFAIK) anki has started to only support Qt6 by default (as stated here), the import caused issues for the add-on on start up and the enums caused issues when accessing the settings menu (Tools > Anki-redesign).

This should fix both #80 and #81. I know that @kvn1351 mentioned that they had a PR coming, but given that was 2 months ago, I thought I do the quick fixes suggested in #80.

Copy link

@fleinn fleinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Anki version ⁨23.12.1, it fixes the error.

@qaisarsulaiman
Copy link

This fix reintroduces the same issue from #73 relating to full-screen

@49Indium
Copy link
Author

@qaisarsulaiman Can you provide more detail. Which issue are you talking about? Do you mean #76, #70 or #60 (or a combination)? I would think that applying both PRs (namely this one and #73) shouldn't have any issues as they don't touch the same file, but I could be wrong.

@qaisarsulaiman
Copy link

@49Indium Basically, prior to Qt6, applying the fullscreen change (https://github.com/Shirajuki/anki-redesign/pull/73/files) worked to stop every window opening in fullscreen. However, after Qt6, the changes described here had to be made to get the add-on to launch. However, after applying the changes described here, the fullscreen issue is back for me. I did not change utils/dark_title_bar.py, but it appears that updating to Qt6 causes some issues in regards to the fullscreen "fix" earlier.

@@ -8,7 +8,7 @@
from .utils.logger import logger

from typing import Any, Optional
from PyQt5.QtWidgets import QWidget
from aqt.qt import QWidget

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we can ensure compatibility by using aqt.qt instead of PyQt6

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, given that we fit with the new naming conventions of Qt6.

@Speculate7348
Copy link

I am on version Version ⁨24.04.1 (ccd9ca1a)⁩ using this addon from AnkiWeb and it still complains about Qt5.

When loading Anki-redesign:
Traceback (most recent call last):
  File "aqt.addons", line 247, in loadAddons
  File "$HOME/.local/share/Anki2/addons21/308574457/__init__.py", line 11, in <module>
    from PyQt5.QtWidgets import QWidget
ModuleNotFoundError: No module named 'PyQt5'

Not sure what version is hosted on AnkiWeb.

General Anki info:

Anki 24.04.1 (ccd9ca1a)  (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.8.1-060801-generic-x86_64-with-glibc2.35

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['memrise2anki-extension-master', 0, 'None', '']
Add Hyperlink ['318752047', 2023-06-18T13:39, 'None', '']
Add Table ['1237621971', 2023-06-18T13:37, 'None', '']
Advanced Browser ['874215009', 2023-10-21T16:34, 'None', '']
AnKing Note Types Easy Customization ['952691989', 2024-04-18T11:55, 'None', mod]
Anki Simulator ['817108664', 2023-11-06T18:26, 'None', '']
Anki-redesign ['308574457', 2023-02-04T19:43, 'None', mod]
AnkiWebView Inspector ['31746032', 2023-06-27T21:26, 'None', '']
Batch Editing ['291119185', 2023-10-26T02:38, 'None', '']
BetterSearch ['1052724801', 2024-03-06T17:25, 'None', '']
Clickable Tags v20 ['1739176371', 2022-01-30T23:58, 'None', '']
Colorful Tags  Hierarchical Tags ['594329229', 2022-09-15T17:06, 'None', '']
Correct Answers Graph ['993120073', 2022-03-14T21:52, 'None', '']
CrowdAnki JSON exportimport Edit history Collaborate on deck creation ['1788670778', 2023-10-30T19:57, 'None', '']
Custom Background Image and Gear Icon ['1210908941', 2023-04-19T03:19, 'None', mod]
Deck name in title 21 ['699175524', 2019-06-01T03:05, 'None', '']
Enhance main window ['877182321', 2023-10-22T22:28, 'None', mod]
Extended Card Stats During Review ['1008566916', 2024-02-26T20:07, 'None', '']
Fastbar- with nightmode support ['46611790', 2023-06-27T13:47, 'None', '']
Flag label ['671965183', 2023-03-22T09:44, 'None', '']
Google Translate ['1536291224', 2024-04-18T11:55, 'None', mod]
Graph View ['836753889', 2022-04-27T10:06, 'None', '']
HUMBLE PIE distinct cards studied today statistic ['2133933791', 2020-03-24T19:05, 'None', '']
Highlight Search Results in the Browser ['225180905', 2023-10-21T21:17, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', '']
Learning Step and Review Interval Retention ['1949865265', 2024-01-06T18:48, 'None', '']
More Decks Stats and Time Left ['1556734708', 2024-04-11T12:35, 'None', '']
More Overview Stats 21 ['738807903', 2021-07-30T21:13, 'None', '']
Opening the same window multiple time ['354407385', 2023-11-05T02:59, 'None', '']
Progress Graphs and Stats for Learned and Matured Cards ['266436365', 2020-03-29T08:26, 'None', '']
Rendered Browser ['993394845', 2022-07-04T23:55, 'None', '']
Review Heatmap ['1771074083', 2022-06-30T03:43, 'None', '']
Search cards based on length For Anki 21 ['819294114', 2022-06-28T15:19, 'None', '']
See Previous Card Ratings in Reviewer ['1906641654', 2021-08-19T23:32, 'None', '']
Show total review count in main screen ['1730200873', 2023-10-14T19:00, 'None', mod]
Show total time spent in main screen ['1238121460', 2020-07-19T10:36, 'None', '']
Simple Forvo Audio Downloader ['560814150', 2023-10-31T17:47, 'None', '']
Statistics for Note Types Card Types and Tags ['16703369', 2022-03-14T22:14, 'None', '']
Study Time Stats ['1247171202', 2024-02-24T17:59, 'None', '']
Syllabus - Anki Statistics and Export by Tag and Deck ['668156440', 2020-01-12T12:47, 'None', mod]
Syntax Highlighting for Code ['1463041493', 2018-10-07T03:31, 'None', '']
The KING of Button Add-ons ['374005964', 2024-01-27T11:19, 'None', mod]
Time per revised card graph ['1703703955', 2021-01-27T01:12, 'None', '']
True Retention by Card Maturity ['923360400', 2017-08-29T21:00, 'None', '']
Unstable See Description Pull from Duolingo ['557761805', 2023-03-24T20:17, 'None', '']
Wiktionary ['2087444887', 2023-12-07T00:45, 'None', mod]
add-on dialog searchfilter bar ['561945101', 2023-10-18T18:22, 'None', '']
export cardsnotes from browser with metadata to csv or xlsx ['1967530655', 2024-03-28T14:16, 'None', mod]

===IDs of active AnkiWeb add-ons===
1008566916 1052724801 1210908941 1237621971 1238121460 1247171202 1374772155 1463041493 1536291224 1556734708 16703369 1703703955 1730200873 1739176371 1771074083 1788670778 1906641654 1949865265 1967530655 2087444887 2133933791 225180905 266436365 291119185 308574457 31746032 318752047 354407385 374005964 46611790 557761805 560814150 561945101 594329229 668156440 671965183 699175524 738807903 817108664 819294114 836753889 874215009 877182321 923360400 952691989 993120073 993394845

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Advanced Review Bottom Bar ['1136455830', 2024-02-04T19:38, 'None', mod]
Anki IPA ['799647424', 2023-11-06T23:24, 'None', '']
Anki Tooltips ['1840818335', 2023-02-20T07:35, 'None', '']
Color Confirmation ['1084228676', 2024-01-06T10:55, 'None', '']
Custom Styles font color background colour classes ['1899278645', 2023-02-25T15:28, 'None', '']
Deck Browser CSS ['153779542', 2024-03-27T23:30, 'None', '']
Enhanced Cloze for Anki 21 ['1990296174', 2023-09-10T20:48, 'None', '']
Extra stats in the Deck Browser ['93718002', 2021-02-21T09:19, 'None', '']
Full Screen Toggle ['1612375712', 2018-08-25T04:21, 'None', '']
Hint Hotkeys ['1844908621', 2023-04-14T16:13, 'None', '']
Multiple Choice for Anki ['1566095810', 2023-11-17T21:59, 'None', '']
ReColor ['688199788', 2024-03-03T02:45, '3.0', '']
link Cards Notes and Preview them in extra window ['1423933177', 2023-10-28T00:26, 'None', '']

@49Indium
Copy link
Author

@Speculate7348 Given that this PR is still not closed, I doubt that this is the version up on AnkiWeb. As this PR reintroduces the full-screen bug from #73, this PR will likely remain open for some time. I don't have a mac, and can't seem to reproduce the error, so I probably won't be able to fix this issue. If anyone else has a solution, feel free to add to this PR.

@Speculate7348
Copy link

@Speculate7348 Given that this PR is still not closed, I doubt that this is the version up on AnkiWeb. As this PR reintroduces the full-screen bug from #73, this PR will likely remain open for some time. I don't have a mac, and can't seem to reproduce the error, so I probably won't be able to fix this issue. If anyone else has a solution, feel free to add to this PR.

Making the suggested change manually (using aqt.qt instead) does indeed solve the loading problem on my system. The full-screen bug does appear for me (running Linux Mint 21.1 with Cinnamon), but only in the Browser and Cinnamon allows me to de-maximize the window despite the titlebar buttons disappearing.

For me, the addon not loading at all is a greater issue than the a bug that does not affect the functionality of the addon.

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

Successfully merging this pull request may close these issues.

5 participants