Merge pull request #19 from ospalh/some-fixes

Some fixes
This commit is contained in:
Damien Elmes 2012-11-07 14:11:10 -08:00
commit 41ca2b0c1c
4 changed files with 4 additions and 9 deletions

View file

@ -301,7 +301,7 @@ insert or ignore into revlog values (?,?,?,?,?,?,?,?,?)""", revlog)
path = os.path.join(dir, fname) path = os.path.join(dir, fname)
try: try:
return open(path, "rb").read() return open(path, "rb").read()
except IOError, OSError: except (IOError, OSError):
return return
def _srcMediaData(self, fname): def _srcMediaData(self, fname):

View file

@ -3,7 +3,7 @@
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import os, shutil, re, urllib, urllib2, time, unicodedata, \ import os, shutil, re, urllib, urllib2, time, unicodedata, \
urllib, sys, zipfile sys, zipfile
from cStringIO import StringIO from cStringIO import StringIO
from anki.utils import checksum, intTime, namedtmp, isWin, isMac, json from anki.utils import checksum, intTime, namedtmp, isWin, isMac, json
from anki.lang import _ from anki.lang import _

View file

@ -3,7 +3,7 @@
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import re, sys, threading, time, subprocess, os, signal, errno, atexit import re, sys, threading, time, subprocess, os, signal, errno, atexit
import shutil, random, atexit import shutil, random
from anki.hooks import addHook, runHook from anki.hooks import addHook, runHook
from anki.utils import namedtmp, tmpdir, isWin, isMac from anki.utils import namedtmp, tmpdir, isWin, isMac

View file

@ -494,13 +494,8 @@ order by ordinal""", mid)):
t[k] = t[k].replace( t[k] = t[k].replace(
"{{Reading}}", "{{furigana:Reading}}") "{{Reading}}", "{{furigana:Reading}}")
# adjust css # adjust css
if t['bg'].lower() == "#ffffff":
# a bit more intuitive default
bg = "white"
else:
bg = t['bg']
css = "" css = ""
if t['bg'] != "white": if t['bg'] != "white" and t['bg'].lower() != "#ffffff":
css = "background-color: %s;" % t['bg'] css = "background-color: %s;" % t['bg']
if t['align']: if t['align']:
css += "text-align: %s" % ("left", "right")[t['align']-1] css += "text-align: %s" % ("left", "right")[t['align']-1]