diff --git a/scenes/pribor-uyep/block-input.tscn b/scenes/pribor-uyep/block-input.tscn new file mode 100644 index 0000000..429c081 --- /dev/null +++ b/scenes/pribor-uyep/block-input.tscn @@ -0,0 +1,179 @@ +[gd_scene load_steps=13 format=3 uid="uid://ku8rdjoyscai"] + +[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_hot1o"] +[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_0xfrj"] +[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_vs130"] +[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_lvhef"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"] + +[sub_resource type="GDScript" id="GDScript_oj3k3"] +script/source = "@tool + +extends PanelContainer + +@export var textures: Array + +signal pressed(control: PanelContainer) + +@export var fname: String: + set(v): + fname = v + $margin/vbox/title/fname.text = v + + +@export var state0: int: + set(v): + state0 = tools.clip_value(v, 0, textures.size() - 1) + $margin/vbox/table/state0.texture = textures[v] + + +@export var state1: int: + set(v): + state1 = tools.clip_value(v, 0, textures.size() - 1) + $margin/vbox/table/state1.texture = textures[v] + + +@export var state2: int: + set(v): + state2 = tools.clip_value(v, 0, textures.size() - 1) + $margin/vbox/table/state2.texture = textures[v] + + +func _on_button_pressed(): + emit_signal('pressed', self) +" + +[sub_resource type="GDScript" id="GDScript_45hqb"] +script/source = "@tool + +extends MarginContainer + + +func _enter_tree() -> void: + margins = [8, 8, 8, 8] + + +@export var margins: Array: + set(vals): + add_theme_constant_override('margin_top', vals[0]) + add_theme_constant_override('margin_left', vals[1]) + add_theme_constant_override('margin_bottom', vals[2]) + add_theme_constant_override('margin_right', vals[3]) + get: + var vals = [0, 0, 0, 0] + vals[0] = get_theme_constant('margin_top') + vals[1] = get_theme_constant('margin_left') + vals[2] = get_theme_constant('margin_bottom') + vals[3] = get_theme_constant('margin_right') + return vals + + +" + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"] + +[node name="block_input" type="PanelContainer"] +editor_description = "Элемент замены из ЗИП" +offset_right = 200.0 +offset_bottom = 120.0 +theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u") +script = SubResource("GDScript_oj3k3") +textures = [ExtResource("1_hot1o"), ExtResource("2_0xfrj"), ExtResource("3_vs130")] + +[node name="rect" type="NinePatchRect" parent="."] +layout_mode = 2 +texture = ExtResource("4_lvhef") +draw_center = false +region_rect = Rect2(0, 0, 63, 63) +patch_margin_left = 17 +patch_margin_top = 17 +patch_margin_right = 17 +patch_margin_bottom = 15 + +[node name="margin" type="MarginContainer" parent="."] +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 +script = SubResource("GDScript_45hqb") +margins = [8, 8, 8, 8] + +[node name="vbox" type="VBoxContainer" parent="margin"] +layout_mode = 2 +alignment = -1 + +[node name="title" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 + +[node name="fname" type="Label" parent="margin/vbox/title"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_font_sizes/font_size = 17 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="table" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 +columns = 2 + +[node name="state0" type="TextureRect" parent="margin/vbox/table"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +texture = ExtResource("1_hot1o") +expand_mode = 1 + +[node name="name0" type="Label" parent="margin/vbox/table"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +theme_override_font_sizes/font_size = 17 +text = "Входное напряжение" + +[node name="state1" type="TextureRect" parent="margin/vbox/table"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +texture = ExtResource("1_hot1o") +expand_mode = 1 + +[node name="name1" type="Label" parent="margin/vbox/table"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +theme_override_font_sizes/font_size = 17 +text = "Блок инвертора" + +[node name="state2" type="TextureRect" parent="margin/vbox/table"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 +texture = ExtResource("1_hot1o") +expand_mode = 1 + +[node name="name2" type="Label" parent="margin/vbox/table"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +theme_override_font_sizes/font_size = 17 +text = "Температура" + +[node name="button" type="Button" parent="."] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw") +theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa") +theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw") +theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms") +theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06") + +[connection signal="pressed" from="button" to="." method="_on_button_pressed"] diff --git a/scenes/pribor-uyep/block-output.tscn b/scenes/pribor-uyep/block-output.tscn new file mode 100644 index 0000000..b7cd077 --- /dev/null +++ b/scenes/pribor-uyep/block-output.tscn @@ -0,0 +1,162 @@ +[gd_scene load_steps=13 format=3 uid="uid://bsixhjfesq6r4"] + +[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_20kkm"] +[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_t54t5"] +[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_et31i"] +[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_u5qvj"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"] + +[sub_resource type="GDScript" id="GDScript_oj3k3"] +script/source = "@tool + +extends PanelContainer + +@export var textures: Array + +signal pressed(control: PanelContainer) + +@export var fname: String: + set(v): + fname = v + $margin/vbox/title/fname.text = v + + +@export var rname: String: + set(v): + rname = v + $margin/vbox/title/rname.text = v + + +@export var state: int: + set(v): + state = tools.clip_value(v, 0, textures.size() - 1) + $margin/vbox/grid/state.texture = textures[v] + + +@export var alignment: int: + set(v): + $margin/vbox.alignment = v + + +func _on_button_pressed(): + emit_signal('pressed', self) +" + +[sub_resource type="GDScript" id="GDScript_45hqb"] +script/source = "@tool + +extends MarginContainer + + +func _enter_tree() -> void: + margins = [8, 8, 8, 8] + + +@export var margins: Array: + set(vals): + add_theme_constant_override('margin_top', vals[0]) + add_theme_constant_override('margin_left', vals[1]) + add_theme_constant_override('margin_bottom', vals[2]) + add_theme_constant_override('margin_right', vals[3]) + get: + var vals = [0, 0, 0, 0] + vals[0] = get_theme_constant('margin_top') + vals[1] = get_theme_constant('margin_left') + vals[2] = get_theme_constant('margin_bottom') + vals[3] = get_theme_constant('margin_right') + return vals + + +" + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"] + +[node name="block_output" type="PanelContainer"] +editor_description = "Элемент замены из ЗИП" +offset_right = 210.0 +offset_bottom = 70.0 +theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u") +script = SubResource("GDScript_oj3k3") +textures = [ExtResource("1_20kkm"), ExtResource("2_t54t5"), ExtResource("3_et31i")] + +[node name="rect" type="NinePatchRect" parent="."] +layout_mode = 2 +texture = ExtResource("4_u5qvj") +draw_center = false +region_rect = Rect2(0, 0, 63, 63) +patch_margin_left = 17 +patch_margin_top = 17 +patch_margin_right = 17 +patch_margin_bottom = 15 + +[node name="margin" type="MarginContainer" parent="."] +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 +script = SubResource("GDScript_45hqb") +margins = [8, 8, 8, 8] + +[node name="vbox" type="VBoxContainer" parent="margin"] +layout_mode = 2 + +[node name="title" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 + +[node name="fname" type="Label" parent="margin/vbox/title"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_font_sizes/font_size = 17 +text = "Выход" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="table" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 +columns = 2 + +[node name="state0" type="TextureRect" parent="margin/vbox/table"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 +texture = ExtResource("1_20kkm") +expand_mode = 1 + +[node name="name0" type="Label" parent="margin/vbox/table"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +theme_override_font_sizes/font_size = 17 +text = "Напряжение" + +[node name="state1" type="TextureRect" parent="margin/vbox/table"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 +texture = ExtResource("1_20kkm") +expand_mode = 1 + +[node name="name1" type="Label" parent="margin/vbox/table"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +theme_override_font_sizes/font_size = 17 +text = "Нагрузка" + +[node name="button" type="Button" parent="."] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw") +theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa") +theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw") +theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms") +theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06") + +[connection signal="pressed" from="button" to="." method="_on_button_pressed"] diff --git a/scenes/pribor-uyep/pribor-uyep.gd b/scenes/pribor-uyep/pribor-uyep.gd new file mode 100644 index 0000000..809e0cd --- /dev/null +++ b/scenes/pribor-uyep/pribor-uyep.gd @@ -0,0 +1 @@ +extends "res://scenes/контроль/прибор.gd" diff --git a/scenes/pribor-uyep/pribor-uyep.tscn b/scenes/pribor-uyep/pribor-uyep.tscn index 18c747b..823959f 100644 --- a/scenes/pribor-uyep/pribor-uyep.tscn +++ b/scenes/pribor-uyep/pribor-uyep.tscn @@ -1,13 +1,16 @@ -[gd_scene load_steps=4 format=3 uid="uid://bs7h65e7bodp3"] +[gd_scene load_steps=6 format=3 uid="uid://bs7h65e7bodp3"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_6olof"] -[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_b7gyx"] -[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="2_cf6tc"] +[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_46rp6"] +[ext_resource type="PackedScene" uid="uid://ku8rdjoyscai" path="res://scenes/pribor-uyep/block-input.tscn" id="4_mrvir"] +[ext_resource type="PackedScene" uid="uid://bsixhjfesq6r4" path="res://scenes/pribor-uyep/block-output.tscn" id="5_x74mk"] +[ext_resource type="PackedScene" uid="uid://btpc78gucr57f" path="res://scenes/контроль/элемент-я.tscn" id="6_60xs3"] [node name="pribor_uyep" type="Control"] layout_mode = 3 anchors_preset = 0 -script = ExtResource("1_b7gyx") +script = ExtResource("1_46rp6") +unit_name = "уарэп-спт25-1" [node name="ref_G1" type="NinePatchRect" parent="."] layout_mode = 0 @@ -20,52 +23,90 @@ patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 - -[node name="ref_A1" parent="." instance=ExtResource("2_cf6tc")] -offset_left = 175.0 -offset_top = 529.0 -offset_right = 335.0 -offset_bottom = 984.0 -self_size = Vector2i(160, 455) -fname = "МАА150-1С27" -rname = "A1" - -[node name="ref_A2" parent="." instance=ExtResource("2_cf6tc")] -offset_left = 496.0 -offset_top = 531.0 -offset_right = 636.0 -offset_bottom = 988.0 -self_size = Vector2i(140, 457) -fname = "МАА150-1С27" -rname = "A2" - -[node name="ref_A3" parent="." instance=ExtResource("2_cf6tc")] -offset_left = 377.0 -offset_top = 531.0 -offset_right = 467.0 -offset_bottom = 985.0 -self_size = Vector2i(90, 454) -fname = "МАА150-1С27" -rname = "A2" +metadata/_edit_lock_ = true [node name="lbl_header" type="Label" parent="."] layout_mode = 0 -offset_left = 10.0 +offset_left = 100.0 offset_top = 156.0 -offset_right = 865.0 +offset_right = 750.0 offset_bottom = 182.0 theme_override_font_sizes/font_size = 22 -text = "Контроль исправности прибора Щ3" +text = "Контроль исправности прибора УЭП" horizontal_alignment = 1 vertical_alignment = 1 [node name="Label" type="Label" parent="."] self_modulate = Color(0.835294, 0.141176, 0.286275, 1) layout_mode = 0 -offset_left = 244.0 -offset_top = 1039.0 -offset_right = 619.0 -offset_bottom = 1058.0 +offset_left = 245.0 +offset_top = 1065.0 +offset_right = 620.0 +offset_bottom = 1084.0 text = "** Позиционные обозначения требуют уточнения **" horizontal_alignment = 1 vertical_alignment = 1 + +[node name="spt25_A1" parent="." instance=ExtResource("6_60xs3")] +layout_mode = 0 +offset_left = 135.0 +offset_top = 485.0 +offset_right = 375.0 +offset_bottom = 870.0 +fname = "СПТ-25-230-400" +rname = "A1" + +[node name="block_input1" parent="spt25_A1" instance=ExtResource("4_mrvir")] +layout_mode = 0 +offset_left = 15.0 +offset_top = 35.0 +offset_right = 225.0 +offset_bottom = 155.0 +fname = "Сеть 1" + +[node name="block_input2" parent="spt25_A1" instance=ExtResource("4_mrvir")] +layout_mode = 0 +offset_left = 15.0 +offset_top = 155.0 +offset_right = 225.0 +offset_bottom = 275.0 +fname = "Сеть 2" + +[node name="block_output" parent="spt25_A1" instance=ExtResource("5_x74mk")] +layout_mode = 0 +offset_left = 15.0 +offset_top = 275.0 +offset_right = 225.0 +offset_bottom = 367.0 + +[node name="spt25_A2" parent="." instance=ExtResource("6_60xs3")] +layout_mode = 0 +offset_left = 435.0 +offset_top = 485.0 +offset_right = 675.0 +offset_bottom = 875.0 +fname = "СПТ-25-230-400" +rname = "A2" + +[node name="block_input1" parent="spt25_A2" instance=ExtResource("4_mrvir")] +layout_mode = 0 +offset_left = 15.0 +offset_top = 35.0 +offset_right = 225.0 +offset_bottom = 155.0 +fname = "Сеть 1" + +[node name="block_input2" parent="spt25_A2" instance=ExtResource("4_mrvir")] +layout_mode = 0 +offset_left = 15.0 +offset_top = 155.0 +offset_right = 225.0 +offset_bottom = 275.0 +fname = "Сеть 2" + +[node name="block_output" parent="spt25_A2" instance=ExtResource("5_x74mk")] +layout_mode = 0 +offset_left = 15.0 +offset_top = 275.0 +offset_right = 225.0 +offset_bottom = 367.0 diff --git a/scenes/контроль/прибор.gd b/scenes/контроль/прибор.gd index 0909975..79bdc9b 100644 --- a/scenes/контроль/прибор.gd +++ b/scenes/контроль/прибор.gd @@ -21,7 +21,3 @@ extends Control func set_header_text(header_text: String): $lbl_header.text = header_text - - -@export var nodes_mask: String = '' - diff --git a/scenes/контроль/элемент-пустой.tscn b/scenes/контроль/элемент-пустой.tscn new file mode 100644 index 0000000..7254f96 --- /dev/null +++ b/scenes/контроль/элемент-пустой.tscn @@ -0,0 +1,134 @@ +[gd_scene load_steps=13 format=3 uid="uid://3nw70a3320yc"] + +[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_ihl8b"] +[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_cji5r"] +[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_ecwtv"] +[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_o6o0s"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"] + +[sub_resource type="GDScript" id="GDScript_oj3k3"] +script/source = "@tool + +extends PanelContainer + +@export var textures: Array + +signal pressed(control: PanelContainer) + +@export var fname: String: + set(v): + fname = v + $margin/vbox/grid/fname.text = v + + +@export var rname: String: + set(v): + rname = v + $margin/vbox/grid/rname.text = v + + +@export var state: int: + set(v): + state = tools.clip_value(v, 0, textures.size() - 1) + $margin/vbox/grid/state.texture = textures[v] + + +@export var alignment: int: + set(v): + $margin/vbox.alignment = v + + +func _on_button_pressed(): + emit_signal('pressed', self) +" + +[sub_resource type="GDScript" id="GDScript_45hqb"] +script/source = "@tool + +extends MarginContainer + + +func _enter_tree() -> void: + margins = [8, 8, 8, 8] + + +@export var margins: Array: + set(vals): + add_theme_constant_override('margin_top', vals[0]) + add_theme_constant_override('margin_left', vals[1]) + add_theme_constant_override('margin_bottom', vals[2]) + add_theme_constant_override('margin_right', vals[3]) + get: + var vals = [0, 0, 0, 0] + vals[0] = get_theme_constant('margin_top') + vals[1] = get_theme_constant('margin_left') + vals[2] = get_theme_constant('margin_bottom') + vals[3] = get_theme_constant('margin_right') + return vals + + +" + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"] + +[node name="yelement_empty" type="PanelContainer"] +editor_description = "Элемент замены из ЗИП" +offset_right = 150.0 +offset_bottom = 50.0 +theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u") +script = SubResource("GDScript_oj3k3") +textures = [ExtResource("1_ihl8b"), ExtResource("2_cji5r"), ExtResource("3_ecwtv")] + +[node name="rect" type="NinePatchRect" parent="."] +layout_mode = 2 +texture = ExtResource("4_o6o0s") +draw_center = false +region_rect = Rect2(0, 0, 63, 63) +patch_margin_left = 17 +patch_margin_top = 17 +patch_margin_right = 17 +patch_margin_bottom = 15 + +[node name="margin" type="MarginContainer" parent="."] +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 +script = SubResource("GDScript_45hqb") +margins = [8, 8, 8, 8] + +[node name="vbox" type="VBoxContainer" parent="margin"] +layout_mode = 2 + +[node name="grid" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 + +[node name="fname" type="Label" parent="margin/vbox/grid"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_font_sizes/font_size = 17 +text = "Заголовок" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="button" type="Button" parent="."] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw") +theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa") +theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw") +theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms") +theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06") + +[connection signal="pressed" from="button" to="." method="_on_button_pressed"] diff --git a/scenes/контроль/элемент-я.tscn b/scenes/контроль/элемент-я.tscn new file mode 100644 index 0000000..ddb9e9a --- /dev/null +++ b/scenes/контроль/элемент-я.tscn @@ -0,0 +1,145 @@ +[gd_scene load_steps=9 format=3 uid="uid://btpc78gucr57f"] + +[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_or1kj"] + +[sub_resource type="GDScript" id="GDScript_oj3k3"] +script/source = "@tool + +extends Control + +signal pressed(control: PanelContainer) + + +func _on_button_pressed(): + emit_signal('pressed', self) + + +@export var fname: String: + set(v): + fname = v + $margin/vbox/grid/fname.text = v + + +@export var rname: String: + set(v): + rname = v + $margin/vbox/grid/rname.text = v + + +@export var alignment: int: + set(v): + $margin/vbox.alignment = v + + +@export var unit_name: String = '' + + +func _enter_tree() -> void: _on_resized() + +func _on_resized() -> void: + $rect.size = size + $margin.size = size +" + +[sub_resource type="GDScript" id="GDScript_45hqb"] +script/source = "@tool + +extends MarginContainer + + +func _enter_tree() -> void: + margins = [8, 8, 8, 8] + + +@export var margins: Array: + set(vals): + add_theme_constant_override('margin_top', vals[0]) + add_theme_constant_override('margin_left', vals[1]) + add_theme_constant_override('margin_bottom', vals[2]) + add_theme_constant_override('margin_right', vals[3]) + get: + var vals = [0, 0, 0, 0] + vals[0] = get_theme_constant('margin_top') + vals[1] = get_theme_constant('margin_left') + vals[2] = get_theme_constant('margin_bottom') + vals[3] = get_theme_constant('margin_right') + return vals + + +" + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"] + +[node name="yelement_ya" type="Control"] +editor_description = "Элемент замены из ЗИП" +layout_mode = 3 +anchors_preset = 0 +script = SubResource("GDScript_oj3k3") + +[node name="rect" type="NinePatchRect" parent="."] +layout_mode = 2 +offset_right = 34.0 +offset_bottom = 32.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +texture = ExtResource("4_or1kj") +draw_center = false +region_rect = Rect2(0, 0, 63, 63) +patch_margin_left = 17 +patch_margin_top = 17 +patch_margin_right = 17 +patch_margin_bottom = 15 + +[node name="margin" type="MarginContainer" parent="."] +layout_mode = 2 +offset_right = 22.0 +offset_bottom = 42.0 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 +script = SubResource("GDScript_45hqb") +margins = [8, 8, 8, 8] + +[node name="vbox" type="VBoxContainer" parent="margin"] +layout_mode = 2 + +[node name="grid" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 +columns = 2 + +[node name="fname" type="Label" parent="margin/vbox/grid"] +self_modulate = Color(1, 1, 1, 0.627451) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_font_sizes/font_size = 17 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="rname" type="Label" parent="margin/vbox/grid"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_font_sizes/font_size = 22 +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="button" type="Button" parent="."] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw") +theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa") +theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw") +theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms") +theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06") + +[connection signal="resized" from="." to="." method="_on_resized"] +[connection signal="pressed" from="button" to="." method="_on_button_pressed"] diff --git a/scripts/repsettings.gd b/scripts/repsettings.gd index d5d0f41..26b4a9a 100644 --- a/scripts/repsettings.gd +++ b/scripts/repsettings.gd @@ -27,9 +27,9 @@ class_name rep_settings extends Node # Название: [ Протокол, Адрес, [ Порт получения, Порт отправки], ??, ??, Комментарий 'уарэп-щ3': ['udp-json-mbcs', '127.0.0.1', [48000, 44100], false, true, 'IP-адрес и порты через которые производят обмен сообщения с драйвером клиента Modbus Serial'], - # Название: [ Протокол, Имя порта, Скорость, Чётность, ??, Комментарий - 'уарэп-спт25-1': ['uart', '/home/sasha/dev/tty0', [115200, false, false], 'Адрес прибора СПТ-25 (G1)'], - 'уарэп-спт25-2': ['uart', '/home/sasha/dev/tty4', [115200, false, false], 'Адрес прибора СПТ-25 (G2)'], + # Название: [ Протокол, Имя порта, Скорость, Чётность, ??, Комментарий + 'уарэп-спт25-1': ['uart', '/home/sasha/dev/tty0', [19200, false, false], 'Адрес прибора СПТ-25 (G1)'], + 'уарэп-спт25-2': ['uart', '/home/sasha/dev/tty4', [19200, false, false], 'Адрес прибора СПТ-25 (G2)'], } ## Параметры цели. diff --git a/scripts/signaller.gd b/scripts/signaller.gd index b8b8a8d..714238c 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -3,11 +3,22 @@ class_name Signaller extends Node ## Обмен сигналами между узлами. Здесь объявлены сигналы, которые используют ## два и более узла, из разных файлов. Должен быть помещён в автозагрузку. +## Подключает обработчик к событию по его определению func conn(sgnl: Signal, clbl: Callable): connect(sgnl.get_name(), clbl) -## Вызывается при + +## Вызывает сигнал по его определению +func emmit(sgnl: Signal): emit_signal(sgnl.get_name()) + + +## Вызывается при обнаружение ошибки последовательного порта signal serial_error() + +## Вызывается при приёме данных от устройства +signal data_received(data: PackedByteArray, unit_name: String) + + ## Вызывается при переходе в режим [b]Работа[/b]. signal режим_работа() diff --git a/scripts/spt25.gd b/scripts/spt25.gd index aecf700..2e9fee4 100644 --- a/scripts/spt25.gd +++ b/scripts/spt25.gd @@ -1,18 +1,21 @@ extends Node class SPT25: - signal line_changed(unit: SPT25) ## Вызывается когда меняется состояние связи + signal line_changed(unit: SPT25) ## Вызывается при изменение состояния связи signal command_done(unit: SPT25) ## Вызывается после выполнения команды. signal command_fail(unit: SPT25) ## Вызывается если возникла ошибка при выполнении команды и команда не выполнена. signal parse_failed(unit: SPT25) ## Вызывается при обнаружении ошибки во входных данных var online: bool var name: String - func process(delta: float): pass func _init(nm) -> void: self.name = nm func _to_string() -> String: return String('СПТ-25: %s %s' % [self.name, ['отключен', 'на связи'][int(online)]]) func parse(rx_data: PackedByteArray): - print_debug(rx_data) if not self.online: self.online = true emit_signal('line_changed', self) + + + func process(delta: float): + pass +