diff --git a/scenes/эмс-тг/эмс-тг.gd b/scenes/эмс-тг/эмс-тг.gd index 3609c2a2..26c4c5b7 100644 --- a/scenes/эмс-тг/эмс-тг.gd +++ b/scenes/эмс-тг/эмс-тг.gd @@ -3,25 +3,43 @@ extends Panel @export var matrix_conf: Array[Texture] ## [0] - чисто, нет конфликта, [1] - есть наложение частот -@export var unit_names: Array[StringName] ## Имена устройств +@export var index_to_unit_names: Array[StringName] ## Имена устройств (Индекс -> Имя устройства) @export_file('*.tscn') var table_headers: Array[String] @export_file('*.tscn') var table_cells: Array[String] +@export_file('*.png') var image_file_rx: String +@export_file('*.png') var image_file_tx: String +@export var table_column_widths: Array[int] +@export var table_header_widths: Array[int] +@export var table_header_text: Array[String] +var table_cell_row: Array +var name_to_index: Dictionary[StringName, int] ## Имена устройств (Имя устройства -> Индекс) func _ready() -> void: - var unit_trassa = network.get_unit_instance('уарэп-трасса') - unit_trassa.connect('line_changed', Callable(self, 'on_trassa_line_changed')) - signaller.connect('sector_klaster', Callable(self, 'on_sector_klaster').bind(unit_trassa)) - var header_rows = [] + for i in index_to_unit_names.size(): + var nm: = index_to_unit_names[i] + name_to_index[nm] = i + var header_row: = [] for cell_scn in table_headers: - header_rows.append(load(cell_scn)) - $'таблица/сетка'.set_header(header_rows) - $'таблица/сетка'.pin_header($'таблица', self) + header_row.append(load(cell_scn)) + for cell_scn in table_cells: + table_cell_row.append(load(cell_scn)) + + $'таблица/сетка'.set_header(header_row) + $'таблица/сетка'.set_header_text(table_header_text) + $'таблица/сетка'.set_header_property(6, 'image_file', image_file_rx) + $'таблица/сетка'.set_header_property(7, 'image_file', image_file_tx) + + $'таблица/сетка'.set_headers_min_size(table_header_widths) + $'таблица/сетка'.set_columns_min_size(table_column_widths) + $'таблица/сетка'.set_rows_min_hight(32) + $'таблица/сетка'.set_header_min_hight(32) + $'таблица/сетка'.pin_header2() + + for nm in index_to_unit_names: + var yems_unit = network.get_unit_instance(nm) + yems_unit.connect('data_received', on_data_received.bind(nm)) -func on_trassa_line_changed(_unit_trassa): - pass - - -func on_sector_klaster(_data, _unit_trassa): - pass +func on_data_received(data, nm): + print_debug('%s: %d' % [nm, len(data)]) diff --git a/scenes/эмс-тг/эмс-тг.tscn b/scenes/эмс-тг/эмс-тг.tscn index 6d8151e3..2ecf61bb 100644 --- a/scenes/эмс-тг/эмс-тг.tscn +++ b/scenes/эмс-тг/эмс-тг.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=35 format=3 uid="uid://musb21x2u0xs"] +[gd_scene load_steps=31 format=3 uid="uid://musb21x2u0xs"] [ext_resource type="Script" uid="uid://bvlqgv7aapebl" path="res://scenes/эмс-тг/эмс-тг.gd" id="1_b7tfl"] [ext_resource type="Texture2D" uid="uid://djv8fkddcjucs" path="res://data/матрица-чисто.png" id="2_s28jr"] @@ -29,10 +29,6 @@ [ext_resource type="Texture2D" uid="uid://kyrnn1mqpc08" path="res://data/РЛС1.png" id="26_3yebi"] [ext_resource type="Texture2D" uid="uid://cx0f3wcx76u1k" path="res://data/РЛС2.png" id="27_3x2eg"] [ext_resource type="Texture2D" uid="uid://duu8q7sv0jwfh" path="res://data/ННВС.png" id="28_wh3ue"] -[ext_resource type="PackedScene" uid="uid://ch14g46swx74h" path="res://table/header.tscn" id="29_qeixd"] -[ext_resource type="PackedScene" uid="uid://cymcld4mjmlhj" path="res://table/header-image.tscn" id="30_b16f7"] -[ext_resource type="PackedScene" uid="uid://dwphmxstaxn4v" path="res://table/lable.tscn" id="31_2v53x"] -[ext_resource type="PackedScene" uid="uid://cixwl6xi22buo" path="res://scenes/button-six-state/six-state.tscn" id="32_op45j"] [sub_resource type="ButtonGroup" id="ButtonGroup_vwsbs"] allow_unpress = true @@ -42,14 +38,20 @@ offset_top = 35.0 offset_bottom = 35.0 script = ExtResource("1_b7tfl") matrix_conf = Array[Texture]([ExtResource("2_s28jr"), ExtResource("3_its7t")]) +index_to_unit_names = Array[StringName]([&"эмс-ор63", &"эмс-454", &"эмс-го", &"эмс-рлс1", &"эмс-рлс2", &"эмс-ннвс", &"эмс-изделие7", &"эмс-изделие8"]) table_headers = Array[String](["uid://ch14g46swx74h", "uid://ch14g46swx74h", "uid://ch14g46swx74h", "uid://ch14g46swx74h", "uid://ch14g46swx74h", "uid://ch14g46swx74h", "uid://cymcld4mjmlhj", "uid://cymcld4mjmlhj"]) table_cells = Array[String](["uid://dwphmxstaxn4v", "uid://dwphmxstaxn4v", "uid://dwphmxstaxn4v", "uid://dwphmxstaxn4v", "uid://dwphmxstaxn4v", "uid://dwphmxstaxn4v", "uid://cixwl6xi22buo", "uid://cixwl6xi22buo"]) +image_file_rx = "uid://c6etralq2tvxg" +image_file_tx = "uid://c73tjrn8gr00o" +table_column_widths = Array[int]([134, 134, 134, 134, 134, 134, 134, 134]) +table_header_widths = Array[int]([136, 136, 136, 136, 136, 136, 136, 136]) +table_header_text = Array[String](["Кластер", "Состояние", "Время", "Азимут", "Угол места", "Диапазон", "Приём", "Передача"]) [node name="таблица" type="ScrollContainer" parent="."] layout_mode = 0 offset_left = 20.0 -offset_top = 780.0 -offset_right = 1180.0 +offset_top = 800.0 +offset_right = 1190.0 offset_bottom = 1150.0 draw_focus_border = true vertical_scroll_mode = 2 @@ -61,462 +63,6 @@ size_flags_vertical = 3 columns = 8 script = ExtResource("4_bhff3") -[node name="header0" parent="таблица/сетка" instance=ExtResource("29_qeixd")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 7 -text = "Кластер" - -[node name="header7" parent="таблица/сетка" instance=ExtResource("29_qeixd")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 7 -text = "Состояние" - -[node name="header1" parent="таблица/сетка" instance=ExtResource("29_qeixd")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 7 -text = "Время" - -[node name="header2" parent="таблица/сетка" instance=ExtResource("29_qeixd")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 7 -text = "Азимут" - -[node name="header3" parent="таблица/сетка" instance=ExtResource("29_qeixd")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 7 -text = "Угол места" - -[node name="header4" parent="таблица/сетка" instance=ExtResource("29_qeixd")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 7 -text = "Диапазон" - -[node name="header5" parent="таблица/сетка" instance=ExtResource("30_b16f7")] -layout_mode = 2 -size_flags_vertical = 7 -header_text = "Передача" -image_file = "uid://c73tjrn8gr00o" - -[node name="header6" parent="таблица/сетка" instance=ExtResource("30_b16f7")] -layout_mode = 2 -size_flags_vertical = 7 -header_text = "Приём" -image_file = "uid://c6etralq2tvxg" - -[node name="cell_0_1" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "1" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_1" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Активен" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_1" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_1" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_1" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_1" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_1" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 1 - -[node name="cell_7_1" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 1 - -[node name="cell_0_2" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_2" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Активен" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_2" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_2" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_2" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_2" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_2" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 2 - -[node name="cell_7_2" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 1 - -[node name="cell_0_3" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "3" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_3" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Удалён" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_3" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_3" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_3" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_3" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_3" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_7_3" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_0_4" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "4" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_4" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Удалён" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_4" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_4" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "20-60" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_4" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_4" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_4" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_7_4" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_0_5" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "5" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_5" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Удалён" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_5" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_5" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_5" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_5" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_5" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_7_5" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_0_6" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "6" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_6" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Активен" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_6" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_6" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_6" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_6" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_6" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 1 - -[node name="cell_7_6" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 2 - -[node name="cell_0_7" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "7" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_7" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Активен" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_7" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_7" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_7" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_7" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_7" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 1 - -[node name="cell_7_7" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 -state = 1 - -[node name="cell_0_8" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "8" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_1_8" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "Удалён" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_2_8" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "00:02" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_3_8" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "0-360" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_4_8" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "19" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_5_8" parent="таблица/сетка" instance=ExtResource("31_2v53x")] -layout_mode = 2 -size_flags_vertical = 7 -text = "2300-2705" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="cell_6_8" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - -[node name="cell_7_8" parent="таблица/сетка" instance=ExtResource("32_op45j")] -layout_mode = 2 -size_flags_vertical = 7 - [node name="кораблик" type="TextureRect" parent="."] modulate = Color(1, 0.596078, 0.4, 1) layout_mode = 0 @@ -532,19 +78,19 @@ expand_mode = 1 [node name="шкала" type="GridContainer" parent="."] layout_mode = 0 offset_left = 20.0 -offset_top = 262.0 +offset_top = 240.0 offset_right = 1668.0 -offset_bottom = 770.0 +offset_bottom = 771.0 scale = Vector2(0.95, 0.95) columns = 2 -[node name="label0" type="Button" parent="шкала"] +[node name="label0" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_vertical = 7 toggle_mode = true button_group = SubResource("ButtonGroup_vwsbs") text = "ОР-63" -metadata/unit_name = &"ор-63" +metadata/unit_name = &"эмс-ор63" [node name="sub0" type="GridContainer" parent="шкала"] layout_mode = 2 @@ -565,19 +111,19 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label1" type="Button" parent="шкала"] +[node name="label1" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 toggle_mode = true button_group = SubResource("ButtonGroup_vwsbs") text = "454" -metadata/unit_name = &"454" [node name="sub1" type="GridContainer" parent="шкала"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +metadata/unit_name = &"эмс-454" [node name="panel_rx" parent="шкала/sub1" instance=ExtResource("5_6hay3")] layout_mode = 2 @@ -591,19 +137,20 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label2" type="Button" parent="шкала"] +[node name="label2" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 toggle_mode = true button_group = SubResource("ButtonGroup_vwsbs") text = "ГО" -metadata/unit_name = &"го" +metadata/unit_name = &"эмс-го" [node name="sub2" type="GridContainer" parent="шкала"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +metadata/unit_name = &"" [node name="panel_rx" parent="шкала/sub2" instance=ExtResource("5_6hay3")] self_modulate = Color(0.830335, 0.830335, 0.830335, 1) @@ -619,14 +166,14 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label3" type="Button" parent="шкала"] +[node name="label3" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 toggle_mode = true button_group = SubResource("ButtonGroup_vwsbs") text = "РЛС1" -metadata/unit_name = &"рлс1" +metadata/unit_name = &"эмс-рлс1" [node name="sub3" type="GridContainer" parent="шкала"] layout_mode = 2 @@ -645,14 +192,14 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label4" type="Button" parent="шкала"] +[node name="label4" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 toggle_mode = true button_group = SubResource("ButtonGroup_vwsbs") text = "РЛС2" -metadata/unit_name = &"рлс2" +metadata/unit_name = &"эмс-рлс2" [node name="sub4" type="GridContainer" parent="шкала"] layout_mode = 2 @@ -673,14 +220,13 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label5" type="Button" parent="шкала"] +[node name="label5" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 toggle_mode = true button_group = SubResource("ButtonGroup_vwsbs") text = "ННВС" -metadata/unit_name = &"ннвс" [node name="sub5" type="GridContainer" parent="шкала"] layout_mode = 2 @@ -699,7 +245,7 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label6" type="Button" parent="шкала"] +[node name="label6" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 @@ -727,7 +273,7 @@ size_flags_horizontal = 3 size_flags_vertical = 3 image_file = "uid://c6etralq2tvxg" -[node name="label7" type="Button" parent="шкала"] +[node name="label7" type="Button" parent="шкала" groups=["ряд-шкалы"]] layout_mode = 2 size_flags_horizontal = 5 size_flags_vertical = 7 @@ -808,7 +354,7 @@ texture = ExtResource("2_s28jr") [node name="матрица-0-2" type="TextureRect" parent="матрица" groups=["матрица-к"]] layout_mode = 2 -texture = ExtResource("3_its7t") +texture = ExtResource("2_s28jr") [node name="матрица-0-3" type="TextureRect" parent="матрица" groups=["матрица-к"]] layout_mode = 2 diff --git a/scripts/network.gd b/scripts/network.gd index 2cbcf401..2a20876c 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -1,8 +1,7 @@ @tool class_name Network extends Node -const YAU07_PROTO: = {'yau07tx': yau07.YaU07} -const IYEMS_PROTO: = {'iyems-tx': yems_info.YeMSInfo} +const YAU07_PROTO: = {'yau07tx': yau07.YaU07, 'iyems-tx': yems_info.YeMSInfo} const UDP_PROTO: = {'capsrpb': capsrpb.CapsRpb, 'trassa': trassa.Trassa} const TCP_PROTO: = {'5p28': tcp5p28.TCP5P28} const SERIAL_PROTO: = {'spt25': spt25.SPT25} @@ -147,12 +146,15 @@ func create_socket_udp(unit_name: StringName) -> SocketUDP: var bind = st[3] var sock: = SocketUDP.new() sock.set_broadcast_enabled(broad) - var rc: = sock.bind(port, addr) - if rc == Error.OK: - log.info('\"%s\" привязан к %s:%d' % [unit_name, addr, port]) - else: - var errmsg: = error_string(rc) - log.error('привязка \"%s\" к %s:%d не удалась: \"%s\"' % [unit_name, addr, port, errmsg]) + if broad: + log.info('\"%s\" - установлен широковещательный режим' % unit_name) + if bind: + var rc: = sock.bind(port, addr) + if rc == Error.OK: + log.info('\"%s\" привязан к %s:%d' % [unit_name, addr, port]) + else: + var errmsg: = error_string(rc) + log.error('привязка \"%s\" к %s:%d не удалась: \"%s\"' % [unit_name, addr, port, errmsg]) return sock @@ -198,7 +200,8 @@ func _ready() -> void: var sock_navi: = create_socket_udp('навигация') var sock_caps: = create_socket_caps('уарэп-капсрпб') var sock_trassa: = create_socket_caps('уарэп-трасса') - poll_sockets = [sock_unicast, sock_broadcast, sock_caps, sock_navi, sock_trassa] + var sock_yems: = create_socket_udp('эмс-ведущий') + poll_sockets = [sock_unicast, sock_broadcast, sock_caps, sock_navi, sock_trassa, sock_yems] send_sockets['уарэп-яу07-частный'] = sock_unicast send_sockets['уарэп-яу07-общий'] = sock_broadcast send_sockets['уарэп-капсрпб'] = sock_caps @@ -216,6 +219,14 @@ func _ready() -> void: send_sockets['уарэп-яу07-3в'] = sock_unicast send_sockets['уарэп-яу07-3н'] = sock_unicast send_sockets['уарэп-яу07-3к'] = sock_unicast + send_sockets['эмс-ор63'] = sock_yems + send_sockets['эмс-454'] = sock_yems + send_sockets['эмс-го'] = sock_yems + send_sockets['эмс-рлс1'] = sock_yems + send_sockets['эмс-рлс2'] = sock_yems + send_sockets['эмс-ннвс'] = sock_yems + send_sockets['эмс-изделие7'] = sock_yems + send_sockets['эмс-изделие8'] = sock_yems var bind_serials: = [] var bind_modbuses: = [] diff --git a/scripts/settings.gd b/scripts/settings.gd index 0aa2cacd..57fffc36 100644 --- a/scripts/settings.gd +++ b/scripts/settings.gd @@ -27,15 +27,16 @@ var UnitProfiles: Dictionary[StringName, Array] = { \ 'уарэп-яу07-3к': ['yau07tx', ['10.1.1.33', 50033, false, false], 'IP-адрес прибора ПРД-К3'], 'навигация': ['navi', ['*', 60000, true, true ], 'IP-адрес на котором принимают сообщения от навигации'], - # <Название: > - 'ор-63': ['iyems-tx', [ '192.168.10.1', 60001 ], 'IP-адрес для приёма докладов от информационному ЭМС устройств'], - '454': ['iyems-tx', ['192.168.10.2', 60002 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], - 'го': ['iyems-tx', ['192.168.10.3', 60003 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], - 'рлс1': ['iyems-tx', ['192.168.10.4', 60004 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], - 'рлс2': ['iyems-tx', ['192.168.10.5', 60005 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], - 'ннвс': ['iyems-tx', ['192.168.10.6', 60006 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], - 'изделие7': ['iyems-tx', ['192.168.10.7', 60007 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], - 'изделие8': ['iyems-tx', ['192.168.10.8', 60008 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], + # < Название: [протокол, [адрес, порт, широковещательное, привязывать], комментарий > + 'эмс-ведущий': ['iyems-rx', ['192.168.10.1', 61000, false, true], 'IP-адрес для приёма докладов от информационных ЭМС устройств'], + 'эмс-ор63': ['iyems-tx', ['192.168.10.1', 61001, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-454': ['iyems-tx', ['192.168.10.2', 61002, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-го': ['iyems-tx', ['192.168.10.3', 61003, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-рлс1': ['iyems-tx', ['192.168.10.4', 61004, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-рлс2': ['iyems-tx', ['192.168.10.5', 61005, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-ннвс': ['iyems-tx', ['192.168.10.6', 61006, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-изделие7': ['iyems-tx', ['192.168.10.7', 61007, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], + 'эмс-изделие8': ['iyems-tx', ['192.168.10.8', 61008, false, false], 'IP-адрес для передачи команд информационному ЭМС устройству'], # < Название: Протокол, < Адрес, Порт получения >, Комментарий > 'уарэп-5п28': ['5p28', ['127.0.0.1', 50000], 'IP-адрес комплекса 5П-28'], diff --git a/table/header-image.tscn b/table/header-image.tscn index 7bfbaabb..c57f29c2 100644 --- a/table/header-image.tscn +++ b/table/header-image.tscn @@ -5,13 +5,13 @@ [sub_resource type="GDScript" id="GDScript_63652"] script/source = "extends GridContainer -@export var header_text: String: +@export var text: String: set(val): - header_text = val + text = val if is_inside_tree(): $label.text = val get: - return header_text + return text @export_file var image_file: String: @@ -24,8 +24,9 @@ script/source = "extends GridContainer func _enter_tree() -> void: - $image.texture = load(image_file) - $label.text = header_text + if ResourceLoader.exists(image_file): + $image.texture = load(image_file) + $label.text = text " [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nbmfn"] @@ -36,8 +37,10 @@ corner_radius_bottom_right = 4 corner_radius_bottom_left = 4 [node name="header-image" type="GridContainer"] -offset_right = 91.0 -offset_bottom = 25.0 +offset_right = 100.0 +offset_bottom = 19.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 columns = 2 script = SubResource("GDScript_63652") diff --git a/table/table.gd b/table/table.gd index 66f782a5..28f1ab26 100644 --- a/table/table.gd +++ b/table/table.gd @@ -59,18 +59,35 @@ func _assert(val: bool, msg: String = '<не указано>'): get_tree().quit(1) +func set_columns_min_size_auto(cc: int): + if cc <= 0: return + var sizes: = Array() + sizes.resize(cc) + sizes.fill(size.x / cc) + set_columns_min_size(sizes) + + ## Закрепляет заголовок таблицы.[br] ## [param scrl] - Прокрутка родитель таблицы.[br] ## [param prnt] - Родитель прокрутки.[br] func pin_header(scrl: ScrollContainer, prnt: Control): scrl.remove_child(header) prnt.add_child(header) - var v_separation = get_theme_constant('v_separation') + var v_separation: = get_theme_constant('v_separation') header.position = scrl.position - Vector2(0, header.size.y + v_separation) scroll = scrl scroll_adj = scrl.position +## Закрепляет заголовок таблицы.[br] +## GridView должен лежать на Scrol. Scrol должен иметь родителя +func pin_header2(): + var scrl = get_parent() + var prnt = scrl.get_parent() + pin_header(scrl, prnt) + header.size.x = scrl.size.x + + ## Перемещает указатель на одну строку вверх func selector_up(): var i_rows: = [] @@ -189,6 +206,17 @@ func set_node_property(i_col: int, i_row: int, pname: String, val) -> void: node.set(pname, val) +## Устанавливает свойство ячейки заголовка[br] +## [param i_col] - Индекс колонки.[br] +## [param pname] - Имя свойства.[br] +## [param val] - Значение свойства.[br] +## [i]Свойство[/i] [param pname] [i]ячейки должно существовать.[/i] +func set_header_property(i_col: int, pname: String, val) -> void: + var key: = get_node_key(HEAD_KEY_FORMAT, i_col, 0) + var node = nodes[key] + node.set(pname, val) + + ## Возвращает значение поля ячейки.[br] ## [param pname] - Имя поля.[br] ## [param i_col] - Индекс колонки.[br] @@ -232,6 +260,13 @@ func set_columns_min_size(sizes: Array) -> void: set_nodes_min_size(0, sizes, HEAD_KEY_FORMAT) +func set_headers_min_size(sizes: Array) -> void: + for i_col in columns: + var key: = get_node_key(HEAD_KEY_FORMAT, i_col, 0) + var node = nodes[key] + node.custom_minimum_size.x = sizes[i_col] + node.set_deferred('size.x', sizes[i_col]) + ## func set_columns_aligment(alignments: Array) -> void: var rows_count: = get_rows_count() @@ -574,6 +609,25 @@ func set_nodes_min_size(i_row: int, sizes: Array, key_format: String = NODE_KEY_ node.set_deferred('size.x', sizes[i_col]) +## [param i_row] - Индекс ряда. +func set_rows_min_hight(hight: int) -> void: + var rows_count = get_rows_count() + for i_row in rows_count: + for i_col in columns: + var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row) + var node = nodes[key] + node.custom_minimum_size.y = hight + node.set_deferred('size.y', hight) + + +func set_header_min_hight(hight: int): + for i_col in columns: + var key: = get_node_key(HEAD_KEY_FORMAT, i_col, 0) + var node = nodes[key] + node.custom_minimum_size.y = hight + node.set_deferred('size.y', hight) + + ## [param i_col] - Индекс колонки.[br][param i_row] - Индекс ряда. func set_node_text(i_col: int, i_row: int, val: String) -> void: var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)