diff options
author | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-14 17:34:30 +0000 |
---|---|---|
committer | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-14 17:34:30 +0000 |
commit | 2c7c11bffc7a6009a544d7838cc4f58bd723b79f (patch) | |
tree | d291a1d61c6b298442155017df4218ebd365920f /src/PythonIDE | |
parent | b85a03d829d16ce053526ff46f19e19185fad992 (diff) | |
parent | 659e0e2c125772600079854bef65806f65a5a358 (diff) | |
download | esotericFORTRAN-2c7c11bffc7a6009a544d7838cc4f58bd723b79f.tar.gz esotericFORTRAN-2c7c11bffc7a6009a544d7838cc4f58bd723b79f.zip |
Merge branch 'main' of https://github.com/AlfieEagleton/EsotericProjectGroup12
Diffstat (limited to 'src/PythonIDE')
-rw-r--r-- | src/PythonIDE/src/esotericFORTRANIDE.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/PythonIDE/src/esotericFORTRANIDE.py b/src/PythonIDE/src/esotericFORTRANIDE.py index 721e629..054d131 100644 --- a/src/PythonIDE/src/esotericFORTRANIDE.py +++ b/src/PythonIDE/src/esotericFORTRANIDE.py @@ -44,6 +44,7 @@ class Application(tk.Tk): self.bind('<Control-o>', lambda a: self.open_file()) self.bind('<Control-s>', lambda a: self.save_file()) self.bind('<Control-S>', lambda a: self.save_file_as()) + self.bind('<F3>', lambda a: self.reload_file()) self.bind('<F4>', lambda a: self.results_pane.clear_results()) self.bind('<F5>', 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", @@ -185,7 +195,7 @@ class ApplicationMenu(tk.Menu): self.add_cascade(label = "Run", menu = self.run_menu) self.run_menu.add_command( label = "Clear results", - command = self.parent.results_pane.clear_results(), + command = self.parent.results_pane.clear_results, accelerator = "F4" ) self.run_menu.add_command( |