Положение приборов по сетке

This commit is contained in:
kira-a-k
2025-11-09 22:15:31 +03:00
parent fe7ef9a699
commit c6219254ed
7 changed files with 144 additions and 140 deletions

View File

@@ -3,7 +3,7 @@ extends Label
const STATUS_GOOD := {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK}
const STATUS_BAD := {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE}
var _is_uf_status_initialized: bool = false
var is_prd_operational: bool = true
var is_prd_operational: bool = false # true
var is_uf_operational: bool = false
@@ -11,24 +11,45 @@ func _ready() -> void:
tooltip_text = 'Нет связи с приборами комплекса'
for prd_module in prd.prd_dict.values():
prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module))
var unit_uf: = network.get_unit_instance('уарэп-эмс')
var unit_uf = network.get_unit_instance('уарэп-эмс')
unit_uf.connect('data_received', Callable(self, 'on_uf_status_receive'))
add_theme_color_override("font_color", Color.BLACK)
func on_serviceability_changed(unit_prd_module: Object) -> void:
#func on_serviceability_changed(unit_prd_module: Object) -> void:
func on_serviceability_changed() -> void:
var check_service: bool = true
for prd_module in prd.prd_dict.values():
if prd_module.unit_yau07.online:
if not unit_prd_module.serviceability:
#if not unit_prd_module.serviceability:
if not prd_module.serviceability:
check_service = false
if check_service != is_prd_operational:
is_prd_operational = check_service
_update_serviceability_display()
## Обработчики кнопок
#func _on_button_test_on() -> void:
#print("[TEST] Оба исправны")
#is_prd_operational = true
#is_uf_operational = true
#_update_serviceability_display()
#
#func _on_button_test_off() -> void:
#print("[TEST] Оба неисправны")
#is_prd_operational = false
#is_uf_operational = false
#_update_serviceability_display()
#
#func _on_button_test_mix() -> void:
#is_prd_operational = !is_prd_operational
#is_uf_operational = !is_uf_operational
#print("[TEST] Смешанный режим → UF:", is_uf_operational, "PRD:", is_prd_operational)
#_update_serviceability_display()
func _update_serviceability_display() -> void:
var status := STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD
var status = STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD
text = status.text
modulate = status.color
tooltip_text = 'Результаты обобщенного признака работоспособности изделия'
@@ -36,9 +57,9 @@ func _update_serviceability_display() -> void:
func on_uf_status_receive(unit_uf: Object) -> void:
var KEMS_B = ((unit_uf.status[0] >> 0) & 1) and ((unit_uf.status[0] >> 3) & 1)
var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) and ((unit_uf.status[0] >> 4) & 1)
var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) and ((unit_uf.status[0] >> 5) & 1)
var KEMS_B = ((unit_uf.status[0] >> 0) & 1) & ((unit_uf.status[0] >> 3) & 1)
var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) & ((unit_uf.status[0] >> 4) & 1)
var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) & ((unit_uf.status[0] >> 5) & 1)
var IP27B = ((unit_uf.status[2] >> 6) & 1)
var check_service: bool = KEMS_B and EMS_B_1 and EMS_B_2 and IP27B
if not _is_uf_status_initialized or check_service != is_uf_operational:

View File

@@ -1 +1 @@
uid://b5ykwyk5vpi6
uid://b5ykwyk5vpi6

View File

