From e332c4c818be11eb64bb7af340c80b768657d15a Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 30 Mar 2024 17:28:52 +0100 Subject: [PATCH] When saving flash file, ask whether to overwrite existing file --- src/python/adgui.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/python/adgui.py b/src/python/adgui.py index e3023a1f..5790b9fe 100755 --- a/src/python/adgui.py +++ b/src/python/adgui.py @@ -713,6 +713,14 @@ class adgui(QObject): else: self.log("Internal error: cannot determine file format", ad.MSG_ERROR) return + fname = self.flashname + p = pathlib.Path(fname) + if p.is_file(): + result = QMessageBox.question(self.memories, + f"Overwrite {fname}?", + f"Do you want to overwrite {fname}?") + if result != QMessageBox.StandardButton.Yes: + return amnt = ad.fileio(ad.FIO_WRITE, self.flashname, fmt, self.dev, "flash", -1) self.log(f"Wrote {amnt} bytes to {self.flashname}")