Add-on issues with Anki 2.1.50 Beta

Please post any add-on issue you encounter here. Some of them may require changes by the add-on author, but some may be fixable on Anki’s end.

Associated beta thread: Anki 2.1.50 Beta

[taken from the previous packaging test thread - the ones marked “fixed” should already be fixed in beta 1]

Thanks for taking the time to gather those.

Fixed.

mw.app.primaryScreen() can probably be used as a replacement

This is in the Qt docs, so it may be an oversight on PyQt’s part. If the add-on author can’t work around it with a different approach, I’d recommend they report it on the PyQt mailing list.

Deprecated by Qt, so unlikely to ever come back to PyQt. The add-ons can likely work around it by storing a reference to the menu when it is created, and such an approach should work on older Anki versions as well.

Fixed.

That error is fixed, but the add-on needs other work.

Should be

    tb.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon)

Changes are required in the add-on; I think the author is on top of it.

I can’t reproduce this - maybe a different add-on is connected.

6 Likes

Has anyone had this problem on review heatmap?

2 Likes

Qt6: review heatmap is broken
Qt5: works fine

I’ll switch to Qt5, thanks again

will check add-ons for a organized report

I get NameError: name 'isWin' is not defined when I try to run the beta. Please stop removing stuff that add-ons use.

The add-on is using a feature that PyQt6 no longer supports, so action will be required on @glutanimate’s part here.

We go to pains to try to keep things working, but can’t cover all cases. If you import the legacy name from the location it was defined in, like most add-ons do, it will work fine:

>>> from anki.utils import isWin
<string>:1:isWin is deprecated: please use 'is_win'

What won’t work is if the add-on is importing the legacy name from a different file that just happened to import the symbol for its own use, like from aqt.editor import isWin. It’s not practical to cover these cases, but they are thankfully rare. The add-on author could have exercised more care here, but the blame mostly lies on Python itself, which makes imports public by default, and makes it cumbersome to import something semi-privately.

3 Likes

because i tested with the ./anki instead of installing anki, the A-F add-on compatibility report will be redone

H-L was tested with the anki installed

im sorry for the sloppy work, redo and then repost

Thanks for your help.

Strange. I don’t have this problem.

I assume you tested with the latest packaged betas from Index of /downloads/beta/ or you’re running from source with a version younger than one week (i.e. with this commit)?

Maybe it’s an add-on conflict - some of my add-ons try to import other add-ons and then errors trickle down from other add-ons. To rule this out: could you disable all other add-ons and restart anki and check the add window again.

I assume you tested with the add hyperlink version I uploaded 7 hours ago for 2.1.50 - I write this because I think that this problem still persists.

Also: If you find any other compatibility problems in my other add-ons please let me know.

 

 

Also: A fix for the fastbar add-on is coming, you can also manually apply these patches from github: fixes for qt6 by ijgnd · Pull Request #14 · AnKing-VIP/Fastbar-with-nightmode-support · GitHub

https://ankiweb.net/shared/info/1499032797
Does not change the time

about hyperlink add-on, sorry that was my mistake, everything is work flawless here
probably will need to check up on my eyes to see if it is working

testing the add-ons one by one on the latest anki beta1, while checking for add-ons updates (possible Qt6 fixes)

about the pull request on Fastbar, amazing work @ijgnd

Add-ons compatibility report

Objective: show which add-ons, in alphabetic order, are having problems (breaking or visual glitch) with anki 2.1.50 Qt5 and/or Qt6 using AnKing Palace add-ons list and configuration + personal list of add-on

Notes: will update the msg in case the extension get fixed Throughout anki 2.1.50 beta
Note 2: msgs in […] are dae or others dev comments
Note 3: tested with Beta 2

 File "aqt.hooks_gen", line 1030, in __call__
  File "/home/anon/.local/share/Anki2/addons21/874215009/advancedbrowser/core.py", line 42, in _load
    runHook("advBrowserLoaded", self)
  File "anki.hooks", line 34, in runHook
  File "/home/anon/.local/share/Anki2/addons21/874215009/advancedbrowser/note_fields.py", line 36, in onAdvBrowserLoad
    self.buildMappings()
  File "/home/anon/.local/share/Anki2/addons21/874215009/advancedbrowser/note_fields.py", line 137, in buildMappings
    self.advBrowser.setupColumns()
  File "/home/anon/.local/share/Anki2/addons21/874215009/advancedbrowser/core.py", line 91, in setupColumns
    sorting=BrowserColumns.SORTING_NORMAL if column.onSort() else BrowserColumns.SORTING_NONE,
