[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 state: int:
    set(v):
        state = v
        if v == 0:
            $margin/vbox/title/lbl_using.text = '<нет данных>'
            $margin/vbox/title/lbl_using.self_modulate = Color.CADET_BLUE
        elif v == 1:
            $margin/vbox/title/lbl_using.text = 'используется'
            $margin/vbox/title/lbl_using.self_modulate = Color.GREEN
        elif v == 2:
            $margin/vbox/title/lbl_using.text = 'отключено'
            $margin/vbox/title/lbl_using.self_modulate = Color.WHITE


@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)


func _enter_tree() -> void:
    if is_inside_tree():
        $margin/vbox/title/lbl_using.self_modulate = Color.CADET_BLUE
"

[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_evx06"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"]

[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
columns = 2

[node name="fname" type="Label" parent="margin/vbox/title"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
size_flags_horizontal = 2
theme_override_font_sizes/font_size = 17
vertical_alignment = 1

[node name="lbl_using" type="Label" parent="margin/vbox/title"]
self_modulate = Color(0.372549, 0.619608, 0.627451, 1)
layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 6
tooltip_text = "Частота питающего напряжения"
mouse_filter = 0
theme_override_font_sizes/font_size = 22
text = "<нет данных>"
horizontal_alignment = 2
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/focus = SubResource("StyleBoxEmpty_evx06")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms")
theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw")
theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw")

[connection signal="pressed" from="button" to="." method="_on_button_pressed"]
