FooSoft / yomichan-anki

Plugin for sentence/vocab mining Japanese books in Anki.
https://foosoft.net/projects/yomichan-anki
Other
58 stars 12 forks source link

Proposals: persistent text box, alternative search hotkey, JP Support #5

Closed felixvd closed 9 years ago

felixvd commented 9 years ago

1) Currently, Yomichan remembers recent files and reopens it, or fills the text box with the default text. With the editable text box, I think it would be good default behavior to store the text box contents in the preferences file and load it on startup, so that it is persistent and user input does not get flushed.

I changed my local copy to work this way and can do a pull request if you like, but I didn't connect it to a checkbox in the preferences because I don't have PyQt installed.

2) When writing, the Shift key sometimes triggers the updateSampleFromPosition look-up function and selects text that you immediately replace with your typing. I found that it got in the way a lot, so I changed my hotkey to Ctrl+Shift, but others might appreciate to see an option in the preferences pane rather than digging around in the code.

3) When I generate cards with Yomichan, I always go into the card browser and generate the readings in "kanji [furigana]" format with Japanese Support afterwards. I think the majority of Japanese learners have that plugin installed, and a {JPsupport_reading} option would be useful.

I was thinking to implement that field by using the libraries of the Japanese Support plugin, if it is installed. Would you be interested in a pull request with that function? I might fiddle with it and make it presentable then.

Cheers again :)

FooSoft commented 9 years ago

Sorry for slow reply, in New Zealand at the moment.

1) Storing the editable file contents is gravy, and maybe it could be combined with the preferences? Maybe we can have a dedicated file placed somewhere in user directory like .yomichan_buffer or something like that.

2) Option would be handy.

3) So I've heard about the whole Japanese Support plugin, but I'm not exactly sure what is required. You know that you can already populate each field with arbitrary combinations of reading/glossary/kanji, etc? If this is not enough, I would thing that for small features like this we shouldn't rely on a user having a plugin installed, and trying to reference it. That just makes the whole process brittle IMO

felixvd commented 9 years ago

1) I'll send a pull request with the changes. I just used the preferences like you said.

2) I actually tried to use Ctrl+Shift as a hotkey but couldn't get it to work. I must've been missing something.

3) I know referencing another plugin might seem overreaching, but it's written by Anki's author and seems like really basic functionality that should be in Anki to start with. I also think it's widespread among Anki users learning Japanese and others will also like to keep using the same note types they've been using to study with. I can see why you're hesitant as well, though.

The plugin puts a "Generate Readings" entry into the toolbar of the browser. Maybe it's easy to pass newly generated cards to the function behind it. I'll have a look into it.

FooSoft commented 9 years ago

Make sure that the text contents are properly escaped before being put in preferences, so it doesn't mess up the json. The json module may do this.automatically, but it's worth checking.

Just get the prefs to load and save, I'll add the ui for it myself later.

felixvd commented 9 years ago

I sent a pull request for the first issue and will fiddle with the rest at some other point. Cheers!