AttributeError: SORTING_NORMAL

resources/anki21/icons_rc.py:108:The Qt resource system no longer works on PyQt6. Use QDir.addSearchPath() or mw.addonManager.setWebExports() instead.

addons21/1990296174/enhanced_cloze.py:356:onCloze() is deprecated: this routine has been moved into JS, and will be removed soon
aqt.editor:519:_onCloze() is deprecated: this routine has been moved into JS, and will be removed soon
JS error /_anki/legacyPageData?id=140366482995232:1 Uncaught ReferenceError: wrap is not defined
File "/home/anon/.local/share/Anki2/addons21/742185195/free_weekend.py", line 76, in load_conf
    f.DisableFW.setCheckState(c.get('DisableFW', 0))
TypeError: setCheckState(self, Qt.CheckState): argument 1 has unexpected type 'int'


File "/home/anon/.local/share/Anki2/addons21/742185195/free_weekend.py", line 81, in save_conf
    c['DisableFW'] = int(f.DisableFW.checkState())
TypeError: int() argument must be a string, a bytes-like object or a number, not 'CheckState'
File "aqt.hooks_gen", line 2273, in __call__
  File "anki.hooks", line 34, in runHook
  File "/home/anon/.local/share/Anki2/addons21/307397307/editor.py", line 26, in add_context_menu_action
    context_data = wv.page().contextMenuData()
AttributeError: 'AnkiWebPage' object has no attribute 'contextMenuData'
File "anki.hooks", line 34, in runHook
  File "/home/anon/.local/share/Anki2/addons21/1374772155/main.py", line 201, in onProfileLoaded
    editor._html = editor._html + io_editor_style.replace("%", "%%")
AttributeError: module 'aqt.editor' has no attribute '_html'
  • (Qt6, Qt5) ImageResizer - AnkiWeb [due to changes/removals in Anki’s APIs]
    Inability to paste images (crtl + v) in “add” and the resize option on “browse” don’t show when “right click” on the image
 File "aqt.webview", line 41, in cmd
  File "aqt.webview", line 148, in _onCmd
  File "aqt.webview", line 600, in _onBridgeCmd
  File "aqt.editor", line 434, in onBridgeCmd
  File "aqt.editor", line 886, in onPaste
  File "aqt.editor", line 1144, in onPaste
  File "aqt.editor", line 1138, in _onPaste
  File "decorator", line 232, in fun
  File "anki.hooks", line 89, in decorator_wrapper
  File "anki.hooks", line 86, in repl
TypeError: _processMime_around_with_extended() got multiple values for argument '_old'
File "/home/anon/.local/share/Anki2/addons21/1410276506/const.py", line 22, in <module>
    from aqt import moduleDir
ImportError: cannot import name 'moduleDir' from 'aqt' (unknown location)

Pokemanki → trade

File "/home/anon/.local/share/Anki2/addons21/633922407/trades.py", line 237, in tradeFunction
    self.newTrades()
  File "/home/anon/.local/share/Anki2/addons21/633922407/trades.py", line 161, in newTrades
    randno = random.randint(0, len(deckmonlist)-1)
  File "random", line 338, in randint
  File "random", line 316, in randrange
ValueError: empty range for randrange() (0, 0, 0)

Add → “try to make a cloze card” and click Add → “First field can’t be empty” or the cloze {{c1::}} will appear
also, there isn’t an option to edit the image in browse

