Example #1
0
 def updateCard(self):
     c = self.cards[self.currentCard]
     self.dialog.webView.setHtml(
         ("<html><head>%s</head><body>" % getBase(self.deck))
         + "<style>"
         + self.deck.css
         + ("\nhtml { background: %s }" % c.cardModel.lastFontColour)
         + "\ndiv { white-space: pre-wrap; }</style>"
         + mungeQA(self.deck, c.htmlQuestion())
         + "<br><br><hr><br><br>"
         + mungeQA(self.deck, c.htmlAnswer())
         + "</body></html>"
     )
     playFromText(c.question)
     playFromText(c.answer)
Example #2
0
 def updateCard(self):
     c = self.cards[self.currentCard]
     styles = (self.deck.css +
               ("\nhtml { background: %s }" % c.cardModel.lastFontColour) +
               "\ndiv { white-space: pre-wrap; }")
     styles = runFilter("addStyles", styles, c)
     self.dialog.webView.setHtml(
         ('<html><head>%s</head><body>' % getBase(self.deck)) +
         "<style>" + styles + "</style>" +
         runFilter("drawQuestion", mungeQA(self.deck, c.htmlQuestion()),
                   c) +
         "<br><br><hr><br><br>" +
         runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer()),
                   c)
         + "</body></html>")
     playFromText(c.question)
     playFromText(c.answer)
Example #3
0
 def renderPreview(self):
     c = self.card
     styles = (self.deck.rebuildCSS() +
               ("\nhtml { background: %s }" % c.cardModel.lastFontColour))
     styles = runFilter("addStyles", styles, c)
     self.form.preview.setHtml(
         ('<html><head>%s</head><body>' % getBase(self.deck, c)) +
         "<style>" + styles + "</style>" + runFilter(
             "drawQuestion", mungeQA(self.deck, c.htmlQuestion()), c) +
         "<hr>" +
         runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer()), c) +
         "</body></html>")
     clearAudioQueue()
     if c.id not in self.playedAudio:
         playFromText(c.question)
         playFromText(c.answer)
         self.playedAudio[c.id] = True
Example #4
0
 def renderPreview(self):
     c = self.card
     styles = self.deck.rebuildCSS() + ("\nhtml { background: %s }" % c.cardModel.lastFontColour)
     styles = runFilter("addStyles", styles, c)
     self.form.preview.setHtml(
         ("<html><head>%s</head><body>" % getBase(self.deck, c))
         + "<style>"
         + styles
         + "</style>"
         + runFilter("drawQuestion", mungeQA(self.deck, c.htmlQuestion()), c)
         + "<hr>"
         + runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer()), c)
         + "</body></html>"
     )
     clearAudioQueue()
     if c.id not in self.playedAudio:
         playFromText(c.question)
         playFromText(c.answer)
         self.playedAudio[c.id] = True
Example #5
0
def drawAnswerCES():
    if not isOn:
        origDrawAnswer()
        return
    a = mw.currentCard.htmlAnswer()
    mainAns = mungeQA(mw.bodyView.main.deck, a)
    mw.bodyView.write('<span id=answer />'+mainAns)
    mw.bodyView.flush()
    currentCard = mw.currentCard
    word = currentCard.fact['Expression']
    exSens = findChar(' '+word.strip()+' ')
    displayableExSens = exSensFormat(exSens,word)
    mw.bodyView.write(displayableExSens)
    if mw.bodyView.state != mw.bodyView.oldState:
        playFromText(a)
Example #6
0
File: view.py Project: zw/ankiqt
 def mungeQA(self, deck, txt):
     txt = mungeQA(deck, txt)
     # hack to fix thai presentation issues
     if self.main.config['addZeroSpace']:
         txt = txt.replace("</span>", "&#8203;</span>")
     return txt
Example #7
0
 def mungeQA(self, deck, txt):
     txt = mungeQA(deck, txt)
     # hack to fix thai presentation issues
     if self.main.config['addZeroSpace']:
         txt = txt.replace("</span>", "&#8203;</span>")
     return txt