From b454d6f1699bf1a806294b482227d98a2b673c96 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 10 Sep 2017 16:42:29 +1000 Subject: [PATCH] default to desktop in getSaveFile; don't force desktop in stats --- aqt/stats.py | 5 +---- aqt/utils.py | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/aqt/stats.py b/aqt/stats.py index 157815272..9b68ff109 100644 --- a/aqt/stats.py +++ b/aqt/stats.py @@ -52,17 +52,14 @@ class DeckStats(QDialog): callback() def _imagePath(self): - desktopPath = QStandardPaths.writableLocation( - QStandardPaths.DesktopLocation) name = time.strftime("-%Y-%m-%d@%H-%M-%S.pdf", time.localtime(time.time())) name = "anki-"+_("stats")+name - file = os.path.join(desktopPath, name) file = getSaveFile(self, title=_("Save PDF"), dir_description="stats", key="stats", ext=".pdf", - fname=file) + fname=name) return file def saveImage(self): diff --git a/aqt/utils.py b/aqt/utils.py index 111f646b2..3a6fe4904 100644 --- a/aqt/utils.py +++ b/aqt/utils.py @@ -279,7 +279,9 @@ def getSaveFile(parent, title, dir_description, key, ext, fname=None): """Ask the user for a file to save. Use DIR_DESCRIPTION as config variable. The file dialog will default to open with FNAME.""" config_key = dir_description + 'Directory' - base = aqt.mw.pm.profile.get(config_key, aqt.mw.pm.base) + + desktopPath = QStandardPaths.writableLocation(QStandardPaths.DesktopLocation) + base = aqt.mw.pm.profile.get(config_key, desktopPath) path = os.path.join(base, fname) file = QFileDialog.getSaveFileName( parent, title, path, "{0} (*{1})".format(key, ext),