mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42:23 -04:00
add hex cache for dumb clients, make sure not to mark deck modified
This commit is contained in:
parent
5616e679f5
commit
edf121f8dc
1 changed files with 14 additions and 2 deletions
16
anki/deck.py
16
anki/deck.py
|
@ -8,7 +8,8 @@ The Deck
|
||||||
"""
|
"""
|
||||||
__docformat__ = 'restructuredtext'
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
import tempfile, time, os, random, sys, re, stat, shutil, types, traceback
|
import tempfile, time, os, random, sys, re, stat, shutil
|
||||||
|
import types, traceback, simplejson
|
||||||
|
|
||||||
from anki.db import *
|
from anki.db import *
|
||||||
from anki.lang import _, ngettext
|
from anki.lang import _, ngettext
|
||||||
|
@ -1315,9 +1316,20 @@ answerAlign, 0 from cardModels""")])
|
||||||
(hexifyID(row[0]), row[1]) for row in self.s.all("""
|
(hexifyID(row[0]), row[1]) for row in self.s.all("""
|
||||||
select id, lastFontColour from cardModels""")])
|
select id, lastFontColour from cardModels""")])
|
||||||
self.css = css
|
self.css = css
|
||||||
self.setVar("cssCache", css)
|
self.setVar("cssCache", css, mod=False)
|
||||||
|
self.addHexCache()
|
||||||
return css
|
return css
|
||||||
|
|
||||||
|
def addHexCache(self):
|
||||||
|
ids = self.s.column0("""
|
||||||
|
select id from fieldModels union
|
||||||
|
select id from cardModels union
|
||||||
|
select id from models""")
|
||||||
|
cache = {}
|
||||||
|
for id in ids:
|
||||||
|
cache[id] = hexifyID(id)
|
||||||
|
self.setVar("hexCache", simplejson.dumps(cache), mod=False)
|
||||||
|
|
||||||
def copyModel(self, oldModel):
|
def copyModel(self, oldModel):
|
||||||
"Add a new model to DB based on MODEL."
|
"Add a new model to DB based on MODEL."
|
||||||
m = Model(_("%s copy") % oldModel.name)
|
m = Model(_("%s copy") % oldModel.name)
|
||||||
|
|
Loading…
Reference in a new issue