trgkanki / cloze_hide_all

GNU Affero General Public License v3.0
11 stars 3 forks source link

Shortcut to "Toggle Mask" #31

Closed DoctorToBeIn23 closed 3 years ago

DoctorToBeIn23 commented 3 years ago

I think it would be great it you made a short cut to toggle the mask with a press of a button, unless there already is and I am just not aware of it.

phu54321 commented 3 years ago

sorry for late reply :( I'll work around this asap

phu54321 commented 3 years ago

Try ctrl+r. You can customize shortcuts on addon config. Note that r is already reserved for replaying audio.

DoctorToBeIn23 commented 3 years ago

I cannot get it to be compatible with https://ankiweb.net/shared/info/24411424

On Thu, Nov 12, 2020 at 4:56 AM 박현우 notifications@github.com wrote:

Closed #31 https://github.com/trgkanki/cloze_hide_all/issues/31.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trgkanki/cloze_hide_all/issues/31#event-3988305783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLVAI6LGITNSAVI7E7NQ5DSPPEONANCNFSM4SL5MKWQ .

phu54321 commented 3 years ago

That is because it's not in this list. Refer to that addon.

DoctorToBeIn23 commented 3 years ago

Do you know if it is easy to manually add it?

On Nov 12, 2020, at 4:35 PM, 박현우 notifications@github.com wrote:

 That is because it's not in this list. Refer to that addon.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

phu54321 commented 3 years ago

You can already modify shortcuts on CHA addon settings, like this.

image

If you want that custom hotkey addon to support cloze (hide all), consult it on that addon's issues page.

phu54321 commented 3 years ago

Oh I understand your case. That addon didn't allow any other addon to add its own shortcuts. :(

https://github.com/Liresol/anki-custom-shortcuts/blob/8f36a420f8bb98497af2c573912ff62bc83e2fa4/custom_shortcuts/custom_shortcuts.py#L392

Proper implementation should append to original shortcut list, like done in CHA

def newShortuts(self, *, _old):
    def _():
        self.web.eval("toggle()")

    shortcuts = _old(self)
    shortcuts.append((getConfig("shortcutToggleMask", "ctrl+r"), _))
    return shortcuts

Reviewer._shortcutKeys = wrap(Reviewer._shortcutKeys, newShortuts, "around")

But that addon is replacing the shortcuts entirely.

if config_scuts["Ω enable reviewer"].upper() == 'Y':
    Reviewer._shortcutKeys = cs_review_setupShortcuts
    Reviewer.sToF = functions.review_sToF

Sadly there's no easy fix, as it is a design flaw of that addon. The best option is to not use that addon, or have that addon reimplemented from scratch.

phu54321 commented 3 years ago

The easiest fix would be to add this line of code at line 147 of custom_shortcuts.py

https://github.com/Liresol/anki-custom-shortcuts/blob/8f36a420f8bb98497af2c573912ff62bc83e2fa4/custom_shortcuts/custom_shortcuts.py#L147

        (config_scuts["reviewer choice 4"], lambda: self._answerCard(4)),
        ('ctrl+r', lambda: self.web.eval("toggle()"), # <----------- this
DoctorToBeIn23 commented 3 years ago

Thanks for all the help, I wasnt able to get both to work together. Maybe the add on author can add this in on his?

DoctorToBeIn23 commented 3 years ago

Cloze hide all author (Eric) fixed it on his end. Now there is an issue with the shortcut command+r with the review heatmap so I changed the shortcut to command+t so you may want to change the default shortcut on the add on! Thank you for this great add on/card type!