fix exporting & one bug in stats image export

This commit is contained in:
Damien Elmes 2016-07-05 19:52:26 +10:00
parent d9fe0ef6e7
commit d831bbee5f
2 changed files with 6 additions and 5 deletions

View File

@ -68,12 +68,12 @@ class ExportDialog(QDialog):
# it's a verbatim apkg export, so place on desktop instead of
# choosing file; use homedir if no desktop
usingHomedir = False
file = os.path.join(QDesktopServices.storageLocation(
QDesktopServices.DesktopLocation), "collection.apkg")
file = os.path.join(QStandardPaths.writableLocation(
QStandardPaths.DesktopLocation), "collection.apkg")
if not os.path.exists(os.path.dirname(file)):
usingHomedir = True
file = os.path.join(QDesktopServices.storageLocation(
QDesktopServices.HomeLocation), "collection.apkg")
file = os.path.join(QStandardPaths.writableLocation(
QStandardPaths.HomeLocation), "collection.apkg")
if os.path.exists(file):
if usingHomedir:
question = _("%s already exists in your home directory. Overwrite it?")

View File

@ -49,7 +49,8 @@ class DeckStats(QDialog):
name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
time.localtime(time.time()))
name = "anki-"+_("stats")+name
desktopPath = QDesktopServices.storageLocation(QDesktopServices.DesktopLocation)
desktopPath = QStandardPaths.writableLocation(
QStandardPaths.DesktopLocation)
if not os.path.exists(desktopPath):
os.mkdir(desktopPath)
path = os.path.join(desktopPath, name)