default to desktop in getSaveFile; don't force desktop in stats

This commit is contained in:
Damien Elmes 2017-09-10 16:42:29 +10:00
parent 1e2f934480
commit b454d6f169
2 changed files with 4 additions and 5 deletions

View File

@ -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):

View File

@ -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),