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 # it's a verbatim apkg export, so place on desktop instead of
# choosing file; use homedir if no desktop # choosing file; use homedir if no desktop
usingHomedir = False usingHomedir = False
file = os.path.join(QDesktopServices.storageLocation( file = os.path.join(QStandardPaths.writableLocation(
QDesktopServices.DesktopLocation), "collection.apkg") QStandardPaths.DesktopLocation), "collection.apkg")
if not os.path.exists(os.path.dirname(file)): if not os.path.exists(os.path.dirname(file)):
usingHomedir = True usingHomedir = True
file = os.path.join(QDesktopServices.storageLocation( file = os.path.join(QStandardPaths.writableLocation(
QDesktopServices.HomeLocation), "collection.apkg") QStandardPaths.HomeLocation), "collection.apkg")
if os.path.exists(file): if os.path.exists(file):
if usingHomedir: if usingHomedir:
question = _("%s already exists in your home directory. Overwrite it?") 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", name = time.strftime("-%Y-%m-%d@%H-%M-%S.png",
time.localtime(time.time())) time.localtime(time.time()))
name = "anki-"+_("stats")+name name = "anki-"+_("stats")+name
desktopPath = QDesktopServices.storageLocation(QDesktopServices.DesktopLocation) desktopPath = QStandardPaths.writableLocation(
QStandardPaths.DesktopLocation)
if not os.path.exists(desktopPath): if not os.path.exists(desktopPath):
os.mkdir(desktopPath) os.mkdir(desktopPath)
path = os.path.join(desktopPath, name) path = os.path.join(desktopPath, name)