glutanimate / bettertags-public

Temporary repository to host bug reports and documentation for the BetterTags Anki add-on
https://www.patreon.com/glutanimate/posts?tag=BetterTags
5 stars 0 forks source link

Incompatibility with multi-column addon #5

Closed aPaci95 closed 4 years ago

aPaci95 commented 4 years ago

Please, could you addon compatibility with multi-column addon? It works but it keeps creating errors everytime i rename a tag.

Anki 2.1.19 (3c8690ae) Python 3.8.0 Qt 5.14.0 PyQt 5.13.2 Platform: Windows 10 Flags: frz=True ao=True sv=1

Caught exception: Traceback (most recent call last): File "aqt\webview.py", line 28, in cmd File "aqt\webview.py", line 94, in _onCmd File "aqt\webview.py", line 407, in _onBridgeCmd File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-64>", line 2, in onBridgeCmd File "lib\site-packages\anki\hooks.py", line 82, in decorator_wrapper File "lib\site-packages\anki\hooks.py", line 76, in repl File "C:\Users\pacia\AppData\Roaming\Anki2\addons21\3491767031__init.py", line 216, in myOnBridgeCmd count = getConfig(self,getKeyForContext(self), defaultValue=1) File "C:\Users\pacia\AppData\Roaming\Anki2\addons21\3491767031\init__.py", line 158, in getKeyForContext key = str(self.note.mid) AttributeError: 'NoneType' object has no attribute 'mid'

glutanimate commented 4 years ago

Hey Alessandro!

I'm pretty sure I replied to this on Patreon, but just to be sure:

This appears to be an issue with "Multi-column note editor" (id: 3491767031). It likely just appears after renaming tags because the card browser is reloaded at that point, and that's when the bug in "Multi-column note editor" is triggered.

The issue is that Multi-column note editor doesn't seem to catch cases where the editor's note object is intermittently set to None (which can happen when the browser is reset after either native Anki events or those triggered by add-ons like BetterTags). A fix would likely entail modifying myOnBridgeCmd and returning early if the editor's note is None.

glutanimate commented 4 years ago

Ah, I see that you've also filed an issue against multi column note editor in https://github.com/hssm/anki-addons/issues/30, so let's move any further discussion there as the fix will have to be applied on that side.