don't bother extracing graph libs from resources; they're provided in block

This commit is contained in:
Damien Elmes 2011-03-25 17:37:28 +09:00
parent f20d730f3c
commit c5a109dca0

View file

@ -63,12 +63,11 @@ class CardStats(object):
class PrintableReport(QDialog):
def __init__(self, mw, type, title, func, css, extra):
def __init__(self, mw, type, title, func, css):
self.mw = mw
QDialog.__init__(self, mw)
restoreGeom(self, type)
self.type = type
self.extra = extra
self.setWindowTitle(title)
self.setModal(True)
self.mw.progress.start()
@ -100,8 +99,8 @@ class PrintableReport(QDialog):
tmpdir = tempfile.mkdtemp(prefix="anki")
path = os.path.join(tmpdir, "report.html")
open(path, "w").write("""
<html><head><style>%s</style>%s</head><body>%s</body></html>""" % (
self.css, self.extra, self.report))
<html><head><style>%s</style></head><body>%s</body></html>""" % (
self.css, self.report))
QDesktopServices.openUrl(QUrl("file://" + path))
# Deck stats
@ -133,17 +132,9 @@ h1 { font-size: 18px; border-bottom: 1px solid #000; margin-top: 1em;
.info {float:right; padding: 10px; max-width: 300px; border-radius: 5px;
background: #ddd; font-size: 14px; }
"""
buf = "<script>"
for n in ("jquery", "jquery.flot"):
f = QFile(":/%s.min.js" % n)
f.open(QIODevice.ReadOnly)
buf += f.readAll()
f.close()
buf += "</script>"
return PrintableReport(
mw,
"graphs",
_("Graphs"),
lambda: mw.deck.graphs().report(),
css,
buf)
css)