mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
* Scroll stats to top when exporting (#1114) It's obviously a bit of a "hacky" solution, since it's slightly jarring for users to scroll down, click export, then find themselves all the way at the top again, but it's somewhat less confusing than wondering why your PDF is broken :-) * Clarified comment in stats.py (#1114) * Apply scrolling fix to new stats screen, not legacy stats (dae) Also wait for JS callback before saving the PDF, as JS is executed asynchronously.
This commit is contained in:
parent
72c7d64876
commit
0835129a00
3 changed files with 11 additions and 2 deletions
|
@ -99,6 +99,7 @@ Sachin Govind <sachin.govind.too@gmail.com>
|
|||
Bruce Harris <github.com/bruceharris>
|
||||
Patric Cunha <patricc@agap2.pt>
|
||||
Brayan Oliveira <github.com/BrayanDSO>
|
||||
Luka Warren <github.com/lukawarren>
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -225,6 +225,7 @@ def show(mw: aqt.AnkiQt) -> QDialog:
|
|||
"Sergio Quintero",
|
||||
"Nicholas Flint",
|
||||
"Daniel Vieira Memoria10X",
|
||||
"Luka Warren",
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -83,8 +83,15 @@ class NewDeckStats(QDialog):
|
|||
path = self._imagePath()
|
||||
if not path:
|
||||
return
|
||||
self.form.web.page().printToPdf(path)
|
||||
tooltip(tr.statistics_saved())
|
||||
# When scrolled down in dark mode, the top of the page in the
|
||||
# final PDF will have a white background, making the text and graphs
|
||||
# unreadable. A simple fix for now is to scroll to the top of the
|
||||
# page first.
|
||||
def after_scroll(arg: Any) -> None:
|
||||
self.form.web.page().printToPdf(path)
|
||||
tooltip(tr.statistics_saved())
|
||||
|
||||
self.form.web.evalWithCallback("window.scrollTo(0, 0);", after_scroll)
|
||||
|
||||
# legacy add-ons
|
||||
def changePeriod(self, n: Any) -> None:
|
||||
|
|
Loading…
Reference in a new issue