示例#1
0
 def refresh(self):
     self.mw.progress.start(immediate=True)
     self.oldPos = self.form.web.page().mainFrame().scrollPosition()
     stats = self.mw.col.stats()
     stats.wholeCollection = self.wholeCollection
     self.report = stats.report(type=self.period)
     css = '<style>body { font-family: "%s"; } </style>' % fontForPlatform()
     self.form.web.setHtml(css + self.report)
     self.mw.progress.finish()
示例#2
0
 def refresh(self):
     self.mw.progress.start(immediate=True)
     self.oldPos = self.form.web.page().mainFrame().scrollPosition()
     stats = self.mw.col.stats()
     stats.wholeCollection = self.wholeCollection
     self.report = stats.report(type=self.period)
     css = '<style>body { font-family: "%s"; } </style>' % fontForPlatform()
     self.form.web.setHtml(css + self.report)
     self.mw.progress.finish()
示例#3
0
 def setNote(self, note, hide=True, focus=False):
     "Make NOTE the current note."
     self.note = note
     self.currentField = 0
     # change timer
     if self.note:
         self.web.setHtml(_html % (
             getBase(self.mw.col), fontForPlatform(), anki.js.jquery,
             _("Show Duplicates")), loadCB=self._loadFinished)
         self.updateTagsAndDeck()
         self.updateKeyboard()
     else:
         self.hideCompleters()
         if hide:
             self.widget.hide()
示例#4
0
    def stdHtml(self, body, css="", bodyClass="", loadCB=None, head=""):
        if isMac:
            button = "font-weight: bold; height: 24px;"
        else:
            button = "font-weight: normal; font-size: 12px;"
        self.setHtml("""
<html><head><style>
body { font-family: "%s"; }
button {
%s
}
%s</style>
<script>%s</script>
%s

</head>
<body class="%s">%s</body></html>""" % (
    fontForPlatform(), button, css, anki.js.all, head, bodyClass, body), loadCB)
示例#5
0
    def _update(self):
        if not self.shown:
            return
        txt = ""
        r = self.mw.reviewer
        d = self.mw.col
        if r.card:
            txt += _("<h1>Current</h1>")
            txt += d.cardStats(r.card)
        lc = r.lastCard()
        if lc:
            txt += _("<h1>Last</h1>")
            txt += d.cardStats(lc)
        if not txt:
            txt = _("No current card or last card.")
        self.web.setHtml("""
<html><head>
<style>table { font-size: 12px; } h1 { font-size: 14px; }
body { font-family: "%s"; } </style>
</head><body><center>%s</center></body></html>""" % (fontForPlatform(), txt))
示例#6
0
    def stdHtml(self, body, css="", bodyClass="", loadCB=None, head=""):
        if isMac:
            button = "font-weight: bold; height: 24px;"
        else:
            button = "font-weight: normal; font-size: 12px;"
        self.setHtml(
            """
<html><head><style>
body { font-family: "%s"; }
button {
%s
}
%s</style>
<script>%s</script>
%s

</head>
<body class="%s">%s</body></html>""" % (fontForPlatform(), button, css,
                                        anki.js.all, head, bodyClass, body),
            loadCB)
示例#7
0
    def _update(self):
        if not self.shown:
            return
        txt = ""
        r = self.mw.reviewer
        d = self.mw.col
        if r.card:
            txt += _("<h1>Current</h1>")
            txt += d.cardStats(r.card)
        lc = r.lastCard()
        if lc:
            txt += _("<h1>Last</h1>")
            txt += d.cardStats(lc)
        if not txt:
            txt = _("No current card or last card.")
        self.web.setHtml("""
<html><head>
<style>table { font-size: 12px; } h1 { font-size: 14px; }
body { font-family: "%s"; } </style>
</head><body><center>%s</center></body></html>"""% (fontForPlatform(), txt))
示例#8
0
)

profileConf = dict(
    # profile
    key=None,
    mainWindowGeom=None,
    mainWindowState=None,
    numBackups=30,
    lastOptimize=intTime(),

    # editing
    fullSearch=False,
    searchHistory=[],
    lastColour="#00f",
    stripHTML=True,
    editFontFamily=fontForPlatform(),
    editFontSize=12,
    editLineSize=20,
    pastePNG=False,
    # not exposed in gui
    deleteMedia=False,
    preserveKeyboard=True,

    # syncing
    syncKey=None,
    syncMedia=True,
    autoSync=True,
    proxyHost='',
    proxyPort=8080,
    proxyUser='',
    proxyPass='',
示例#9
0
profileConf = dict(
    # profile
    key=None,
    mainWindowGeom=None,
    mainWindowState=None,
    numBackups=30,
    lastOptimize=intTime(),
    lang="en",

    # editing
    fullSearch=False,
    searchHistory=[],
    recentColours=["#000000", "#0000ff"],
    stripHTML=True,
    editFontFamily=fontForPlatform(),
    editFontSize=12,
    editLineSize=20,
    deleteMedia=False,
    preserveKeyboard=True,

    # syncing
    syncKey=None,
    syncMedia=True,
    autoSync=True,
    proxyHost='',
    proxyPort=8080,
    proxyUser='',
    proxyPass='',
    proxyType=3,
)