From 659e0e2c125772600079854bef65806f65a5a358 Mon Sep 17 00:00:00 2001 From: "chris.sutcliffe" Date: Tue, 14 Dec 2021 01:40:58 +0000 Subject: add file reload from disk feature, correct typo in comments --- src/PythonIDE/src/esotericFORTRANIDE.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PythonIDE/src/esotericFORTRANIDE.py b/src/PythonIDE/src/esotericFORTRANIDE.py index 190484d..054d131 100644 --- a/src/PythonIDE/src/esotericFORTRANIDE.py +++ b/src/PythonIDE/src/esotericFORTRANIDE.py @@ -44,6 +44,7 @@ class Application(tk.Tk): self.bind('', lambda a: self.open_file()) self.bind('', lambda a: self.save_file()) self.bind('', lambda a: self.save_file_as()) + self.bind('', lambda a: self.reload_file()) self.bind('', lambda a: self.results_pane.clear_results()) self.bind('', lambda a: self.execute()) self.protocol("WM_DELETE_WINDOW", self.exit) @@ -54,7 +55,7 @@ class Application(tk.Tk): def open_file(self): """Called when the user selects the button to open a file or the - nessicary keyboard shortcuts. File is opened and inserted into the tk.Text + necessary keyboard shortcuts. File is opened and inserted into the tk.Text """ dia = filedialogue.askopenfilename( initialdir = self.__get_initial_dir(), @@ -84,6 +85,10 @@ class Application(tk.Tk): self.current_file = f.name self.title("esotericFORTRAN IDE - %s" % str(f.name)) + def reload_file(self): + with open(self.current_file, "r") as f: + self.fortran_frame.replace_text_with("".join(f.readlines())) + def exit(self): print("exit") exit() @@ -174,6 +179,11 @@ class ApplicationMenu(tk.Menu): accelerator = "Ctrl+Shift+S", command = self.parent.save_file_as ) + self.file_menu.add_command( + label = "Reload File From Disk", + accelerator = "F3", + command = self.parent.reload_file + ) self.file_menu.add_separator() self.file_menu.add_command( label = "Exit", -- cgit v1.2.3