diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index c8a3161..193ec06 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -342,14 +342,6 @@ theme_override_font_sizes/font_size = 14 theme_override_styles/pressed = SubResource("StyleBoxFlat_p247y") text = "Сохранить" -[node name="notice" type="Label" parent="Background/switch_panel/save_config"] -self_modulate = Color(1, 1, 0.941176, 1) -layout_mode = 0 -offset_left = 234.0 -offset_top = 88.0 -offset_right = 418.0 -offset_bottom = 111.0 - [node name="load_config" type="Button" parent="Background/switch_panel" groups=["select_grp"]] layout_mode = 0 offset_left = 16.0 @@ -362,13 +354,6 @@ theme_override_font_sizes/font_size = 14 theme_override_styles/pressed = SubResource("StyleBoxFlat_p247y") text = "Загрузить" -[node name="notice" type="Label" parent="Background/switch_panel/load_config"] -layout_mode = 0 -offset_left = 239.0 -offset_top = 77.0 -offset_right = 417.0 -offset_bottom = 100.0 - [node name="burgerButton" type="TextureButton" parent="Background/switch_panel"] self_modulate = Color(1, 1, 0.941176, 1) layout_mode = 0 @@ -448,14 +433,27 @@ texture_pressed = ExtResource("8_iuer1") ignore_texture_size = true stretch_mode = 0 -[node name="lbl_commit" type="Label" parent="Background"] +[node name="notice" type="GridContainer" parent="Background"] layout_mode = 0 -offset_left = 1490.0 -offset_top = 957.0 -offset_right = 1666.0 -offset_bottom = 981.0 +offset_left = 280.0 +offset_top = 944.0 +offset_right = 864.0 +offset_bottom = 984.0 +columns = 4 + +[node name="lbl_commit" type="Label" parent="Background/notice"] +layout_mode = 2 theme_override_colors/font_color = Color(1, 1, 0.941176, 1) +[node name="bind_addr" type="Label" parent="Background/notice"] +layout_mode = 2 + +[node name="bind_port" type="Label" parent="Background/notice"] +layout_mode = 2 + +[node name="load_notice" type="Label" parent="Background/notice"] +layout_mode = 2 + [node name="TabContainer" type="TabContainer" parent="."] offset_left = 216.0 offset_top = 39.0 diff --git a/project.godot b/project.godot index dcf7aef..e0ee6cb 100644 --- a/project.godot +++ b/project.godot @@ -35,7 +35,7 @@ window/size/initial_position_type=0 [editor] -run/main_run_args="-- testsave-path" +run/main_run_args="-- addr 3" [rendering] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 1a06bde..4bcbfd7 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -29,7 +29,9 @@ var modul_um: Array = [0, 0, 0, 0] func _ready() -> void: - $Background/lbl_commit.text = commit.VCS_HEAD + $Background/notice/lbl_commit.text = commit.VCS_HEAD + $Background/notice/bind_addr.text = '/Базовый адресс: %s' % Constants.UNICAST_ADDRESS + $Background/notice/bind_port.text = '/Базовый порт: %s ' % Constants.UNICAST_PORT # Считывание аргументов с консоли (путь сохранения) #var args = OS.get_cmdline_user_args() @@ -609,10 +611,10 @@ func _save_selected_file(file_path: String): if file != null: file.store_string(JSON.stringify(param_ems_g)) file.close() - $Background/switch_panel/save_config/notice.visible = true - $Background/switch_panel/save_config/notice.text = '✅ Файл %s записан успешно!' % file_path + $Background/notice/load_notice.text = '✅ Файл %s записан успешно!' % file_path + $Background/notice/load_notice.visible = true await get_tree().create_timer(2.0).timeout - $Background/switch_panel/save_config/notice.visible = false + $Background/notice/load_notice.visible = false func _on_load_config(): @@ -640,11 +642,11 @@ func _load_selected_file(): if error == OK: var data_received: Dictionary = json.data if typeof(data_received) == TYPE_DICTIONARY: - $Background/switch_panel/load_config/notice.visible = true - $Background/switch_panel/load_config/notice.text = '✅ Файл %s прочитан успешно' % file_path - await get_tree().create_timer(2.0).timeout - $Background/switch_panel/load_config/notice.visible = false + $Background/notice/load_notice.text = '✅ Файл %s прочитан успешно' % file_path + $Background/notice/load_notice.visible = true emit_signal('write_ems_g_start', data_received) + await get_tree().create_timer(2.0).timeout + $Background/notice/load_notice.visible = false else: print("Несоответствующий тип данных!") else: diff --git a/scripts/constants.gd b/scripts/constants.gd index 135aeaa..2c6131e 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -1,6 +1,6 @@ extends Node -const UNICAST_PORT: int = 50003 -const UNICAST_ADDRESS: String = '10.1.1.3' +var UNICAST_PORT: int = 50100 +var UNICAST_ADDRESS: String = '10.1.1.100' const BROADCAST_PORT: int = 50000 const DEFAULT_ADDRESS: String = '10.1.1.11' const DEFAULT_PORT: String = '50011' @@ -425,6 +425,12 @@ var FS_ATT: Dictionary = { func _ready() -> void: + # Считывание аргументов с консоли (путь сохранения) + var args = OS.get_cmdline_user_args() + for i in range(args.size()): + if args[i] == "addr" and i + 1 < args.size(): + UNICAST_PORT = 50000 + int(args[i + 1]) + UNICAST_ADDRESS = '10.1.1.%s' % args[i + 1] read_file()