diff options
author | chris.sutcliffe <ctd.sutcliffe@gmail.com> | 2021-12-14 01:40:58 +0000 |
---|---|---|
committer | chris.sutcliffe <ctd.sutcliffe@gmail.com> | 2021-12-14 01:40:58 +0000 |
commit | 659e0e2c125772600079854bef65806f65a5a358 (patch) | |
tree | ad1b1fbb97d55ee88307bbe1a5d5d3d15e190ef0 /src | |
parent | 70444a3c067fd72d7580d6c483ffad28c6c24f6a (diff) | |
download | esotericFORTRAN-659e0e2c125772600079854bef65806f65a5a358.tar.gz esotericFORTRAN-659e0e2c125772600079854bef65806f65a5a358.zip |
add file reload from disk feature, correct typo in comments
Diffstat (limited to 'src')
-rw-r--r-- | src/PythonIDE/src/esotericFORTRANIDE.py | 12 |
1 files changed, 11 insertions, 1 deletions
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('<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", |