Рефактор.
This commit is contained in:
@@ -196,16 +196,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)
|
||||
|
||||
@@ -217,12 +217,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_k.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_k.self_name])
|
||||
else:
|
||||
|
||||
@@ -182,16 +182,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)
|
||||
|
||||
@@ -203,12 +203,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_n.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_n.self_name])
|
||||
else:
|
||||
|
||||
@@ -112,15 +112,15 @@ func status_uf() -> 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)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
extends Button
|
||||
|
||||
func _ready():
|
||||
connect("toggled", Callable(self, "_on_button_toggled"))
|
||||
connect('toggled', Callable(self, '_on_button_toggled'))
|
||||
|
||||
|
||||
func _on_button_toggled(mode: bool):
|
||||
if mode:
|
||||
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
|
||||
tooltip_text = 'Режим \"Тренаж\" задействован\nТекущее состояние: включено'
|
||||
else:
|
||||
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"
|
||||
tooltip_text = 'Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено'
|
||||
|
||||
Reference in New Issue
Block a user