diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-11-30 18:46:47 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-11-30 18:46:47 +0000 |
commit | f6da53ee3575696ed955fef831b9e5380c83dce1 (patch) | |
tree | b8058a8910c80c79cb6fa11c2b01c3f1a15a948f /src | |
parent | 0f5bb5efa6bc534392cf9b15ed05e7a383ad5e2a (diff) | |
download | esotericFORTRAN-f6da53ee3575696ed955fef831b9e5380c83dce1.tar.gz esotericFORTRAN-f6da53ee3575696ed955fef831b9e5380c83dce1.zip |
added save as and new file implementations
Diffstat (limited to 'src')
-rw-r--r-- | src/PythonIDE/readme.md | 5 | ||||
-rw-r--r-- | src/PythonIDE/src/esotericFORTRANIDE.py | 15 | ||||
-rw-r--r-- | src/PythonIDE/src/fortranText.py | 3 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/PythonIDE/readme.md b/src/PythonIDE/readme.md new file mode 100644 index 0000000..c346509 --- /dev/null +++ b/src/PythonIDE/readme.md @@ -0,0 +1,5 @@ +# Python esotericFORTRAN IDE + +- It's made with python, no non-default python libraries are needed +- `java` must be on the path for it to work +- The `.jar` must be compiled and set as the first argument (an example `.bat` is here)
\ No newline at end of file diff --git a/src/PythonIDE/src/esotericFORTRANIDE.py b/src/PythonIDE/src/esotericFORTRANIDE.py index 4270a35..bfcf9b6 100644 --- a/src/PythonIDE/src/esotericFORTRANIDE.py +++ b/src/PythonIDE/src/esotericFORTRANIDE.py @@ -41,7 +41,8 @@ class Application(tk.Tk): self.protocol("WM_DELETE_WINDOW", self.exit) def new_file(self): - print("new file") + self.fortran_frame.clear() + self.save_file_as() def open_file(self): dia = filedialogue.askopenfilename( @@ -63,7 +64,14 @@ class Application(tk.Tk): f.write(self.fortran_frame.get_text()) def save_file_as(self): - print("save file as") + with filedialogue.asksaveasfile( + defaultextension = ".ft", + initialdir = self.__get_initial_dir(), + filetypes = (("FORTRAN Files", ".ft"), ("Text Files", ".txt"), ("All files", "*.*")) + ) as f: + f.write(self.fortran_frame.get_text()) + self.current_file = f.name + self.title("esotericFORTRAN IDE - %s" % str(f.name)) def exit(self): print("exit") @@ -107,9 +115,6 @@ class Application(tk.Tk): else: self.results_pane.append_results_line("Build Failed %s\n" % str(datetime.datetime.now())) - - - def __get_initial_dir(self): examples_path = os.path.join("..", "examples") if not os.path.exists(examples_path): diff --git a/src/PythonIDE/src/fortranText.py b/src/PythonIDE/src/fortranText.py index 381b41a..b88ff89 100644 --- a/src/PythonIDE/src/fortranText.py +++ b/src/PythonIDE/src/fortranText.py @@ -11,6 +11,9 @@ class FortranText(tk.Frame): self.txt_fortran = ScrolledText(self) self.txt_fortran.pack(fill = tk.BOTH, expand = True) + def clear(self): + self.txt_fortran.delete(0.0, tk.END) + def replace_text_with(self, newtext): self.txt_fortran.delete(0.0, tk.END) self.txt_fortran.insert(tk.END, newtext) |