сохранение/загрузка в эмс-г на доработке
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -35,7 +35,7 @@ window/size/initial_position_type=0
|
||||
|
||||
[editor]
|
||||
|
||||
run/main_run_args="-- testsave-path"
|
||||
run/main_run_args="-- addr 3"
|
||||
|
||||
[rendering]
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user