JS error /_addons/1103084694/web/init.js:32 Uncaught TypeError: Cannot read property 'childElementCount' of null
JS error /_addons/1103084694/web/save_field.js:129 Uncaught ReferenceError: $ is not defined
review_heatmap/libaddon/platform.py:45:isMac is deprecated: please use 'is_mac'
review_heatmap/libaddon/platform.py:45:isWin is deprecated: please use 'is_win'
libaddon/anki/configmanager.py:42:json is deprecated: please implement your own
libaddon/gui/labelformatter.py:51:'Qt.FindChildrenRecursively' will stop working. Please use 'Qt.FindChildOption.FindChildrenRecursively' instead.
addons21/review_heatmap/heatmap.py:36:json is deprecated: please implement your own
resources/anki21/icons_rc.py:3119:The Qt resource system no longer works on PyQt6. Use QDir.addSearchPath() or mw.addonManager.setWebExports() instead.
resources/anki21/web_rc.py:11786:The Qt resource system no longer works on PyQt6. Use QDir.addSearchPath() or mw.addonManager.setWebExports() instead.
Starting main loop...
addons21/review_heatmap/activity.py:161:schedVer is deprecated: please use 'sched_ver'
conf key heatmap should be fetched with col.get_config(), and saved with col.set_config()
conf key heatmap should be fetched with col.get_config(), and saved with col.set_config()
addons21/review_heatmap/activity.py:161:schedVer is deprecated: please use 'sched_ver'
Qt warning: QResource '/review_heatmap/web/d3.min.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.css' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.css' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/left.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/circle.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/right.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/options.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/heart_bw.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/web/d3.min.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.css' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.css' not found or is empty 
JS error /_anki/legacyPageData?id=140411001973056:118 Uncaught ReferenceError: initHeatmap is not defined
addons21/review_heatmap/activity.py:161:schedVer is deprecated: please use 'sched_ver'
Qt warning: QResource '/review_heatmap/web/d3.min.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.css' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.css' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/left.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/circle.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/right.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/options.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/icons/heart_bw.svg' not found or is empty 
Qt warning: QResource '/review_heatmap/web/d3.min.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/cal-heatmap.css' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.js' not found or is empty 
Qt warning: QResource '/review_heatmap/web/review-heatmap.css' not found or is empty 
JS error /_anki/legacyPageData?id=140411001973056:118 Uncaught ReferenceError: initHeatmap is not defined

Tools → Special fields

  File "/home/anon/.local/share/Anki2/addons21/1102281552/dialog.py", line 357, in onFields
    FieldDialog(mw, fields, parent=self)
  File "/home/anon/.local/share/Anki2/addons21/1102281552/dialog.py", line 64, in __init__
    self.form.label_5.setParent(None)
AttributeError: 'Ui_Dialog' object has no attribute 'label_5'

Icons are missing

Qt warning: Cannot open file ':/icons/collection.svg', because: No such file or directory 
Qt warning: Cannot open file ':/icons/deck.svg', because: No such file or directory 
Qt warning: Cannot open file ':/icons/tag.svg', because: No such file or directory

Add → Ctrl+S or the Sym button → placing any symbol:
JS error /_anki/legacyPageData?id=140298631864816:1 Uncaught ReferenceError: wrap is not defined

“Add” → type any of the commands found in tools (Input Symbols options) → Add

JS error /_anki/legacyPageData?id=140379598323568:1 Uncaught TypeError: Cannot read property 'setMatchList' of undefined
JS error /_anki/legacyPageData?id=140379598323568:61 Uncaught ReferenceError: forEditorField is not defined
JS error /_anki/legacyPageData?id=140379598323568:1 Uncaught TypeError: Cannot read property 'setMatchList' of undefined

Add → “justify text and center it” and “cloze” don’t work:

addons21/396502676/__init__.py:45:model is deprecated: please use 'note_type'
JS error /_addons/396502676/main.js:11 Uncaught ReferenceError: $ is not defined

Notes:
Pop-up Dictionary (beta) - AnkiWeb is in Patreon, the current version that anking deploys is the old one, and is not working atm

can’t tell if put ALL due "learning" cards first (+modified v2 support) - AnkiWeb and Browser Resizer - AnkiWeb are working or not

