From bea600c34accec977118f8e2adba538bbec90ed7 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 6 May 2025 08:34:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0.=20=D0=92=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D1=81?= =?UTF-8?q?=D1=81=D0=B5.=20=D0=A0=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=80=D0=B8=D0=B1=D0=BE=D1=80=20=D0=A0?= =?UTF-8?q?=D0=A2=D0=A0=20=D0=BD=D0=B0=20=D0=B4=D0=B2=D0=B0=20=D0=90=D0=A4?= =?UTF-8?q?=D0=A1=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.godot | 1 + scenes/cell/cell-front-rear.tscn | 2 +- scenes/cell/cell-front.tscn | 2 +- scenes/diagram/sector.tscn | 2 +- scenes/frame-params/frame-params.tscn | 4 +- scenes/frame-threats/frame-threats.tscn | 4 +- scenes/frame/frame.tscn | 2 +- scenes/pribor-afsp/pribor-afsp-1.tscn | 79 ++++++++++ .../{pribor-afsp.tscn => pribor-afsp-2.tscn} | 14 +- scenes/{контроль => pribor-afsp}/request.gd | 0 .../{контроль => pribor-afsp}/request.gd.uid | 0 scenes/pribor-prd-k/kasseta-fs-kd.tscn | 2 +- scenes/pribor-prd-k/pribor-prd-k.tscn | 6 +- scenes/pribor-prd-n/kasseta-fs-nd.tscn | 2 +- scenes/pribor-prd-n/pribor-prd-n.tscn | 6 +- scenes/pribor-prd-v/kasseta-fs-vd.tscn | 2 +- scenes/pribor-prd-v/pribor-prd-v.tscn | 6 +- scenes/pribor-rtr/pribor-rtr.gd | 135 ++++++++++++++++++ scenes/pribor-rtr/pribor-rtr.gd.uid | 1 + scenes/pribor-rtr/pribor-rtr.tscn | 66 +++++++++ scenes/pribor-uf/pribor-uf.tscn | 2 +- scenes/контроль/кассета-п-1.tscn | 2 +- scenes/контроль/кассета-п-2.tscn | 2 +- scenes/контроль/кассета-у-5-к.tscn | 2 +- scenes/контроль/контроль.gd | 6 +- scenes/работа/работа.tscn | 2 +- 26 files changed, 317 insertions(+), 35 deletions(-) create mode 100644 scenes/pribor-afsp/pribor-afsp-1.tscn rename scenes/pribor-afsp/{pribor-afsp.tscn => pribor-afsp-2.tscn} (87%) rename scenes/{контроль => pribor-afsp}/request.gd (100%) rename scenes/{контроль => pribor-afsp}/request.gd.uid (100%) create mode 100644 scenes/pribor-rtr/pribor-rtr.gd create mode 100644 scenes/pribor-rtr/pribor-rtr.gd.uid create mode 100644 scenes/pribor-rtr/pribor-rtr.tscn diff --git a/project.godot b/project.godot index 36d7621..dbe368b 100644 --- a/project.godot +++ b/project.godot @@ -123,6 +123,7 @@ folder_colors={ "res://scenes/pribor-prd-k/": "purple", "res://scenes/pribor-prd-n/": "purple", "res://scenes/pribor-prd-v/": "purple", +"res://scenes/pribor-rtr/": "purple", "res://scenes/pribor-uf/": "purple", "res://scenes/pribor-uyep/": "purple", "res://scenes/tabs-switch/": "blue", diff --git a/scenes/cell/cell-front-rear.tscn b/scenes/cell/cell-front-rear.tscn index f5f467c..682f7a5 100644 --- a/scenes/cell/cell-front-rear.tscn +++ b/scenes/cell/cell-front-rear.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://b8txs4xi722wt"] -[ext_resource type="Script" path="res://scenes/cell/cell-front.gd" id="1_2vfsf"] +[ext_resource type="Script" uid="uid://c8ggs4tickbv7" path="res://scenes/cell/cell-front.gd" id="1_2vfsf"] [ext_resource type="Texture2D" uid="uid://c6yuv0b51aauw" path="res://data/фронт-задний-1.png" id="2_nlylb"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2thpi"] diff --git a/scenes/cell/cell-front.tscn b/scenes/cell/cell-front.tscn index c6b0acf..e3ce605 100644 --- a/scenes/cell/cell-front.tscn +++ b/scenes/cell/cell-front.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://bccr42bckei41"] -[ext_resource type="Script" path="res://scenes/cell/cell-front.gd" id="1_s7c0f"] +[ext_resource type="Script" uid="uid://c8ggs4tickbv7" path="res://scenes/cell/cell-front.gd" id="1_s7c0f"] [ext_resource type="Texture2D" uid="uid://ysctr84e77dc" path="res://data/фронт-передний-1.png" id="2_87fw5"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2thpi"] diff --git a/scenes/diagram/sector.tscn b/scenes/diagram/sector.tscn index 2d95a61..07b8a30 100644 --- a/scenes/diagram/sector.tscn +++ b/scenes/diagram/sector.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://c73ahpv8uiuc7"] -[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="1_e0gfn"] +[ext_resource type="Shader" uid="uid://k36g8tww5yo" path="res://shaders/sector.gdshader" id="1_e0gfn"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_xo5or"] resource_local_to_scene = true diff --git a/scenes/frame-params/frame-params.tscn b/scenes/frame-params/frame-params.tscn index 2505e0d..58db6b4 100644 --- a/scenes/frame-params/frame-params.tscn +++ b/scenes/frame-params/frame-params.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=3 uid="uid://t54wukutvmjq"] [ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="1_65sy4"] -[ext_resource type="Script" path="res://scenes/frame-params/scroll-params.gd" id="2_f8bq4"] -[ext_resource type="Script" path="res://table/table.gd" id="3_y0507"] +[ext_resource type="Script" uid="uid://cpq0523hlo808" path="res://scenes/frame-params/scroll-params.gd" id="2_f8bq4"] +[ext_resource type="Script" uid="uid://c5pq0hbrij34d" path="res://table/table.gd" id="3_y0507"] [node name="frm_params" type="NinePatchRect"] size_flags_horizontal = 3 diff --git a/scenes/frame-threats/frame-threats.tscn b/scenes/frame-threats/frame-threats.tscn index 8c393f4..e357f45 100644 --- a/scenes/frame-threats/frame-threats.tscn +++ b/scenes/frame-threats/frame-threats.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=3 uid="uid://bsd67ktk8xp5a"] [ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="1_m3no0"] -[ext_resource type="Script" path="res://scenes/frame-threats/scroll-threats.gd" id="2_empn3"] -[ext_resource type="Script" path="res://table/table.gd" id="3_4bupu"] +[ext_resource type="Script" uid="uid://c5rhhlebqyfvy" path="res://scenes/frame-threats/scroll-threats.gd" id="2_empn3"] +[ext_resource type="Script" uid="uid://c5pq0hbrij34d" path="res://table/table.gd" id="3_4bupu"] [node name="frm_threats" type="NinePatchRect"] size_flags_horizontal = 3 diff --git a/scenes/frame/frame.tscn b/scenes/frame/frame.tscn index d426854..23fabd0 100644 --- a/scenes/frame/frame.tscn +++ b/scenes/frame/frame.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=3 uid="uid://bq7haw1ypiv48"] [ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="1_n1ea1"] -[ext_resource type="Script" path="res://scenes/frame/frame.gd" id="2_ki0kf"] +[ext_resource type="Script" uid="uid://reh5lpi1dp26" path="res://scenes/frame/frame.gd" id="2_ki0kf"] [node name="ramka" type="NinePatchRect"] offset_right = 150.0 diff --git a/scenes/pribor-afsp/pribor-afsp-1.tscn b/scenes/pribor-afsp/pribor-afsp-1.tscn new file mode 100644 index 0000000..a99a4e9 --- /dev/null +++ b/scenes/pribor-afsp/pribor-afsp-1.tscn @@ -0,0 +1,79 @@ +[gd_scene load_steps=5 format=3 uid="uid://8ll27id5ajq1"] + +[ext_resource type="Script" uid="uid://d0jwv5opi3mrl" path="res://scenes/pribor-afsp/pribor-afsp.gd" id="1_151rh"] +[ext_resource type="Script" uid="uid://bux47vkw71w1t" path="res://scenes/pribor-afsp/request.gd" id="2_4vyhj"] +[ext_resource type="PackedScene" uid="uid://dnxq870xf6pkh" path="res://scenes/pribor-afsp/bort-afsp.tscn" id="3_d7iti"] + +[sub_resource type="GDScript" id="GDScript_yhnwg"] +script/source = "extends Timer + +func _ready(): wait_time = ProjectSettings.get_setting('application/config/unit_rr_request_period') +" + +[node name="pribor_rtr" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_left = 10.0 +offset_top = 78.0 +offset_right = 10.0 +offset_bottom = 78.0 +scale = Vector2(0.9, 0.9) +script = ExtResource("1_151rh") + +[node name="lbl_header" type="Label" parent="."] +layout_mode = 0 +offset_top = -44.8889 +offset_right = 1044.0 +offset_bottom = -15.8889 +theme_override_font_sizes/font_size = 22 +text = "Контроль исправности прибора" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="request_rtr" type="HTTPRequest" parent="."] +script = ExtResource("2_4vyhj") + +[node name="timer" type="Timer" parent="request_rtr"] +wait_time = 4.168 +autostart = true +script = SubResource("GDScript_yhnwg") + +[node name="left" parent="." instance=ExtResource("3_d7iti")] +scale = Vector2(0.9, 0.9) +metadata/DeviceName = &"Устройство РР левого борта" + +[node name="right" parent="." instance=ExtResource("3_d7iti")] +offset_left = 522.0 +offset_right = 1102.0 +scale = Vector2(0.9, 0.9) +metadata/DeviceName = &"Устройство РР правого борта" + +[node name="lbl_left" type="Label" parent="."] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 0 +offset_left = 217.0 +offset_top = -18.6666 +offset_right = 306.0 +offset_bottom = 3.33341 +theme_override_font_sizes/font_size = 17 +text = "левый борт" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="lbl_right" type="Label" parent="."] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 0 +offset_left = 739.0 +offset_top = -18.6666 +offset_right = 833.0 +offset_bottom = 3.33341 +theme_override_font_sizes/font_size = 17 +text = "правый борт" +horizontal_alignment = 1 +vertical_alignment = 1 + +[connection signal="child_entered_tree" from="request_rtr" to="request_rtr" method="_on_child_entered_tree"] +[connection signal="request_completed" from="request_rtr" to="." method="_on_request_rtr_request_completed"] +[connection signal="timeout" from="request_rtr/timer" to="request_rtr" method="_on_request_timer"] +[connection signal="pressed" from="left" to="." method="_on_item_pressed"] +[connection signal="pressed" from="right" to="." method="_on_item_pressed"] diff --git a/scenes/pribor-afsp/pribor-afsp.tscn b/scenes/pribor-afsp/pribor-afsp-2.tscn similarity index 87% rename from scenes/pribor-afsp/pribor-afsp.tscn rename to scenes/pribor-afsp/pribor-afsp-2.tscn index 89b6f68..5522d6f 100644 --- a/scenes/pribor-afsp/pribor-afsp.tscn +++ b/scenes/pribor-afsp/pribor-afsp-2.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=5 format=3 uid="uid://5uv1idl3lqet"] -[ext_resource type="Script" uid="uid://d0jwv5opi3mrl" path="res://scenes/pribor-afsp/pribor-afsp.gd" id="1_f33d3"] -[ext_resource type="Script" uid="uid://bux47vkw71w1t" path="res://scenes/контроль/request.gd" id="2_0b8u2"] -[ext_resource type="PackedScene" uid="uid://dnxq870xf6pkh" path="res://scenes/pribor-afsp/bort-afsp.tscn" id="3_6rjuf"] +[ext_resource type="Script" uid="uid://d0jwv5opi3mrl" path="res://scenes/pribor-afsp/pribor-afsp.gd" id="1_tfses"] +[ext_resource type="Script" uid="uid://bux47vkw71w1t" path="res://scenes/pribor-afsp/request.gd" id="2_miwrd"] +[ext_resource type="PackedScene" uid="uid://dnxq870xf6pkh" path="res://scenes/pribor-afsp/bort-afsp.tscn" id="3_xpxb5"] [sub_resource type="GDScript" id="GDScript_yhnwg"] script/source = "extends Timer @@ -18,7 +18,7 @@ offset_top = 78.0 offset_right = 10.0 offset_bottom = 78.0 scale = Vector2(0.9, 0.9) -script = ExtResource("1_f33d3") +script = ExtResource("1_tfses") [node name="lbl_header" type="Label" parent="."] layout_mode = 0 @@ -31,18 +31,18 @@ horizontal_alignment = 1 vertical_alignment = 1 [node name="request_rtr" type="HTTPRequest" parent="."] -script = ExtResource("2_0b8u2") +script = ExtResource("2_miwrd") [node name="timer" type="Timer" parent="request_rtr"] wait_time = 4.168 autostart = true script = SubResource("GDScript_yhnwg") -[node name="left" parent="." instance=ExtResource("3_6rjuf")] +[node name="left" parent="." instance=ExtResource("3_xpxb5")] scale = Vector2(0.9, 0.9) metadata/DeviceName = &"Устройство РР левого борта" -[node name="right" parent="." instance=ExtResource("3_6rjuf")] +[node name="right" parent="." instance=ExtResource("3_xpxb5")] offset_left = 522.0 offset_right = 1102.0 scale = Vector2(0.9, 0.9) diff --git a/scenes/контроль/request.gd b/scenes/pribor-afsp/request.gd similarity index 100% rename from scenes/контроль/request.gd rename to scenes/pribor-afsp/request.gd diff --git a/scenes/контроль/request.gd.uid b/scenes/pribor-afsp/request.gd.uid similarity index 100% rename from scenes/контроль/request.gd.uid rename to scenes/pribor-afsp/request.gd.uid diff --git a/scenes/pribor-prd-k/kasseta-fs-kd.tscn b/scenes/pribor-prd-k/kasseta-fs-kd.tscn index adeda22..dd269f6 100644 --- a/scenes/pribor-prd-k/kasseta-fs-kd.tscn +++ b/scenes/pribor-prd-k/kasseta-fs-kd.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://bmagw8nd0ulhj"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_1jljp"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_01mea"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="2_01mea"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_kqnvt"] [node name="kasseta_fs_kd" type="NinePatchRect"] diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index 8b1ca98..f997774 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=11 format=3 uid="uid://m5s87q7m66lj"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"] -[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_ufjwe"] +[ext_resource type="Script" uid="uid://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_ufjwe"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_14h25"] [ext_resource type="PackedScene" uid="uid://cm5jd4gjrrpba" path="res://scenes/контроль/кассета-у-5-к.tscn" id="2_tb85r"] -[ext_resource type="Script" path="res://scenes/контроль/кассета-у-5.gd" id="3_wip3a"] +[ext_resource type="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="3_wip3a"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="6_fmhtx"] [ext_resource type="PackedScene" uid="uid://bmagw8nd0ulhj" path="res://scenes/pribor-prd-k/kasseta-fs-kd.tscn" id="7_ia27q"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"] [ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"] diff --git a/scenes/pribor-prd-n/kasseta-fs-nd.tscn b/scenes/pribor-prd-n/kasseta-fs-nd.tscn index 6227ee9..1af690c 100644 --- a/scenes/pribor-prd-n/kasseta-fs-nd.tscn +++ b/scenes/pribor-prd-n/kasseta-fs-nd.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://cd5sue1e8iyrv"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_wgdti"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_lxiqt"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="2_lxiqt"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="2_mkgdh"] [node name="kasseta_fs_nd" type="NinePatchRect"] diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 7397f80..8b5c61f 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -1,11 +1,11 @@ [gd_scene load_steps=9 format=3 uid="uid://dnuexoef2nnv5"] -[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_mcea3"] +[ext_resource type="Script" uid="uid://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_mcea3"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_lpj3d"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_i1no5"] [ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="5_ej152"] -[ext_resource type="Script" path="res://scenes/контроль/кассета-у-5.gd" id="5_hne5j"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="6_b1cob"] +[ext_resource type="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="5_hne5j"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b1cob"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_dqc3e"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_u7eqo"] diff --git a/scenes/pribor-prd-v/kasseta-fs-vd.tscn b/scenes/pribor-prd-v/kasseta-fs-vd.tscn index ad05775..4f8ed66 100644 --- a/scenes/pribor-prd-v/kasseta-fs-vd.tscn +++ b/scenes/pribor-prd-v/kasseta-fs-vd.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://ctyinijyucgpe"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_74guj"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_mfr0k"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="2_mfr0k"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_w4hiq"] [node name="kasseta_fs_vd" type="NinePatchRect"] diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index dd612e7..9e365c0 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -1,12 +1,12 @@ [gd_scene load_steps=10 format=3 uid="uid://cvskpe1ti3p45"] -[ext_resource type="Script" path="res://scenes/pribor-prd-v/pribor_prd_v.gd" id="1_c20s6"] +[ext_resource type="Script" uid="uid://cvuosuvjaci1h" path="res://scenes/pribor-prd-v/pribor_prd_v.gd" id="1_c20s6"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_xpo4b"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_wyy1b"] [ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_gl2bl"] -[ext_resource type="Script" path="res://scenes/контроль/кассета-у-5.gd" id="5_6p5qb"] +[ext_resource type="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="5_6p5qb"] [ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="5_nhd2k"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="6_os4mt"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_os4mt"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_38u2b"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="7_e22c6"] diff --git a/scenes/pribor-rtr/pribor-rtr.gd b/scenes/pribor-rtr/pribor-rtr.gd new file mode 100644 index 0000000..3972995 --- /dev/null +++ b/scenes/pribor-rtr/pribor-rtr.gd @@ -0,0 +1,135 @@ +class_name pribor_rtr extends 'res://scenes/контроль/прибор.gd' + +@export var prefix_path: String = '' + +static var json_conv: JSON = JSON.new() + +## Преобразует путь в виде целой строки в массив отдельных элементов пути.[br] +## [param solid] - Входная строка содержащая путь, которая имеет следующий примерный вид:[br] +## [code]SelfTest[1].DevList[2]['CurrentValue'][/code][br] +## [param paths] - Массив содержащий отдельные элементы пути.[br] +## [param tokens] - Разделители используемые во входной строке для разделения элементов пути.[br] +func map_solid_to_array(solid: String, paths: Array, tokens: Array = ['[', ']', '.']) -> void: + paths.clear() + var i_chs = [] + for sep in tokens: + var i = 0 + while i != -1: + i = solid.find(sep, i + 1) + i_chs.append(i) + i_chs.pop_back() + i_chs.sort() + + var i0 = 0 + for i1 in i_chs: + var ss: = [String()] + tools.get_string_slice(solid, ss, i0, i1) + if ss[0].is_valid_int(): + paths.append(ss[0].to_int()) + else: + if ss[0]: + paths.append(ss[0]) + i0 = i1 + 1 + + +func _on_request_rtr_request_completed(result, _response_code, headers, body: PackedByteArray): + if result != 0: + var rs = $request_rtr.get_result_string(result) + log.error('\"%s\"' % rs) + return + + var json_str: String = body.get_string_from_utf8() + if not json_str: + push_error('не удаётся получить строку utf8 из данных (%s)' % headers) + return + + var rc = json_conv.parse(json_str) + if rc != Error.OK: + var err = json_conv.get_error_message() + push_error('разбор json прерван - \"%s\" (%s)' % [err, headers]) + return + + + var pp = ['DeviceDescripton', 'DeviceName'] + var ppp = [] + map_solid_to_array(prefix_path, ppp) + var ret_val = [null, false, 0] + var pp_copy = pp.duplicate(true) + tools.get_value_by_path(json_conv.data, pp, ret_val) + if not ret_val[1]: + push_error('путь %s не найден (%s)' % [pp_copy, ret_val[2]]) + return + + var bort_rtr_name_left: StringName = $left.get_meta('DeviceName', '') + var bort_rtr_name_right: StringName = $right.get_meta('DeviceName', '') + var bb = {bort_rtr_name_left: $left, bort_rtr_name_right: $right} + if not bb.has(ret_val[0]): + return + + var bort_rtr = bb[ret_val[0]] + for child in bort_rtr.get_node('konverter/grid').get_children(): + map_value_to_item(json_conv.data, child, 'value0') + map_value_to_item(json_conv.data, child, 'value1') + map_value_to_item(json_conv.data, child, 'value2') + map_error_codes_to_item(json_conv.data, child, 'state', 0) + for child in bort_rtr.get_node('antenna1/grid').get_children(): + map_value_to_item(json_conv.data, child, 'value0') + map_value_to_item(json_conv.data, child, 'value1') + map_error_codes_to_item(json_conv.data, child, 'state', 0) + for child in bort_rtr.get_node('antenna2/grid').get_children(): + map_value_to_item(json_conv.data, child, 'value0') + map_value_to_item(json_conv.data, child, 'value1') + map_error_codes_to_item(json_conv.data, child, 'state', 0) + for child in bort_rtr.get_children(): + map_value_to_item(json_conv.data, child, 'value0') + map_value_to_item(json_conv.data, child, 'value1') + map_error_codes_to_item(json_conv.data, child, 'state', 0) + + +func map_value_to_item(data, item, value_name: StringName): + var meta = item.get_meta(value_name, '') + if meta == '': + return + if not (meta is String): + return + var paths: = Array() + map_solid_to_array(meta, paths) + var ret_val: = [null, false, 0] + var paths_copy = paths.duplicate(true) + tools.get_value_by_path(data, paths, ret_val) + if ret_val[1]: + item.set(value_name, ret_val[0]) + else: + push_error('не найденпуть %s (%s) для $%s.%s (%s)' % [paths_copy, ret_val[2], item.name, value_name, item.tooltip_text]) + + +func map_error_codes_to_item(data, item, value_name: StringName, value_init: int): + var metas = item.get_meta(value_name, '') + if not (metas is Array): + return + var paths: = Array() + var values: = Array() + for meta in metas: + map_solid_to_array(meta, paths) + var ret_val: = [null, false, 0] + var paths_copy = paths.duplicate(true) + tools.get_value_by_path(data, paths, ret_val) + if ret_val[1]: + values.append(ret_val[0]) + else: + push_error('не найден путь %s(%s) для $%s.%s (%s)' % [paths_copy, ret_val[2], item.name, value_name, item.tooltip_text]) + if values.size() == metas.size(): + var test_res = 1 if values.count(true) == values.size() else 2 + item.set(value_name, test_res) + else: + item.set(value_name, value_init) + + +## Вызывается при клике мыши на элементе контроля. +## [param block_a] - Кликнутый элемент контроля. +func _on_item_pressed(block_a: Control): + var metas = block_a.get_meta_list() + print_debug(block_a) + for n in metas: + var v = block_a.get_meta(n) + print_debug('%s:%s' % [n, v]) diff --git a/scenes/pribor-rtr/pribor-rtr.gd.uid b/scenes/pribor-rtr/pribor-rtr.gd.uid new file mode 100644 index 0000000..4c71852 --- /dev/null +++ b/scenes/pribor-rtr/pribor-rtr.gd.uid @@ -0,0 +1 @@ +uid://d0jwv5opi3mrk diff --git a/scenes/pribor-rtr/pribor-rtr.tscn b/scenes/pribor-rtr/pribor-rtr.tscn new file mode 100644 index 0000000..80da2f2 --- /dev/null +++ b/scenes/pribor-rtr/pribor-rtr.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=4 format=3 uid="uid://5uv1idl3lqea"] + +[ext_resource type="Script" uid="uid://d0jwv5opi3mrk" path="res://scenes/pribor-rtr/pribor-rtr.gd" id="1_sqyma"] +[ext_resource type="Script" uid="uid://bux47vkw71w1t" path="res://scenes/pribor-afsp/request.gd" id="6_iwtoo"] + +[sub_resource type="GDScript" id="GDScript_yhnwg"] +script/source = "extends Timer + +func _ready(): wait_time = ProjectSettings.get_setting('application/config/unit_rr_request_period') +" + +[node name="pribor_rtr" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_left = 10.0 +offset_top = 78.0 +offset_right = 10.0 +offset_bottom = 78.0 +scale = Vector2(0.9, 0.9) +script = ExtResource("1_sqyma") + +[node name="lbl_header" type="Label" parent="."] +layout_mode = 0 +offset_top = -44.8889 +offset_right = 1044.0 +offset_bottom = -15.8889 +theme_override_font_sizes/font_size = 22 +text = "Контроль исправности прибора" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="request_rtr" type="HTTPRequest" parent="."] +script = ExtResource("6_iwtoo") + +[node name="timer" type="Timer" parent="request_rtr"] +wait_time = 4.168 +autostart = true +script = SubResource("GDScript_yhnwg") + +[node name="lbl_left" type="Label" parent="."] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 0 +offset_left = 217.0 +offset_top = -18.6666 +offset_right = 306.0 +offset_bottom = 3.33341 +theme_override_font_sizes/font_size = 17 +text = "левый борт" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="lbl_right" type="Label" parent="."] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 0 +offset_left = 739.0 +offset_top = -18.6666 +offset_right = 833.0 +offset_bottom = 3.33341 +theme_override_font_sizes/font_size = 17 +text = "правый борт" +horizontal_alignment = 1 +vertical_alignment = 1 + +[connection signal="child_entered_tree" from="request_rtr" to="request_rtr" method="_on_child_entered_tree"] +[connection signal="request_completed" from="request_rtr" to="." method="_on_request_rtr_request_completed"] +[connection signal="timeout" from="request_rtr/timer" to="request_rtr" method="_on_request_timer"] diff --git a/scenes/pribor-uf/pribor-uf.tscn b/scenes/pribor-uf/pribor-uf.tscn index d4765ea..754146c 100644 --- a/scenes/pribor-uf/pribor-uf.tscn +++ b/scenes/pribor-uf/pribor-uf.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://dwxn2puh462nl"] -[ext_resource type="Script" path="res://scenes/pribor-uf/pribor_uf.gd" id="1_7gtpa"] +[ext_resource type="Script" uid="uid://pvhb2f04v00w" path="res://scenes/pribor-uf/pribor_uf.gd" id="1_7gtpa"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_ho0da"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_dp78y"] diff --git a/scenes/контроль/кассета-п-1.tscn b/scenes/контроль/кассета-п-1.tscn index 4a1a6cd..0d88691 100644 --- a/scenes/контроль/кассета-п-1.tscn +++ b/scenes/контроль/кассета-п-1.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://dbxdb7lo7kofv"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_sbi2k"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_7ydqi"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="2_7ydqi"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_gg14a"] [node name="kasseta_p_1" type="NinePatchRect"] diff --git a/scenes/контроль/кассета-п-2.tscn b/scenes/контроль/кассета-п-2.tscn index b0ff758..bfa0835 100644 --- a/scenes/контроль/кассета-п-2.tscn +++ b/scenes/контроль/кассета-п-2.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://dq31j24gv5vi4"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_jghyg"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_mdnod"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="2_mdnod"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_4a27g"] [node name="kasseta_p_2" type="NinePatchRect"] diff --git a/scenes/контроль/кассета-у-5-к.tscn b/scenes/контроль/кассета-у-5-к.tscn index 31b4a3b..5f117cc 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://cm5jd4gjrrpba"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_bdojw"] -[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_csgh4"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="2_csgh4"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_wtlpi"] [node name="kasseta_u5" type="NinePatchRect"] diff --git a/scenes/контроль/контроль.gd b/scenes/контроль/контроль.gd index f226705..5cc9517 100644 --- a/scenes/контроль/контроль.gd +++ b/scenes/контроль/контроль.gd @@ -3,7 +3,7 @@ extends Panel """ Режим контроль """ - +#TODO: рефактор: заменить подчёркивание на тире const PRIBORS_RES = \ { 'pribor_prd_k_1': ['res://scenes/pribor-prd-k/pribor-prd-k.tscn', 'Контроль исправности прибора ПРД-К 1'], @@ -19,8 +19,8 @@ const PRIBORS_RES = \ 'pribor_prd_v_3': ['res://scenes/pribor-prd-v/pribor-prd-v.tscn', 'Контроль исправности прибора ПРД-В 3'], 'pribor_prd_v_4': ['res://scenes/pribor-prd-v/pribor-prd-v.tscn', 'Контроль исправности прибора ПРД-В 4'], 'pribor_rtr': ['res://scenes/pribor-rtr/pribor-rtr.tscn', 'Контроль исправности прибора РТР'], - 'pribor_afsp_1': ['res://scenes/pribor-afsp/pribor-afsp.tscn', 'Контроль исправности прибора АФСП 1'], - 'pribor_afsp_2': ['res://scenes/pribor-afsp/pribor-afsp.tscn', 'Контроль исправности прибора АФСП 2'], + 'pribor_afsp_1': ['res://scenes/pribor-afsp/pribor-afsp-1.tscn', 'Контроль исправности прибора АФСП 1'], + 'pribor_afsp_2': ['res://scenes/pribor-afsp/pribor-afsp-2.tscn', 'Контроль исправности прибора АФСП 2'], 'pribor_uf': ['res://scenes/pribor-uf/pribor-uf.tscn', 'Контроль исправности прибора УФ'], 'pribor_uyep': ['res://scenes/pribor-uyep/pribor-uyep.tscn', 'Контроль исправности устройства У-ЭП'], } diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 196c974..9a75da6 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -285,6 +285,6 @@ texture_pressed = ExtResource("13_ggrwd") [connection signal="drag_continue" from="." to="." method="_on_drag_continue"] [connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"] [connection signal="toggled" from="chk_auto" to="." method="on_value_changed"] -[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] [connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"] +[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] [connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"]