disable file tree editing while server is running
This commit is contained in:
parent
fc1ca1e1b0
commit
d309c40fc3
11
ServerUI.gd
11
ServerUI.gd
@ -155,6 +155,8 @@ func set_server_running(running: bool) -> void:
|
|||||||
document_date_lineedit.editable = false
|
document_date_lineedit.editable = false
|
||||||
document_title_lineedit.editable = false
|
document_title_lineedit.editable = false
|
||||||
document_input_textedit.readonly = true
|
document_input_textedit.readonly = true
|
||||||
|
|
||||||
|
_set_file_tree_disabled(true)
|
||||||
else:
|
else:
|
||||||
server_status_label.text = SERVER_STATUS_TEXT.NOT_RUNNING
|
server_status_label.text = SERVER_STATUS_TEXT.NOT_RUNNING
|
||||||
start_server_button.text = "Start server"
|
start_server_button.text = "Start server"
|
||||||
@ -162,6 +164,7 @@ func set_server_running(running: bool) -> void:
|
|||||||
document_date_lineedit.editable = !false
|
document_date_lineedit.editable = !false
|
||||||
document_title_lineedit.editable = !false
|
document_title_lineedit.editable = !false
|
||||||
document_input_textedit.readonly = !true
|
document_input_textedit.readonly = !true
|
||||||
|
_set_file_tree_disabled(false)
|
||||||
|
|
||||||
|
|
||||||
func _generate_filestxt():
|
func _generate_filestxt():
|
||||||
@ -235,6 +238,14 @@ func _get_file_content(path: String) -> String:
|
|||||||
return content
|
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:
|
func _on_FileTreeContextMenu_id_pressed(id: int) -> void:
|
||||||
var idx = current_tree_selection.get_metadata(0)["id"] as int
|
var idx = current_tree_selection.get_metadata(0)["id"] as int
|
||||||
var fd = working_files[idx] as FileDef
|
var fd = working_files[idx] as FileDef
|
||||||
|
Loading…
Reference in New Issue
Block a user