Рефактор.

This commit is contained in:
sasha80
2025-12-09 12:42:31 +03:00
parent 9be115a535
commit b3322ee591

View File

@@ -178,16 +178,16 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
func find_labels(node1: Node):
if node1 is Label:
if node1.name in ["lbl_rname", "rname"]:
if not node1.has_meta("tooltip_set"):
if node1.name in ['lbl_rname', 'rname']:
if not node1.has_meta('tooltip_set'):
ctrl_pos += 1
var box_number = ceili(float(ctrl_pos) / 10.0)
var position_number = ctrl_pos % 10
if position_number == 0:
position_number = 10
node1.tooltip_text = "Ящик - %d, Позиция - %d" % [box_number, position_number]
node1.tooltip_text = 'Ящик - %d, Позиция - %d' % [box_number, position_number]
node1.mouse_filter = Control.MOUSE_FILTER_STOP
node1.set_meta("tooltip_set", true)
node1.set_meta('tooltip_set', true)
for child in node1.get_children():
find_labels(child)
@@ -199,12 +199,12 @@ func _on_status_updated(status_text: String) -> void:
func _update_status_text(text: String) -> void:
$control_result.text = text
# Можно добавить смену цвета в зависимости от статуса
if "Ошибка" in text or "неисправен" in text:
if 'Ошибка' in text or 'неисправен' in text:
$control_result.add_theme_color_override('font_color', Color.RED)
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_v.self_name])
elif "Ограничена" in text or "Предупреждение" in text:
elif 'Ограничена' in text or 'Предупреждение' in text:
$control_result.add_theme_color_override('font_color', Color.YELLOW)
elif "исправен" in text or "завершён" in text:
elif 'исправен' in text or 'завершён' in text:
$control_result.add_theme_color_override('font_color', Color.GREEN)
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_v.self_name])
else: