diff --git a/anki/stats.py b/anki/stats.py
index 96b50c351..e54785fe4 100644
--- a/anki/stats.py
+++ b/anki/stats.py
@@ -104,18 +104,22 @@ class CollectionStats(object):
self.height = 200
self.wholeCollection = False
- def report(self, type=0):
+ def report(self, type=0, background=False):
# 0=days, 1=weeks, 2=months
# period-dependent graphs
self.type = type
- txt = self.css
+ from statsbg import bg
+ if not background:
+ bg = ""
+ txt = self.css % bg
txt += self.dueGraph()
txt += self.repsGraph()
txt += self.ivlGraph()
- # other graphs
+ # other graphs & info
txt += self.hourGraph()
txt += self.easeGraph()
txt += self.cardGraph()
+ txt += self.footer()
return "
%s" % (
anki.js.jquery+anki.js.plot, txt)
@@ -123,6 +127,7 @@ class CollectionStats(object):
"""
@@ -643,6 +648,26 @@ sum(case when queue=0 then 1 else 0 end), -- new
sum(case when queue=-1 then 1 else 0 end) -- susp
from cards where did in %s""" % self._limit())
+ # Footer
+ ######################################################################
+
+ def footer(self):
+ b = "
"
+ b += _("Generated on %s") % time.asctime(time.localtime(time.time()))
+ b += "
"
+ if self.wholeCollection:
+ deck = _("whole collection")
+ else:
+ deck = self.col.decks.current()['name']
+ b += _("Scope: %s") % deck
+ b += "
"
+ b += _("Period: %s") % [
+ _("1 month"),
+ _("1 year"),
+ _("deck life")
+ ][self.type]
+ return b
+
# Tools
######################################################################
diff --git a/anki/statsbg.py b/anki/statsbg.py
new file mode 100644
index 000000000..b9f5ca947
--- /dev/null
+++ b/anki/statsbg.py
@@ -0,0 +1,3 @@
+bg = """\
+iVBORw0KGgoAAAANSUhEUgAAAHkAAAAmCAMAAADX/MRZAAAAG1BMVEXx8fHw8PDu7u7r6+vs7Ozv7+/t7e3p6enq6up7fRD2AAABM0lEQVR42u1WwXIFIQiLiKz//8XtrLbo9kFmz5WrDIHEKLijSA1Dpdwpzf6eXY+oJu07RPsVRpV2B34qo1mMbm2gi8bIXQeq1QTV2m9nmHNhzKXx6NZGgyu6o46SVuNhu8nImSlY5prEx+hOjzpyXwYJQwfqygf2uSapGfGy5FxVp7AZxTPnwQeCuZool70QYV2GD3zgI6ltJzXMaRZR7DJEOSCkZjdeNbvFTAaIvfAS8TP3l2uvXpp7iSNzf3ljEC/NvZQjc395Y6rY3kflXoqQub/6/rYiKc1lJ8KmjWHTtDDZH9ps/DFhZdce76y8a6PO33tTIyvNnlDEwvJPE0RTS/xWSuKdyrRH8i3yzysW1k0dRVaZy86EzTo729DZhs42dLahsw2dbehsQ2cb+t/b0Bc91VD1igpPDwAAAABJRU5ErkJggg==
+"""