fonol / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
177 stars 24 forks source link

Done button dosen't work #308

Open Vilhelm-Ian opened 2 years ago

Vilhelm-Ian commented 2 years ago

Describe the bug A clear and concise description of what the bug is. When reading a note and I click the done button to give me a different pdf it does nothing and it freezes To Reproduce Steps to reproduce the behavior: open a note from the que, press done

Expected behavior to show me a different not from the que

Screenshots image

Environment (please complete the following information):

Edit:

I just got this error: Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site. Debug info: Anki 2.1.49 (dc80804a) Python 3.10.1 Qt 5.15.2 PyQt 5.15.6 Platform: Linux Flags: frz=False ao=True sv=3 Add-ons, last update check: 2022-01-13 18:44:30 Add-ons possibly involved: ⁨Searching PDF Reading Note-Taking in Add Dialog⁩

Caught exception: Traceback (most recent call last): File "/home/jovan/.local/lib/python3.10/site-packages/aqt/webview.py", line 41, in cmd return json.dumps(self.onCmd(str)) File "/home/jovan/.local/lib/python3.10/site-packages/aqt/webview.py", line 142, in _onCmd return self._onBridgeCmd(str) File "/home/jovan/.local/lib/python3.10/site-packages/aqt/webview.py", line 589, in _onBridgeCmd handled, result = gui_hooks.webview_did_receive_js_message( File "/home/jovan/.local/lib/python3.10/site-packages/aqt/hooks_gen.py", line 4034, in call handled = filter(handled, message, context) File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/command_parsing.py", line 357, in expanded_on_bridge_cmd elif handle_reader(self, cmd): File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/cmds/reader/cmds_reader.py", line 81, in handle Reader.done() File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/web/reading_modal.py", line 572, in done done_dialog = DoneDialog(cls._editor.parentWindow, cls.note_id) File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/dialogs/done_dialog.py", line 48, in init self.setup_ui() File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/dialogs/done_dialog.py", line 63, in setup_ui self.done_tab = DoneTab(self) File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/dialogs/done_dialog.py", line 109, in init self.setup_ui() File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/dialogs/done_dialog.py", line 114, in setup_ui self.slider = QtPrioritySlider(self.parent.priority, self.parent.note_id, False, None) File "/home/jovan/.local/share/Anki2/addons21/1781298089/src/dialogs/components.py", line 58, in init self.slider.setValue(prio_default) TypeError: setValue(self, int): argument 1 has unexpected type 'float'

ShaddyDC commented 2 years ago

I haven't dug into what causes the issue, this is probably a bad fix, and I haven't checked if it causes any other issues, but you can change line 58 in the /home/jovan/.local/share/Anki2/addons21/1781298089/src/dialogs/components.py file to self.slider.setValue(int(prio_default)). Make sure you keep the indentation as is. I had another place I also had to edit similarly I forgot about, but for now, I seem to be able to use it again just fine, and I haven't noticed any problems.