From d309c40fc3448a42da4c9009394265d7c8708b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 29 Jun 2022 13:37:03 +0300 Subject: [PATCH] disable file tree editing while server is running --- ServerUI.gd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ServerUI.gd b/ServerUI.gd index dedd3bf..3706547 100644 --- a/ServerUI.gd +++ b/ServerUI.gd @@ -155,6 +155,8 @@ func set_server_running(running: bool) -> void: document_date_lineedit.editable = false document_title_lineedit.editable = false document_input_textedit.readonly = true + + _set_file_tree_disabled(true) else: server_status_label.text = SERVER_STATUS_TEXT.NOT_RUNNING start_server_button.text = "Start server" @@ -162,6 +164,7 @@ func set_server_running(running: bool) -> void: document_date_lineedit.editable = !false document_title_lineedit.editable = !false document_input_textedit.readonly = !true + _set_file_tree_disabled(false) func _generate_filestxt(): @@ -235,6 +238,14 @@ func _get_file_content(path: String) -> String: return content +func _set_file_tree_disabled(disabled: bool) -> void: + var root = file_tree.get_root() + var tree_item = root.get_children() as TreeItem + while tree_item != null: + tree_item.set_editable(0, !disabled) + tree_item = tree_item.get_next() + + func _on_FileTreeContextMenu_id_pressed(id: int) -> void: var idx = current_tree_selection.get_metadata(0)["id"] as int var fd = working_files[idx] as FileDef