def quit(): if mw.state == "editCurrentFact": mw.moveToState("saveEdit") return if mw.saveAndClose(hideWelcome=True): if mw.config['syncOnProgramOpen']: mw.hideWelcome = True mw.syncDeck(interactive=False) mw.prepareForExit() mw.app.quit()
def onEdit(): mw.deck.setVar("mobileJS", JS) mw.deck.setVar("mobileCSS", CSS) mw.deck.setModified() if not mw.currentCard: ui.utils.showInfo("Please run this when a card is shown") return if not "canvas" in mw.currentCard.cardModel.qformat: mw.currentCard.cardModel.qformat += '\n<br><div id="canvas"></div>' mw.deck.updateCardsFromModel(mw.currentCard.fact.model) mw.syncDeck() ui.utils.showInfo("Updated deck sent to server. "+ "Sync on AnkiMobile to finish.")