Closed cofinley closed 4 years ago
Daaamn this looks slick :heart_eyes: I will have a play around with this tomorrow. Excellent job! :+1:
Had a quick review of the functionality, though I haven't looked at any code. Need to go over this some more, but here are my initial thoughts I wrote down.
Love the word highlighting and them being buttons, I can really see this opening the door for full bucket functionality like we discussed. Though duplicate words still come through to the next view, and both are clickable. I guess that is intentional, just to bring through the whole paragraph as it is?
Does the "Define a note preset..." have to disappear when you already have note types setup? Just having a "+" button there would be good. Better yet, since the preset is still editable why not have a "Add current setup as preset" sort-of button?
When creating a note, I don't understand what the view underneath the "Create" buttons is for. Also I get a crash when I try to click on one of them, after agreeing to lose my current input:
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-ons section of our support site.
Debug info:
Anki 2.1.15 (dev) Python 3.6.8 Qt 5.9.5 PyQt 5.10.1
Platform: Linux
Flags: frz=False ao=True sv=1
Add-ons possibly involved: findmissingwords
Caught exception:
Traceback (most recent call last):
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/search_results/note_creation.py", line 134, in display_note_editor
note = self.mw.col.getNote(note_id)
File "/home/jmo/Development/anki/anki/collection.py", line 263, in getNote
return anki.notes.Note(self, id=id)
File "/home/jmo/Development/anki/anki/notes.py", line 15, in __init__
self.load()
File "/home/jmo/Development/anki/anki/notes.py", line 38, in load
from notes where id = ?""", self.id)
TypeError: 'NoneType' object is not iterable
After this the add-on is unresponsive, I cannot open the config options for instance, and need to restart Anki.
Regardless, excellent work my man :+1: I can see having QT to make the UI is really helping you get stuff setup and experiment! Need to get on that myself :sweat_smile:
Thanks for testing it out!
Does the "Define a note preset..." have to disappear when you already have note types setup?
Good idea
I don't understand what the view underneath the "Create" buttons is for
Yeah those should be labeled
I get a crash when I try to click on one of them, after agreeing to lose my current input
Interesting, the list item is supposed to be removed and therefore unclickable if you hit cancel and agree to lose input. I'll test this.
I'll work on these changes soon. Thanks again.
Fixed the aforementioned issues (hopefully without introducing more bugs). Caught a bug where clicking "no" on cancel was just like clicking "yes."
Still getting a crash, when the self.note_ids list
is empty in note_creation.py
Here's my setup to get it: I simply put in those words, click a preset, then click the only "Notes Created" option in the list, it warns I will lose my current input and then I get
I simply put in those words, click a preset, then click the only "Notes Created" option in the list, it warns I will lose my current input and then I get:
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-ons section of our support site. Debug info: Anki 2.1.16 (dev) Python 3.6.8 Qt 5.9.5 PyQt 5.10.1 Platform: Linux Flags: frz=False ao=True sv=1 Add-ons possibly involved: findmissingwords
Caught exception: Traceback (most recent call last): File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/search_results/note_creation.py", line 138, in display_note_editor note_id = self.note_ids[index] IndexError: list index out of range
Ignored words (coming soon)
lol :100: :ok_hand:
Apart from that bug, looks good, man! :ok_hand: Very nice work. Even with that bug, I am happy to pull this into main :grin:
I’ll take a look at that index out of range issue. Thanks!
Found another bug, where it crashes after clicking the "+" button.
Reproduction steps: 1) Click on a word 1) Click on a preset. You now have a populated word. 1) Click on a word again (the same word, or a different one) 1) The "+" button is now broken, no matter how you click around the window.
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-ons section of our support site.
Debug info:
Anki 2.1.16 (dev) Python 3.6.8 Qt 5.9.5 PyQt 5.10.1
Platform: Linux
Flags: frz=False ao=True sv=1
Add-ons possibly involved: findmissingwords
Caught exception:
Traceback (most recent call last):
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/search_results/note_creation.py", line 194, in display_note_creation_config
self.mw.find_missing_words_config = config_dialog = config.ConfigDialog(mw)
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/__init__.py", line 23, in __init__
self.render_tabs()
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/__init__.py", line 27, in render_tabs
self.note_creation_tab = NoteCreationTab(self.config)
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/note_creation_tab.py", line 29, in __init__
self.render_note_creation_settings()
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/note_creation_tab.py", line 32, in render_note_creation_settings
self.populate_presets()
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/note_creation_tab.py", line 45, in populate_presets
note_preset_widget = note_preset.NotePreset(self.config, preset, self.update_preset)
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/note_preset.py", line 30, in __init__
self.render_note_type_chooser()
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/config/note_preset.py", line 39, in render_note_type_chooser
callback=self.update_note_type)
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/utils/list_chooser.py", line 18, in __init__
self.update_button()
File "/home/jmo/.local/share/Anki2/addons21/findmissingwords/gui/utils/list_chooser.py", line 50, in update_button
self.mw.reset()
File "/home/jmo/Development/anki/aqt/main.py", line 533, in reset
runHook("reset")
File "/home/jmo/Development/anki/anki/hooks.py", line 29, in runHook
func(*args)
File "/home/jmo/Development/anki/aqt/modelchooser.py", line 47, in onReset
self.updateModels()
File "/home/jmo/Development/anki/aqt/modelchooser.py", line 82, in updateModels
self.models.setText(self.deck.models.current()['name'])
RuntimeError: wrapped C/C++ object of type QPushButton has been deleted
I assume the error is due to a lack of cleaning up the previous unfinished word when you click on a new word :sweat_smile:
Fixed the above issue as well as another memory management bug. Going to merge.
Includes abilities to alter config, setup presets to create notes from, word select, and more!
I believe it's at minimum viable product status based off what I would use it for and judging from basic needs. I realize there are some things we discussed which are not here yet (e.g. bulk create, non-exact search), but those can be added in the future and are not what I consider MVP at this time.
That being said, this isn't constituting a release, but at least a major step towards the finish line. The PR is mainly to hit the save button so it doesn't become an even bigger branch.
This is a big one, so I'd recommend testing before diving into the code.
Video Preview
https://webmshare.com/play/qdve9
Screenshots
Config, search settings:
Config, note creation presets:
Word Select:
Note creation based off preset in config:
Note after creation, regular editor used: