Доработка. WIP Отображение кластеров на шкале

This commit is contained in:
sasha80
2026-03-20 16:35:17 +03:00
parent 07b41211c7
commit 261a994466

View File

@@ -49,6 +49,7 @@ var cnames_table: Dictionary[StringName, Dictionary]
var pnames_scale: Dictionary[StringName, int] var pnames_scale: Dictionary[StringName, int]
#endregion #endregion
func _ready() -> void: func _ready() -> void:
# Инициализировать переменные # Инициализировать переменные
for i in index_to_unit_names.size(): for i in index_to_unit_names.size():
@@ -70,7 +71,7 @@ func _ready() -> void:
for cell_scn in table_cells: for cell_scn in table_cells:
table_cell_row.append(load(cell_scn)) table_cell_row.append(load(cell_scn))
# Расскраска чётные-нечётные # Расскрасить чётные-нечётные
for node in get_tree().get_nodes_in_group('нечётные'): for node in get_tree().get_nodes_in_group('нечётные'):
node.get_node('panel_rx').back_color = color_odd node.get_node('panel_rx').back_color = color_odd
node.get_node('panel_tx').back_color = color_odd node.get_node('panel_tx').back_color = color_odd
@@ -78,7 +79,7 @@ func _ready() -> void:
node.get_node('panel_rx').back_color = color_even node.get_node('panel_rx').back_color = color_even
node.get_node('panel_tx').back_color = color_even node.get_node('panel_tx').back_color = color_even
# Настрить таблицу # Настроить таблицу
var ctable: = $'таблица/сетка' var ctable: = $'таблица/сетка'
ctable.set_header(header_row) ctable.set_header(header_row)
ctable.set_header_text(table_header_text) ctable.set_header_text(table_header_text)
@@ -90,18 +91,20 @@ func _ready() -> void:
ctable.set_header_min_hight(table_rows_hight) ctable.set_header_min_hight(table_rows_hight)
ctable.pin_header2() ctable.pin_header2()
# Подключить обработчики # Подключить обработчик для приёма данных
for nm in yems_data_info.keys(): for nm in yems_data_info:
var yems_unit = network.get_unit_instance(nm) var yems_unit = network.get_unit_instance(nm)
yems_unit.connect('data_received', on_data_received.bind(nm)) yems_unit.connect('data_received', on_data_received.bind(nm))
## Обрабатывает событие [b]data_received[/b]
func on_data_received(data: Dictionary, nm: StringName): func on_data_received(data: Dictionary, nm: StringName):
yems_data_info[nm].merge(data, true) yems_data_info[nm].merge(data, true)
map_yems_data_to_table(nm) map_yems_data_to_table(nm)
map_yems_data_to_scale(nm) map_yems_data_to_scale(nm)
## Отображает кластеры в таблицу
## [param nm] - имя устройства ## [param nm] - имя устройства
func map_yems_data_to_table(nm: StringName): func map_yems_data_to_table(nm: StringName):
var unit_data = yems_data_info.get(nm) var unit_data = yems_data_info.get(nm)
@@ -128,6 +131,8 @@ func map_yems_data_to_table(nm: StringName):
ctable.set_row_min_hight(i_row, table_rows_hight) ctable.set_row_min_hight(i_row, table_rows_hight)
## Отображает кластеры на шкале
## [param nm] - имя устройства
func map_yems_data_to_scale(nm: StringName): func map_yems_data_to_scale(nm: StringName):
var unit_data = yems_data_info.get(nm) var unit_data = yems_data_info.get(nm)
if not unit_data: return # Данных ещё нет if not unit_data: return # Данных ещё нет