Pamhyr: Fix save as method and minor change.

0.0.9
Pierre-Antoine Rouby 2024-07-01 14:04:18 +02:00
parent 60336c25f1
commit 460450f524
2 changed files with 13 additions and 2 deletions

View File

@ -117,6 +117,9 @@ class Study(SQLModel):
if ".backup" in self.filename:
is_new = True
if not os.path.exists(self.filename):
is_new = True
self._init_db_file(self.filename, is_new=is_new)
self.commit()

View File

@ -579,9 +579,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
Nothing
"""
if self._study.filename is None or self._study.filename == "":
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
file_name, _ = QFileDialog.getSaveFileName(
self, "Save File",
"", "Pamhyr(*.pamhyr)"
"", "Pamhyr(*.pamhyr)",
options=options,
)
if file_name.rsplit(".", 1)[-1] == "pamhyr":
@ -630,9 +634,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
Returns:
Nothing
"""
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
file_name, _ = QFileDialog.getSaveFileName(
self, "Save File",
"", "Pamhyr(*.pamhyr)"
"", "Pamhyr(*.pamhyr)",
options=options,
)
logger.debug(f"Save study as : {repr(file_name)}")