disable file tree editing while server is running

This commit is contained in:
Lera Elvoé 2022-06-29 13:37:03 +03:00
parent fc1ca1e1b0
commit d309c40fc3

View File

@ -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