Example #1
0
def newEventHandler(evt):
    if mw.state == "showAnswer":
        key = unicode(evt.text())
        if key == "x":
            evt.accept()
            return mw.cardAnswered(1)
        if key == "y":
            evt.accept()
            return mw.cardAnswered(4)
    return oldEventHandler(evt)
Example #2
0
def newEventHandler(evt):
    if mw.state == "showAnswer":
        key = unicode(evt.text())
        if key == "x":
            evt.accept()
            return mw.cardAnswered(1)
        if key == "y":
            evt.accept()
            return mw.cardAnswered(4)
    return oldEventHandler(evt)
Example #3
0
def newEventHandler(evt):
    if (evt):
        key = unicode(evt.text())
    else:
        return oldEventHandler(evt)
    

    ### Don't set any shortcuts if not showing question or answer
    if not (mw.state == "showQuestion") and not (mw.state == "showAnswer"): 
        return oldEventHandler(evt)

    
    
    if key =="5" or key=="b":                           # add shortcuts to bury the fact
        evt.accept()   
        return mw.onBuryFact()
    """
    # Consider adding shortcute to mark keys and to increase and decrease priority with + and - keys:
    Prompt("Priority is now %s", cardpriotiry

        if key =="6":
            evt.accept()    
            undo = _("Mark Fact (Faster-Keys)")
            mw.deck.setUndoStart(undo)
            mw.currentCard.fact.tags = canonifyTags(mw.currentCard.fact.tags +
                                                    "," + "Marked"  "FasterKeys")
            mw.currentCard.fact.setModified()
            mw.deck.updateFactTags([mw.currentCard.fact.id])
            mw.deck.deleteCard(mw.currentCard.id)
            mw.reset()
            mw.deck.setUndoEnd(undo)
            return
    """


    if (mw.mainWin.actionUndo.isEnabled()):              # add undo shortcuts
        if key=="z" or key=="`" or key=="q":           
            evt.accept()
            return mw.onUndo()

    if (key) and (key >= "1") and (key <= "7"):
        press = int(key)
        evt.accept()                       
        if mw.state == "showQuestion":             # if we are on the question jump to the answer
            return mw.mainWin.showAnswerButton.click()               
        defaultpress=mw.defaultEaseButton()

        if (press == 3):                            # Redefine 3 as whatever the default key is
            press = defaultpress
        if (press == 4) and (defaultpress==2):      # lower by one if reccomendation is "hard" and you chose "easy"
            press = 3
        if (press == 6):                             # reset the original 3 as 6
            press = 3
        if (press == 7):                            # reset the original 4 as 7
            press = 4

        if mw.state == "showAnswer":                  # push an answer button
            return mw.cardAnswered(press)        


    return oldEventHandler(evt)