@@ -47,15 +47,15 @@ theme_override_styles/tab_focus = SubResource("StyleBoxEmpty_41d34")
theme_override_styles/tab_disabled = SubResource("StyleBoxEmpty_cw2ss")
theme_override_styles/tabbar_background = SubResource("StyleBoxEmpty_nmdfd")
theme_override_styles/panel = SubResource("StyleBoxEmpty_vap7n")
current_tab = 0
current_tab = 1
script = ExtResource("1_fg0vd")
[node name="Работа" parent="tab_switch" instance=ExtResource("2_u7p16")]
visible = false
layout_mode = 2
metadata/_tab_index = 0
[node name="Контроль" parent="tab_switch" instance=ExtResource("3_txp0s")]
visible = false
layout_mode = 2
metadata/_tab_index = 1
@@ -127,5 +127,33 @@ text = "Тренаж"
script = ExtResource("9_41d34")
metadata/_edit_lock_ = true
[node name="buttontest" type="Button" parent="."]
visible = false
layout_mode = 0
offset_left = 1408.0
offset_top = 64.0
offset_right = 1456.0
offset_bottom = 88.0
text = "mix"
[node name="buttonteston" type="Button" parent="."]
visible = false
offset_left = 1472.0
offset_top = 64.0
offset_right = 1520.0
offset_bottom = 88.0
text = "on"
[node name="buttontestoff" type="Button" parent="."]
visible = false
offset_left = 1536.0
offset_top = 64.0
offset_right = 1584.0
offset_bottom = 88.0
text = "off"
[connection signal="tab_changed" from="tab_switch" to="tab_switch" method="_on_tab_changed"]
[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenaj_toggled"]
[connection signal="pressed" from="buttontest" to="lbl_ready" method="_on_button_test_mix"]
[connection signal="pressed" from="buttonteston" to="lbl_ready" method="_on_button_test_on"]
[connection signal="pressed" from="buttontestoff" to="lbl_ready" method="_on_button_test_off"]

View File

@@ -1,11 +1,11 @@
extends Button
func _ready():
connect("toggled", Callable(self, "_on_button_toggled"))
func _on_button_toggled(mode: bool):
if mode:
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
else:
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"
extends Button
func _ready():
connect("toggled", Callable(self, "_on_button_toggled"))
func _on_button_toggled(mode: bool):
if mode:
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
else:
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"

View File

@@ -1 +1 @@
uid://roajn6c6wvc1
uid://roajn6c6wvc1

View File

@@ -367,13 +367,13 @@ func _process(delta) -> void:
_queue.erase(tile.i)
req.request_completed.connect(_response.bind(req, tile))
if req.request(tile.url) != OK:
tile.t = now
remove_child(req)
req.queue_free()
_req_count -= 1
#if req.request(tile.url) != OK:
#tile.t = now
#remove_child(req)
#req.queue_free()
#_req_count -= 1
# push_error('запрос \"%s\" не отправлен' % tile.url) TODO: For Deugs
if _queue.is_empty():
emit_signal('load_completed')

View File

@@ -364,9 +364,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1048.0
offset_top = 193.0
offset_top = 179.0
offset_right = 1125.0
offset_bottom = 309.0
offset_bottom = 295.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -413,7 +413,6 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_1"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_top = 124.0
@@ -439,9 +438,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1183.0
offset_top = 565.0
offset_top = 558.0
offset_right = 1294.0
offset_bottom = 750.0
offset_bottom = 743.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -455,7 +454,6 @@ metadata/unit_name = ["уарэп-эмс"]
metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_uf"]
self_modulate = Color(0, 1, 0, 1)
layout_mode = 0
offset_left = 15.0
offset_top = -44.0
@@ -492,9 +490,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1058.0
offset_top = 595.0
offset_top = 588.0
offset_right = 1164.0
offset_bottom = 751.0
offset_bottom = 744.0
pivot_offset = Vector2(-10, -65)
size_flags_horizontal = 15
size_flags_vertical = 15
@@ -532,16 +530,6 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_rtr"]
layout_mode = 0
offset_left = 11.0
offset_top = -49.0
offset_right = 94.0
offset_bottom = -30.0
text = "РТР"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"]
light_mask = 3
position = Vector2(53, -15)
@@ -554,9 +542,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1053.0
offset_top = 432.0
offset_top = 425.0
offset_right = 1886.0
offset_bottom = 1072.0
offset_bottom = 1065.0
scale = Vector2(0.2, 0.2)
pivot_offset = Vector2(-10, -65)
size_flags_horizontal = 15
@@ -597,17 +585,6 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_afsp_1"]
layout_mode = 0
offset_left = 175.0
offset_top = -245.0
offset_right = 272.0
offset_bottom = -225.0
scale = Vector2(5, 5)
text = "АФСП 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_1"]
light_mask = 3
position = Vector2(415, -40)
@@ -620,9 +597,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1243.0
offset_top = 432.0
offset_top = 425.0
offset_right = 2076.0
offset_bottom = 1072.0
offset_bottom = 1065.0
scale = Vector2(0.2, 0.2)
pivot_offset = Vector2(-10, -65)
size_flags_horizontal = 15
@@ -664,17 +641,6 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_afsp_2"]
layout_mode = 0
offset_left = 175.0
offset_top = -240.0
offset_right = 272.0
offset_bottom = -220.0
scale = Vector2(5, 5)
text = "АФСП 2"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"]
light_mask = 3
position = Vector2(415, -40)
@@ -687,9 +653,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1313.0
offset_top = 565.0
offset_top = 558.0
offset_right = 1407.0
offset_bottom = 751.0
offset_bottom = 744.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -738,9 +704,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1440.0
offset_top = 680.0
offset_top = 687.0
offset_right = 1517.0
offset_bottom = 796.0
offset_bottom = 803.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -755,9 +721,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_v_2"]
layout_mode = 0
offset_left = 14.0
offset_left = 11.0
offset_top = -42.0
offset_right = 66.0
offset_right = 63.0
offset_bottom = -23.0
text = "ПРД В2"
horizontal_alignment = 1
@@ -780,14 +746,13 @@ patch_margin_bottom = 16
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_v_2"]
light_mask = 3
position = Vector2(40, -10)
position = Vector2(37, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_2"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_top = 124.0
@@ -813,9 +778,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1440.0
offset_top = 345.0
offset_top = 322.0
offset_right = 1517.0
offset_bottom = 461.0
offset_bottom = 438.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -830,9 +795,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_n_2"]
layout_mode = 0
offset_left = 15.0
offset_left = 11.0
offset_top = -42.0
offset_right = 67.0
offset_right = 63.0
offset_bottom = -23.0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 0
@@ -857,14 +822,13 @@ patch_margin_bottom = 16
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_n_2"]
light_mask = 3
position = Vector2(40, -10)
position = Vector2(37, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_2"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_top = 124.0
@@ -890,9 +854,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1440.0
offset_top = 515.0
offset_top = 504.0
offset_right = 1517.0
offset_bottom = 631.0
offset_bottom = 620.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -907,9 +871,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_k_2"]
layout_mode = 0
offset_left = 17.0
offset_left = 11.0
offset_top = -42.0
offset_right = 69.0
offset_right = 63.0
offset_bottom = -23.0
text = "ПРД К2"
horizontal_alignment = 1
@@ -932,14 +896,13 @@ patch_margin_bottom = 16
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_k_2"]
light_mask = 3
position = Vector2(43, -10)
position = Vector2(37, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_2"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_top = 124.0
@@ -965,9 +928,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1048.0
offset_top = 810.0
offset_top = 803.0
offset_right = 1125.0
offset_bottom = 926.0
offset_bottom = 919.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1007,18 +970,17 @@ patch_margin_bottom = 16
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_v_3"]
light_mask = 3
position = Vector2(34, -10)
position = Vector2(35, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_3"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_left = -8.0
offset_top = 124.0
offset_right = 89.0
offset_right = 85.0
offset_bottom = 134.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -1040,9 +1002,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1323.0
offset_top = 810.0
offset_top = 803.0
offset_right = 1400.0
offset_bottom = 926.0
offset_bottom = 919.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1089,11 +1051,10 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_3"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_left = -7.0
offset_top = 124.0
offset_right = 89.0
offset_right = 86.0
offset_bottom = 134.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -1115,9 +1076,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1188.0
offset_top = 810.0
offset_top = 803.0
offset_right = 1265.0
offset_bottom = 926.0
offset_bottom = 919.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1164,11 +1125,10 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_3"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_left = -8.0
offset_top = 124.0
offset_right = 89.0
offset_right = 85.0
offset_bottom = 134.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -1190,9 +1150,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1328.0
offset_top = 193.0
offset_top = 179.0
offset_right = 1405.0
offset_bottom = 309.0
offset_bottom = 295.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1239,7 +1199,6 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_1"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_top = 124.0
@@ -1265,9 +1224,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1183.0
offset_top = 193.0
offset_top = 179.0
offset_right = 1260.0
offset_bottom = 309.0
offset_bottom = 295.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1314,7 +1273,6 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_1"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_top = 124.0
@@ -1339,10 +1297,10 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
[node name="pribor_prd_v_4" type="TextureButton" parent="." groups=["pribor_buttons"]]
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 946.0
offset_top = 345.0
offset_right = 1023.0
offset_bottom = 461.0
offset_left = 940.0
offset_top = 322.0
offset_right = 1017.0
offset_bottom = 438.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1356,9 +1314,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_v_4"]
layout_mode = 0
offset_left = 17.0
offset_left = 15.0
offset_top = -41.0
offset_right = 69.0
offset_right = 67.0
offset_bottom = -22.0
text = "ПРД В4"
horizontal_alignment = 1
@@ -1388,11 +1346,10 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_4"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_left = -6.0
offset_top = 124.0
offset_right = 89.0
offset_right = 87.0
offset_bottom = 134.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -1414,9 +1371,9 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 941.0
offset_top = 685.0
offset_top = 687.0
offset_right = 1018.0
offset_bottom = 801.0
offset_bottom = 803.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1462,11 +1419,10 @@ frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_4"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_left = -8.0
offset_top = 124.0
offset_right = 89.0
offset_right = 85.0
offset_bottom = 134.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -1487,10 +1443,10 @@ tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
[node name="pribor_prd_k_4" type="TextureButton" parent="." groups=["pribor_buttons"]]
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 946.0
offset_top = 515.0
offset_right = 1023.0
offset_bottom = 631.0
offset_left = 941.0
offset_top = 504.0
offset_right = 1018.0
offset_bottom = 620.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1504,9 +1460,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_k_4"]
layout_mode = 0
offset_left = 17.0
offset_left = 14.0
offset_top = -40.0
offset_right = 69.0
offset_right = 66.0
offset_bottom = -21.0
text = "ПРД К4"
horizontal_alignment = 1
@@ -1529,18 +1485,17 @@ patch_margin_bottom = 16
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_k_4"]
light_mask = 3
position = Vector2(42, -10)
position = Vector2(39, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_4"]
visible = false
layout_mode = 0
offset_left = -4.0
offset_left = -8.0
offset_top = 124.0
offset_right = 89.0
offset_right = 85.0
offset_bottom = 134.0
size_flags_horizontal = 3
size_flags_vertical = 3