Доработка. В процессе. Разделить прибор РТР на два АФСП
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
79
scenes/pribor-afsp/pribor-afsp-1.tscn
Normal file
79
scenes/pribor-afsp/pribor-afsp-1.tscn
Normal file
@@ -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"]
|
||||
@@ -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)
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
135
scenes/pribor-rtr/pribor-rtr.gd
Normal file
135
scenes/pribor-rtr/pribor-rtr.gd
Normal file
@@ -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])
|
||||
1
scenes/pribor-rtr/pribor-rtr.gd.uid
Normal file
1
scenes/pribor-rtr/pribor-rtr.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d0jwv5opi3mrk
|
||||
66
scenes/pribor-rtr/pribor-rtr.tscn
Normal file
66
scenes/pribor-rtr/pribor-rtr.tscn
Normal file
@@ -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"]
|
||||
@@ -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"]
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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', 'Контроль исправности устройства У-ЭП'],
|
||||
}
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user