mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add background to graphs on save, and close on save
This commit is contained in:
parent
b7ccf406c3
commit
a436e5cd7a
1 changed files with 4 additions and 2 deletions
|
@ -51,6 +51,7 @@ class DeckStats(QDialog):
|
||||||
|
|
||||||
def browser(self):
|
def browser(self):
|
||||||
# dump to a temporary file
|
# dump to a temporary file
|
||||||
|
self.refresh(background=True)
|
||||||
name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
|
name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
|
||||||
time.localtime(time.time()))
|
time.localtime(time.time()))
|
||||||
name = "anki-"+_("stats")+name
|
name = "anki-"+_("stats")+name
|
||||||
|
@ -66,6 +67,7 @@ class DeckStats(QDialog):
|
||||||
painter.end()
|
painter.end()
|
||||||
image.save(path, "png")
|
image.save(path, "png")
|
||||||
p.setViewportSize(oldsize)
|
p.setViewportSize(oldsize)
|
||||||
|
self.close()
|
||||||
showInfo(_("An image was saved to your desktop."))
|
showInfo(_("An image was saved to your desktop."))
|
||||||
|
|
||||||
def changePeriod(self, n):
|
def changePeriod(self, n):
|
||||||
|
@ -79,11 +81,11 @@ class DeckStats(QDialog):
|
||||||
def loadFin(self, b):
|
def loadFin(self, b):
|
||||||
self.form.web.page().mainFrame().setScrollPosition(self.oldPos)
|
self.form.web.page().mainFrame().setScrollPosition(self.oldPos)
|
||||||
|
|
||||||
def refresh(self):
|
def refresh(self, background=False):
|
||||||
self.mw.progress.start(immediate=True)
|
self.mw.progress.start(immediate=True)
|
||||||
self.oldPos = self.form.web.page().mainFrame().scrollPosition()
|
self.oldPos = self.form.web.page().mainFrame().scrollPosition()
|
||||||
stats = self.mw.col.stats()
|
stats = self.mw.col.stats()
|
||||||
stats.wholeCollection = self.wholeCollection
|
stats.wholeCollection = self.wholeCollection
|
||||||
self.report = stats.report(type=self.period)
|
self.report = stats.report(type=self.period, background=background)
|
||||||
self.form.web.setHtml(self.report)
|
self.form.web.setHtml(self.report)
|
||||||
self.mw.progress.finish()
|
self.mw.progress.finish()
|
||||||
|
|
Loading…
Reference in a new issue