From 69b455f811429da69dcc5c5556bbd6eff60ffe1d Mon Sep 17 00:00:00 2001 From: TotMaxim Date: Thu, 13 Nov 2025 00:23:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=BD=D0=B8=D0=BC=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/контроль/control_prd.gd | 79 ++++++++++++++++++++++++++++++ scenes/контроль/control_prd.gd.uid | 1 + scenes/контроль/контроль.tscn | 4 +- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 scenes/контроль/control_prd.gd create mode 100644 scenes/контроль/control_prd.gd.uid diff --git a/scenes/контроль/control_prd.gd b/scenes/контроль/control_prd.gd new file mode 100644 index 00000000..1d1baaf7 --- /dev/null +++ b/scenes/контроль/control_prd.gd @@ -0,0 +1,79 @@ +extends Button + +var base_style: StyleBoxFlat +var tween +var pulsing: bool = false +var original_text: String + + +func _ready(): + original_text = text + _setup_styles() + _setup_signals() + + +func _setup_styles() -> void: + if get("theme_override_styles/disabled") == null: + base_style = StyleBoxFlat.new() + base_style.border_color = Color(1.0, 0.5, 0.0) + base_style.border_width_top = 4 + base_style.border_width_bottom = 4 + base_style.border_width_left = 4 + base_style.border_width_right = 4 + base_style.bg_color = Color(0.2, 0.2, 0.2) + set("theme_override_styles/disabled", base_style) + else: + base_style = get("theme_override_styles/disabled") + set("theme_override_colors/font_disabled_color", Color(1.0, 1.0, 1.0)) + + +func _setup_signals() -> void: + connect("pressed", Callable(self, "_on_pressed")) + + if not signaller: + return + var signals_to_connect := ["режим_работа", "режим_журнал", "режим_эмс", "режим_настройки", "режим_контроль"] + for signal_name in signals_to_connect: + if signaller.has_signal(signal_name): + signaller.connect(signal_name, Callable(self, "_on_status_change")) + + +func _on_pressed(): + disabled = true + text = "Идет выполнение контроля" + _start_pulse() + + +func _start_pulse(): + if pulsing: + return + pulsing = true + tween = create_tween() + tween.set_loops() + var color1 = Color(1.0, 0.5, 0.0) # оранжевый + var color2 = Color(0.4, 0.4, 0.4) # серый + tween.tween_property(base_style, "border_color", color2, 0.5)\ + .set_trans(Tween.TRANS_SINE)\ + .set_ease(Tween.EASE_IN_OUT) + tween.tween_property(base_style, "border_color", color1, 0.5)\ + .set_trans(Tween.TRANS_SINE)\ + .set_ease(Tween.EASE_IN_OUT) + + +func _stop_pulse(): + if tween: + tween.kill() + tween = null + base_style.border_color = Color(1.0, 0.5, 0.0) + pulsing = false + disabled = false + text = original_text + + +func _on_status_change(): + _stop_pulse() + + +func _exit_tree() -> void: + if tween: + tween.kill() diff --git a/scenes/контроль/control_prd.gd.uid b/scenes/контроль/control_prd.gd.uid new file mode 100644 index 00000000..d2330c16 --- /dev/null +++ b/scenes/контроль/control_prd.gd.uid @@ -0,0 +1 @@ +uid://xjs7owe2iexn diff --git a/scenes/контроль/контроль.tscn b/scenes/контроль/контроль.tscn index 0f291072..5a3a92e3 100644 --- a/scenes/контроль/контроль.tscn +++ b/scenes/контроль/контроль.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://lwmw4egynmd1"] +[gd_scene load_steps=21 format=3 uid="uid://lwmw4egynmd1"] [ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"] [ext_resource type="Script" uid="uid://q3gmpsqspjfp" path="res://scenes/контроль/внешний.gd" id="2_8r80x"] @@ -17,6 +17,7 @@ [ext_resource type="Texture2D" uid="uid://00871pb6moln" path="res://data/прогресс-фон-1.png" id="9_w6m6a"] [ext_resource type="Texture2D" uid="uid://c1k856fxhrjnh" path="res://data/прогресс-заполнение-1.png" id="10_lbx5w"] [ext_resource type="Script" uid="uid://bncy1x53jp73d" path="res://scenes/контроль/connect_pribor.gd" id="11_u7tym"] +[ext_resource type="Script" uid="uid://xjs7owe2iexn" path="res://scenes/контроль/control_prd.gd" id="18_lbx5w"] [sub_resource type="GDScript" id="GDScript_iqgf5"] script/source = "extends Panel @@ -1687,6 +1688,7 @@ offset_right = 1326.0 offset_bottom = 104.0 focus_mode = 0 text = "Запуск контроля" +script = ExtResource("18_lbx5w") [connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"] [connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"]