From 588d301f139bb03c9d35bef2b83461cffab002b2 Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Tue, 27 Feb 2024 11:50:28 +0100 Subject: [PATCH] Cancel export if esc used --- main_c.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main_c.py b/main_c.py index 4a2ccbe..20f0899 100644 --- a/main_c.py +++ b/main_c.py @@ -724,8 +724,12 @@ class KISStopmo(tk.Tk): def trigger_export_animation(self, event): # ~ output_folder = filedialog.askdirectory() - # ~ self.export_filename = "{folder}{sep}{filename}".format(folder=output_folder, sep=os.sep, filename=self.output_filename) + # TODO : Check what happens when closing the window without entering a name + self.export_filename = () self.export_filename = filedialog.asksaveasfilename(defaultextension='.mp4', filetypes=((_("Mp4 files"), '*.mp4'),)) + if not self.export_filename: + # ~ self.export_filename = "{folder}{sep}{filename}".format(folder=os.getcwd(), sep=os.sep, filename=self.output_filename) + return False print(_("Exporting to {}").format(self.export_filename)) self.export_task = asyncio.run(self.export_animation()) # check with self.export_task.done() == True ? https://stackoverflow.com/questions/69350645/proper-way-to-retrieve-the-result-of-tasks-in-asyncio