From 1e97b61bb1e5a95fe0a955739b16f53a2012f303 Mon Sep 17 00:00:00 2001 From: ospalh Date: Fri, 26 Oct 2012 12:26:57 +0200 Subject: [PATCH 1/4] Fix the non-setting of white backgrounds. --- anki/upgrade.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/anki/upgrade.py b/anki/upgrade.py index 259720586..10c4b9e07 100644 --- a/anki/upgrade.py +++ b/anki/upgrade.py @@ -494,13 +494,8 @@ order by ordinal""", mid)): t[k] = t[k].replace( "{{Reading}}", "{{furigana:Reading}}") # adjust css - if t['bg'].lower() == "#ffffff": - # a bit more intuitive default - bg = "white" - else: - bg = t['bg'] css = "" - if t['bg'] != "white": + if t['bg'] != "white" and t['bg'].lower() != "#ffffff": css = "background-color: %s;" % t['bg'] if t['align']: css += "text-align: %s" % ("left", "right")[t['align']-1] From 0426e87b5fbc67fa3dcaa6eb22f0bb9cc923d461 Mon Sep 17 00:00:00 2001 From: ospalh Date: Fri, 26 Oct 2012 14:05:58 +0200 Subject: [PATCH 2/4] Don't assign an IOError to the name OSError and then never use it. Instead silently fail on either an IOError or an OSError. --- anki/importing/anki2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/importing/anki2.py b/anki/importing/anki2.py index 0b41ad804..c114ba5bb 100644 --- a/anki/importing/anki2.py +++ b/anki/importing/anki2.py @@ -319,7 +319,7 @@ insert or ignore into revlog values (?,?,?,?,?,?,?,?,?)""", revlog) path = os.path.join(dir, fname) try: return open(path, "rb").read() - except IOError, OSError: + except (IOError, OSError): return def _srcMediaData(self, fname): From bc535483552a69c2c2759950c3e51773b30fda09 Mon Sep 17 00:00:00 2001 From: ospalh Date: Tue, 30 Oct 2012 10:42:41 +0100 Subject: [PATCH 3/4] Import urllib only once. --- anki/media.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/media.py b/anki/media.py index c8d00b119..448996fd6 100644 --- a/anki/media.py +++ b/anki/media.py @@ -3,7 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import os, shutil, re, urllib, urllib2, time, unicodedata, \ - urllib, sys, zipfile + sys, zipfile from cStringIO import StringIO from anki.utils import checksum, intTime, namedtmp, isWin, isMac, json from anki.lang import _ From 34212ac06d88216337f6c77babef53e9244d92c2 Mon Sep 17 00:00:00 2001 From: ospalh Date: Wed, 31 Oct 2012 17:25:03 +0100 Subject: [PATCH 4/4] Avoid another double import --- anki/sound.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/sound.py b/anki/sound.py index b4cc0df09..690844657 100644 --- a/anki/sound.py +++ b/anki/sound.py @@ -3,7 +3,7 @@ # 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 shutil, random, atexit +import shutil, random from anki.hooks import addHook, runHook from anki.utils import namedtmp, tmpdir, isWin, isMac