diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f56b75d18..c54faccb2 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -99,6 +99,7 @@ Sachin Govind Bruce Harris Patric Cunha Brayan Oliveira +Luka Warren ******************** diff --git a/qt/aqt/about.py b/qt/aqt/about.py index 116408b1c..79c2e758e 100644 --- a/qt/aqt/about.py +++ b/qt/aqt/about.py @@ -225,6 +225,7 @@ def show(mw: aqt.AnkiQt) -> QDialog: "Sergio Quintero", "Nicholas Flint", "Daniel Vieira Memoria10X", + "Luka Warren", ) ) diff --git a/qt/aqt/stats.py b/qt/aqt/stats.py index 90a3af964..6af03e118 100644 --- a/qt/aqt/stats.py +++ b/qt/aqt/stats.py @@ -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: