Pre code cleanup

This commit is contained in:
lwark
2024-09-25 13:04:08 -05:00
parent b0e9f9996d
commit 4c7b737326
11 changed files with 253 additions and 64 deletions

View File

@@ -31,6 +31,11 @@ def select_open_file(obj: QMainWindow, file_extension: str | None = None) -> Pat
else:
fname = Path(
QFileDialog.getOpenFileName(obj, 'Open file', home_dir, filter=f"{file_extension}(*.{file_extension})")[0])
if not fname.exists():
raise FileNotFoundError(f"File {fname.__str__()} could not be found.")
if fname.__str__() == ".":
logger.warning(f"No file selected, cancelling.")
return
obj.last_dir = fname.parent
return fname