Alternative Keys for Grading

Type: 
Plugin
Compatibility: 
Mnemosyne 1.x +
Status: 
Complete
Author: 
Timothy Bourke
Source: 

Original code.

Description: 

Makes the backtick (`) a shortcut for the Grade 0 button.

On many keyboards the backtick is to the left of the 1 key. This plugin thus makes it possible to review new cards easily with two fingers of one hand.

If necessary the plugin can be changed in a text editor to select a more appropriate key.

The plugin also helps with laptops where normal keys double as a numeric keypad (e.g. m/0, j/1, k/2, l/3, u/4, i/5). Those keys can be used to grade cards without having to use NumLk.

AttachmentSize
alternative_zero.zip733 bytes

Can this be extended with space bar aliases?

Thanks for this plugin. Having the backtick key to serve for 0 has made a significant difference in my efficiency of using Mnemosyne.

One thing that would increase my efficiency further would be to have the ` through 5 keys serve as aliases for the "show answer" key (spacebar). Usually upon seeing a question, I already know how I'm going to grade the answer, so if I'm going to grade it a 2, I can just press "2 2". This is analogous to pressing "space space" for 4-grade cards, but extended to all grades.

I'm not very familiar with the Mnemosyne code. As a quick (and very naive) experiment, I tried adding the following to the "keymaps =" assignment in this plugin:

,
("`", main_dlg.show_button.animateClick),
("1", main_dlg.show_button.animateClick),
("2", main_dlg.show_button.animateClick),
("3", main_dlg.show_button.animateClick),
("4", main_dlg.show_button.animateClick),
("5", main_dlg.show_button.animateClick)

This makes `,1,2,etc. activate "show answer", but it disables the ability of those keys to work for grading. Does anyone know how to do this correctly?

Maybe

The alternative zero plugin is not designed to support this kind of mode-dependent functionality.

But, you could try introducing a series of functions after the pattern (there's probably a better way to parameterise the function by the button to activate):
def grade0_orselect():
    main_dlg = get_main_widget()
    if (main_dlg.state == "SELECT SHOW"):
        main_dlg.show_button.animateClick()
    elif (main_dlg.state == "SELECT GRADE"):
        main_dlg.grade_0_button.animateClick()

And then mapping keys to them: keymaps = [("`", grade0_orselect),

I haven't tested this, but I can't see why it wouldn't work.

almost there but not quite

Thanks for responding.

This works perfectly for the "`" backtick key.

However, for "1" (and presumably through "5"), it doesn't work too well. The answer appears after pressing "1" as expected, but "1" must be pressed twice for grading: the first "1" puts a dotted line around the 1 grading button without activating it, and the second "1" activates the 1 button.

Perhaps this isn't overriding the internally coded behavior of the "1" key?

If I take out the elif clause, then pressing "1" after the answer puts a dotted line around the 1 button without activating it, but pressing "1" again does nothing.

It's probably the built-in accelerator

It may be possible to remove the built-in accelerator mappings with main_dlg.grade_0_button.setAccel(0), etcetera.

Again, not tested.

Re: It's probably the built-in accelerator

I couldn't get that to work.

However, since a,s,d,f,g,h aren't built in, I decided to map them to 0,1,2,3,4,5 and use your earlier technique of adding the def for the show/grade mode selection. For my purposes, this will do; I can also find these keys in the dark because of the bump on the f key. (I'm trying to memorize 2500 Croatian words, so optimal keyboard behavior is important. :) )

Thanks for your help.