remove conditional when disabling nodes

This commit is contained in:
Lera Elvoé 2022-06-29 13:44:52 +03:00
parent d309c40fc3
commit 2284a1d1dd

View File

@ -1,8 +1,13 @@
extends Control extends Control
const SERVER_STATUS_TEXT: Dictionary = { const SERVER_STATUS_TEXT: Dictionary = {
"RUNNING": "Server is running!", true: "Server is running!",
"NOT_RUNNING": "Server is not running." false: "Server is not running.",
}
const START_BUTTON_SERVER_TEXT: Dictionary = {
true: "Stop server",
false: "Start server",
} }
const ACCEPTED_FILE_FORMATS := ["md"] # server should ignore these file types when adding endpoints const ACCEPTED_FILE_FORMATS := ["md"] # server should ignore these file types when adding endpoints
@ -148,23 +153,15 @@ func _on_OpenServerFolderButton_pressed() -> void:
func set_server_running(running: bool) -> void: func set_server_running(running: bool) -> void:
is_server_running = running is_server_running = running
if is_server_running:
server_status_label.text = SERVER_STATUS_TEXT.RUNNING
start_server_button.text = "Stop server"
port_spin_box.editable = false
document_date_lineedit.editable = false
document_title_lineedit.editable = false
document_input_textedit.readonly = true
_set_file_tree_disabled(true) port_spin_box.editable = !running
else: document_date_lineedit.editable = !running
server_status_label.text = SERVER_STATUS_TEXT.NOT_RUNNING document_title_lineedit.editable = !running
start_server_button.text = "Start server" document_input_textedit.readonly = running
port_spin_box.editable = !false _set_file_tree_disabled(running)
document_date_lineedit.editable = !false
document_title_lineedit.editable = !false server_status_label.text = SERVER_STATUS_TEXT[running]
document_input_textedit.readonly = !true start_server_button.text = START_BUTTON_SERVER_TEXT[running]
_set_file_tree_disabled(false)
func _generate_filestxt(): func _generate_filestxt():