From 479f38fab275741c742ee8237394aff29ec64e55 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 31 Jan 2009 02:18:46 +0900 Subject: [PATCH] background colour, reduce default spacing to a minute, tweak finished msg --- anki/deck.py | 25 ++++++++++++++++++------- anki/models.py | 6 ++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index b3583bb19..55c1f891c 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -50,7 +50,7 @@ decksTable = Table( Column('created', Float, nullable=False, default=time.time), Column('modified', Float, nullable=False, default=time.time), Column('description', UnicodeText, nullable=False, default=u""), - Column('version', Integer, nullable=False, default=23), + Column('version', Integer, nullable=False, default=24), Column('currentModelId', Integer, ForeignKey("models.id")), # syncing Column('syncName', UnicodeText), @@ -633,14 +633,16 @@ type = 0 and isDue = 1 and combinedDue <= :now""", now=time.time()) newCardsTomorrow = min(self.newCount, self.newCardsPerDay) cards = self.cardsDueBy(time.time() + 86400) msg = _('''\ + At the same time tomorrow:

-%(wait)s
-%(new)s''') % { - 'new': ngettext("There will be %d new card waiting for review.", - "There will be %d new cards waiting for review.", +%(spc)s%(wait)s
+%(spc)s%(new)s''') % { + 'new': ngettext("There will be %d new card.", + "There will be %d new cards.", newCardsTomorrow) % newCardsTomorrow, - 'wait': ngettext("There will be %s card waiting.", - "There will be %s cards waiting.", cards) % cards, + 'wait': ngettext("There will be %s review.", + "There will be %s reviews.", cards) % cards, + 'spc': ' ' * 5, } if next - time.time() > 86400 and not newCardsTomorrow: msg = (_("The next card will be shown in %s.") % @@ -1206,7 +1208,11 @@ questionAlign from cardModels""")]) css += "".join([_genCSS("#cma", row) for row in self.s.all(""" select id, answerFontFamily, answerFontSize, answerFontColour, answerAlign from cardModels""")]) + css += "".join([".cmb%s {background:%s;}\n" % + (hexifyID(row[0]), row[1]) for row in self.s.all(""" +select id, lastFontColour from cardModels""")]) self.css = css + #print css return css def copyModel(self, oldModel): @@ -2381,6 +2387,11 @@ where interval < 1""") pass deck.version = 23 deck.s.commit() + if deck.version < 24: + deck.s.statement( + "update cardModels set lastFontColour = '#ffffff'") + deck.version = 24 + deck.s.commit() return deck _upgradeDeck = staticmethod(_upgradeDeck) diff --git a/anki/models.py b/anki/models.py index ba6931971..0f0248e13 100644 --- a/anki/models.py +++ b/anki/models.py @@ -96,9 +96,11 @@ cardModelsTable = Table( Column('answerFontSize', Integer, default=20), Column('answerFontColour', String(7), default=u"#000000"), Column('answerAlign', Integer, default=0), + # not used Column('lastFontFamily', UnicodeText, default=u"Arial"), Column('lastFontSize', Integer, default=20), - Column('lastFontColour', String(7), default=u"#000000"), + # used as background colour + Column('lastFontColour', String(7), default=u"#FFFFFF"), Column('editQuestionFontFamily', UnicodeText, default=None), Column('editQuestionFontSize', Integer, default=None), Column('editAnswerFontFamily', UnicodeText, default=None), @@ -166,7 +168,7 @@ modelsTable = Table( Column('description', UnicodeText, nullable=False, default=u""), # obsolete Column('features', UnicodeText, nullable=False, default=u""), # obsolete Column('spacing', Float, nullable=False, default=0.1), - Column('initialSpacing', Float, nullable=False, default=600), + Column('initialSpacing', Float, nullable=False, default=60), Column('source', Integer, nullable=False, default=0)) class Model(object):