ijgnd / anki__extended_tag_edit_add_dialog

2 stars 2 forks source link

refresh tag suggestion while typing non latin character #2

Closed BlueGreenMagick closed 4 years ago

BlueGreenMagick commented 4 years ago

For some non-latin languages(Korean and others), a character isn't typed in with just one key press. For Korean, a character can take up to 5 keyboard presses to type in, and can take up to 2 more for the software to realize that I am now typing the next character, which only then KeyPressed and textChanged is triggered.

This commit changes the way this addon detects the input was changed and should perform the search, from when it realizes the complete character was typed in, to while the character is still being typed in.

BlueGreenMagick commented 4 years ago

I'm not quite sure if self.setAttribute(Qt.WA_InputMethodEnabled) was used correctly though.

ijgnd commented 4 years ago

Thanks for the improvement.

I'm not quite sure if self.setAttribute(Qt.WA_InputMethodEnabled) was used correctly though.

I'm not using this add-on that much and I don't know that much about qt/pyqt (and I reused this filter dialog from another software). So I can't say this either.

My idea: Merge and upload this to ankiweb for Anki 2.1.20+ only because only 2.1.20 autoupdates. If against my expectation someone reports an error I undo your commit and hide it behind some user setting that is off by default. The repaired version would be delivered to all users within a day. So even if contrary to my expectation your commit introduced some problem the downside would be negligible. Did I miss something?

Another idea: I think @AnKingMed regularly uses this add-on. Maybe he could just replace the file fuzzy_panel.py in his folder 1135507717 (extended_tag_edit_add_dialog) with your version from here and let us know if he runs into a problem in the next few days.

AnKingMed commented 4 years ago

Seems to be working ok for me. I will let you know if I find any errors. Always happy to test :)

BlueGreenMagick commented 4 years ago

I found an example usage here https://programtalk.com/python-examples/PySide.QtCore.Qt.WA_InputMethodEnabled/. Modified the code accordingly.

For some reason though, the widget already seems to have Qt.WA_InputMethodEnabled attribute set in my Anki, even without my setting them. That must have been why the code before worked for me. I'm not sure if the attribute is set for everyone, but there shouldn't be any harm setting it after checking it isn't set.

ijgnd commented 4 years ago

I forgot: thanks for making this add-on better.

BlueGreenMagick commented 4 years ago

No, thank you for making this wonderful addon.