From b72ce6a66cec6a81bc40e1894383a1a5a38ff0b4 Mon Sep 17 00:00:00 2001 From: Huy Pham <42948410+hpham@users.noreply.github.com> Date: Wed, 4 Mar 2020 11:49:09 -0800 Subject: [PATCH 1/3] allow editable Edit - Preferences - Terminal --- daemon/core/gui/dialogs/preferences.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/daemon/core/gui/dialogs/preferences.py b/daemon/core/gui/dialogs/preferences.py index 2f728416..fdd613b5 100644 --- a/daemon/core/gui/dialogs/preferences.py +++ b/daemon/core/gui/dialogs/preferences.py @@ -57,10 +57,7 @@ class PreferencesDialog(Dialog): label = ttk.Label(frame, text="Terminal") label.grid(row=2, column=0, pady=PADY, padx=PADX, sticky="w") combobox = ttk.Combobox( - frame, - textvariable=self.terminal, - values=appconfig.TERMINALS, - state="readonly", + frame, textvariable=self.terminal, values=appconfig.TERMINALS ) combobox.grid(row=2, column=1, sticky="ew") From 7dee59e86e4c1fbc941ec802e737b95c786f5060 Mon Sep 17 00:00:00 2001 From: Huy Pham <42948410+hpham@users.noreply.github.com> Date: Wed, 4 Mar 2020 13:25:22 -0800 Subject: [PATCH 2/3] New Session command deletes the current session if it is not in runtime else prompt save running session, and then creates the new session --- daemon/core/gui/menuaction.py | 4 ++++ daemon/core/gui/menubar.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/core/gui/menuaction.py b/daemon/core/gui/menuaction.py index 95699d4c..609367b6 100644 --- a/daemon/core/gui/menuaction.py +++ b/daemon/core/gui/menuaction.py @@ -192,3 +192,7 @@ class MenuAction: logging.error("unexpected number of recent files") self.app.save_config() self.app.menubar.update_recent_files() + + def new_session(self): + self.prompt_save_running_session() + self.app.core.create_new_session() diff --git a/daemon/core/gui/menubar.py b/daemon/core/gui/menubar.py index f4c12014..385e0ca1 100644 --- a/daemon/core/gui/menubar.py +++ b/daemon/core/gui/menubar.py @@ -49,7 +49,7 @@ class Menubar(tk.Menu): menu.add_command( label="New Session", accelerator="Ctrl+N", - command=self.app.core.create_new_session, + command=self.menuaction.new_session, ) self.app.bind_all("", lambda e: self.app.core.create_new_session()) menu.add_command( From f50c1e4db4c712cc2af4474112c40b22593524e5 Mon Sep 17 00:00:00 2001 From: Huy Pham <42948410+hpham@users.noreply.github.com> Date: Wed, 4 Mar 2020 14:15:02 -0800 Subject: [PATCH 3/3] keep track of opened, saved file to appropriately prompt save xml when needed, add Save As menu option --- daemon/core/gui/menuaction.py | 2 ++ daemon/core/gui/menubar.py | 1 + 2 files changed, 3 insertions(+) diff --git a/daemon/core/gui/menuaction.py b/daemon/core/gui/menuaction.py index 609367b6..3d7ee154 100644 --- a/daemon/core/gui/menuaction.py +++ b/daemon/core/gui/menuaction.py @@ -90,6 +90,7 @@ class MenuAction: if file_path: self.add_recent_file_to_gui_config(file_path) self.app.core.save_xml(file_path) + self.app.core.xml_file = file_path def file_open_xml(self, event: tk.Event = None): init_dir = self.app.core.xml_dir @@ -196,3 +197,4 @@ class MenuAction: def new_session(self): self.prompt_save_running_session() self.app.core.create_new_session() + self.app.core.xml_file = None diff --git a/daemon/core/gui/menubar.py b/daemon/core/gui/menubar.py index 385e0ca1..70198fba 100644 --- a/daemon/core/gui/menubar.py +++ b/daemon/core/gui/menubar.py @@ -57,6 +57,7 @@ class Menubar(tk.Menu): ) self.app.bind_all("", self.menuaction.file_open_xml) menu.add_command(label="Save", accelerator="Ctrl+S", command=self.save) + menu.add_command(label="Save As", command=self.menuaction.file_save_as_xml) menu.add_command(label="Reload", underline=0, state=tk.DISABLED) self.app.bind_all("", self.save)