From 89f35aab7e7dcd9233c45054b3e68a4f71f0839c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lehnhoff?= <loic.lehnhoff@gmail.com> Date: Fri, 4 Aug 2023 09:25:00 +0200 Subject: [PATCH] Added saving of parameters & improved popup clarity --- interface.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/interface.py b/interface.py index 2d982ad..a6c01f1 100644 --- a/interface.py +++ b/interface.py @@ -299,10 +299,10 @@ class App(object): self.root.mainloop() def on_close(self): - save = Popup(prompt="Save and exit?", options=["Yes", "No", "Cancel"]).pressed + save = Popup(prompt="Save and exit?", options=["Yes", "Exit without saving", "Cancel"]).pressed if save == "Yes": self._quit() - if save == "No": + if save == "Exit without saving": self.root.quit() self.root.destroy() else: @@ -763,10 +763,25 @@ class App(object): ------- None : Saves coords in a json file, quits and destroys root. """ + # save results save_dict( self.klicker.coords, self.DIR_OUT, os.path.basename(self.WAVEFILE)[:-4]+"-contours.json") - + + # save parameters + save_dict( + { + "PCEN": (self.switch_view_button['text'] == "Switch to PCEN"), + "SR": self.NEW_SR, + "NFFT":self.NFFT, + "HOP_LENGTH":self.HOP_LENGTH, + "CLIPPING":self.CLIPPING + }, + os.path.join(self.DIR_OUT, "parameters"), + os.path.basename(self.WAVEFILE)[:-4]+"-params.json" + ) + + # quit window self.root.quit() self.root.destroy() \ No newline at end of file -- GitLab