Arthur-Milchior / anki-Multi-column-edit-window

Alllow the editor to have to have multiple columns
6 stars 2 forks source link

Throws an error with Version ⁨2.1.54 (b6a7760c)⁩ Python 3.9.7 Qt 5.15.2 PyQt 5.15.5 #29

Open dpg2012 opened 2 years ago

dpg2012 commented 2 years ago

When reviewing a card if you press [Edit] it throws an error.

Debug info: Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5

Platform: Windows 10 Flags: frz=True ao=True sv=3 Add-ons, last update check: 2022-06-29 08:52:37

Caught exception: Traceback (most recent call last): File "aqt.webview", line 42, in cmd File "aqt.webview", line 149, in _onCmd File "aqt.webview", line 624, in _onBridgeCmd File "aqt.reviewer", line 531, in _linkHandler File "aqt.main", line 1141, in onEditCurrent File "aqt", line 129, in open File "aqt.editcurrent", line 27, in init File "aqt.editor", line 130, in init File "aqt.hooks_gen", line 1957, in call File "C:\Users\david\AppData\Roaming\Anki2\addons21\3491767031\gui.py", line 31, in myEditorInit pLayout = self.tags.parentWidget().layout() AttributeError: 'Editor' object has no attribute 'tags'

khonkhortisan commented 10 months ago

[Anki 23.10 rc1] This will add Columns: 1 v̂ below the tags in the add-editor and browser-editor, but the real problem is that while myLoadNote hook is called and interacts with javascript, it doesn't affect the gui and just silently fails. 3491767031/gui.py

    #pLayout = self.tags.parentWidget().layout()
    ## Get the indices of the tags widget
    #(rIdx, cIdx, r, c) = pLayout.getItemPosition(pLayout.indexOf(self.tags))
    ## Place ours on the same row, to its right.
    #pLayout.addLayout(hbox, rIdx, cIdx+1)
    pLayout = self.widget.layout()
    lastitem = pLayout.itemAt(pLayout.count()-1)
    lastitem.widget().layout().addLayout(hbox)

imagen

Using the other hook style doesn't help 3491767031/__init__.py

Editor.loadNote = wrap(Editor.loadNote, myLoadNote, "before")
gui_hooks.editor_did_load_note.append(myLoadNote)