Collapsible Fields - AnkiWeb partially integrated to anki (“Customize Field” don’t have “collapse by default”) (thanks for the awesome work @hgiesel)

Extended Tag Add/Edit Dialog - AnkiWeb, the ankingpalace configuration “crtl + 6” don’t work on browse because there is already a shortcut occupied by “flag6”, maybe changing to crtl + Y (it is close to 6, so previous users can adapt without changing the workflow)

Reminder to learn python to become a bug hunter master, thanks @ijgnd for the helpful and positivel msg in github and the guide on reddit

Fixed:
Fastbar- with nightmode support - AnkiWeb 2021-12-08
Image Style Editor - AnkiWeb 2021/12/17

2 Likes

Sorry, moving this post from the previous thread here without comment was confusing. This add-on (to the extend that it loads - I did not test it fully) should already be working in beta 1. If it’s still giving you trouble, could you post the errors you’re getting, and confirm they’re not due to other add-ons?

SORTING_NORMAL needs to be renamed to SORTING_ASCENDING.

Other errors posted above that are due to changes/removals in Anki’s APIs:

  • image occlusion enhanced
  • imageresizer
  • spelling police

These issues look to be due to changes in PyQt6:

  • free weekend
  • image editor

sorry @dae used the ./anki instead of installing it on the A-F add-on compatibility report, and because of that, amboss was broken and hyperlink was without buttons

both: the amboss and hyperlink is working fine if you install the anki ( for the future beta testers, don’t use ./anki to test add-on compatibility)

For now will prioritize the A-F report then recheck the H-L (believe it was using the installed version, but will redo)

edit 1: tested the add-ons with the Qt6 version, nothing new, so merged the posts and typed dae comments in brackets […]
Also merged Batch editing and customize backgrounds because they had the same problem

https://ankiweb.net/shared/info/1136455830
Skip button does not work

A post was merged into an existing topic: Anki 2.1.50 Beta

I’ve tried building Anki with QT6, which works fine but probably the reason of the error below.
When I try to open AJT Pitch Accent options, I get:

Anki 2.1.50 (0de24122) Python 3.9.9 Qt 6.2.2 PyQt 6.2.2
Platform: Linux
Flags: frz=False ao=True sv=3
Add-ons, last update check: 2021-12-06 23:19:44
Possible reason: <U+2068>AJT Pitch Accent<U+2069>

Caught exception:
Traceback (most recent call last):
  File "/home/user/.local/share/Anki2/addons21/1225470483/options.py", line 240, in open_options
    dialog = SettingsDialog(mw)
  File "/home/user/.local/share/Anki2/addons21/1225470483/options.py", line 170, in __init__
    self.list_edits = self.create_list_edits()
  File "/home/user/.local/share/Anki2/addons21/1225470483/options.py", line 176, in create_list_edits
    'note_types': NoteTypesListEdit(self),
  File "/home/user/.local/share/Anki2/addons21/1225470483/options.py", line 132, in __init__
    super(NoteTypesListEdit, self).__init__(
  File "/home/user/.local/share/Anki2/addons21/1225470483/options.py", line 65, in __init__
    self.list_widget = self.create_list_widget(items)
  File "/home/user/.local/share/Anki2/addons21/1225470483/options.py", line 71, in create_list_widget
    list_widget.setSizeAdjustPolicy(QListWidget.AdjustToContents)
AttributeError: type object 'QListWidget' has no attribute 'AdjustToContents'

The compat shims can’t cover cases where the enum was defined in a parent class. It needs to be changed to something like QSizePolicy.AdjustToContents.

I recently updated the Cloze Anything add-on to work with 2.1.49. I thought I’d test with the 2.1.50 beta and found a problem that seems related to calling the wrap JavaScript method. The wrapping text is no longer added. I’m guessing this is related to the error highlighted earlier in this thread: Uncaught ReferenceError: wrap is not defined. Was this function removed and if so what would be the new way to achieve this?

Here’s the code that is working in 2.1.49:

wrap_command = "wrap('((c{}::', '))');".format(next_cloze_num)
...
editor.web.evalWithCallback(wrap_command, callback)