add device

This commit is contained in:
2024-12-20 14:40:01 +03:00
parent c65e3e1abb
commit 827c85fa9e
8 changed files with 51 additions and 16 deletions

View File

@@ -15,7 +15,7 @@
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://table/элемент-в.tscn" id="11_fg7ul"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://table/элемент-в.tscn" id="11_fg7ul"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eib3t"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eib3t"]
bg_color = Color(0.356863, 0.278431, 0.356863, 1) bg_color = Color(0.223529, 0.168627, 0.223529, 1)
border_width_bottom = 6 border_width_bottom = 6
border_color = Color(0.228592, 0.173062, 0.22863, 1) border_color = Color(0.228592, 0.173062, 0.22863, 1)
border_blend = true border_blend = true
@@ -453,9 +453,9 @@ metadata/_edit_lock_ = true
[node name="lbl_control" type="Label" parent="TabContainer/ControlPanel"] [node name="lbl_control" type="Label" parent="TabContainer/ControlPanel"]
layout_mode = 0 layout_mode = 0
offset_left = 636.0 offset_left = 4.0
offset_top = 21.0 offset_top = 21.0
offset_right = 1256.0 offset_right = 624.0
offset_bottom = 52.0 offset_bottom = 52.0
theme_override_font_sizes/font_size = 22 theme_override_font_sizes/font_size = 22
text = "Контроль исправности прибора ПРД-Н" text = "Контроль исправности прибора ПРД-Н"

View File

@@ -100,9 +100,10 @@ func _on_data_received(data_from_yau_07):
process_sockets_vert(in_blank, in_imp, 16, 1, parent_node2) process_sockets_vert(in_blank, in_imp, 16, 1, parent_node2)
process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2) process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2)
func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_node2: Node): func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_node2: Node):
for i in count: for i in count:
var socket_status = node_select1.get_node2(col+i, shift).get_child(0, false) var socket_status = node_select1.get_node2(col+i, shift).get_child(1, false)
var frame_type = Constants.Frame.WORK var frame_type = Constants.Frame.WORK
if (blank & (1 << i)) != 0: if (blank & (1 << i)) != 0:
@@ -126,7 +127,7 @@ func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_
func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_node2: Node): func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_node2: Node):
for i in count: for i in count:
var socket_status = node_select1.get_node2(col, i + shift+1).get_child(0, false) var socket_status = node_select1.get_node2(col, i + shift+1).get_child(1, false)
var frame_type = Constants.Frame.WORK var frame_type = Constants.Frame.WORK
if (blank & (1 << i)) != 0: if (blank & (1 << i)) != 0:
@@ -176,12 +177,33 @@ func create_link_button(node, count_rows_sart: int, count_rows_end: int, coln_st
for i_row in range(count_rows_sart, count_rows_end): for i_row in range(count_rows_sart, count_rows_end):
for i_col in range (coln_start, coln_end): for i_col in range (coln_start, coln_end):
var chk_node = node.get_node2(i_col, i_row) var chk_node = node.get_node2(i_col, i_row)
var mouse_area = chk_node.get_child(0, false)
var chk_btn = chk_node.get_child(1, false) var chk_btn = chk_node.get_child(1, false)
mouse_area.connect('mouse_entered', Callable(self, 'on_mouse_entered').bind(chk_btn))
chk_btn.connect('mouse_entered', Callable(self, 'on_mouse_entered').bind(chk_btn))
chk_btn.connect('toggled', Callable(self, '_on_btn_connect').bind(chk_btn)) chk_btn.connect('toggled', Callable(self, '_on_btn_connect').bind(chk_btn))
chk_btn.set_meta('device', META_EMS_G[count_register]) chk_btn.set_meta('device', META_EMS_G[count_register])
count_register += 1 count_register += 1
func on_mouse_entered(meta_area):
var device = meta_area.get_meta('device')
var y = device[0] + 1
var x = device[1] - 45
for i_y in 18:
for i_x in 18:
if i_y <= y and i_x <= x and i_y == y:
var chest = $table1.get_node2(i_x, i_y+1).get_child(0, false)
chest.color = Color(0.45, 0.36, 0.36, 0.5)
elif i_y <= y and i_x <= x and i_x == x:
var chest = $table1.get_node2(i_x, i_y+1).get_child(0, false)
chest.color = Color(0.45, 0.36, 0.36, 0.5)
else:
var black = $table1.get_node2(i_x, i_y+1).get_child(0, false)
black.color = Color(0, 0, 0, 0.0)
func on_mode_link(mode, list): func on_mode_link(mode, list):
## Формирование команды для выбора устройства ## Формирование команды для выбора устройства
var meta = list.get_meta('device') var meta = list.get_meta('device')

View File

@@ -2,6 +2,8 @@ extends Node2D
signal read_ems_g_start() signal read_ems_g_start()
signal read_ems_g_finish() signal read_ems_g_finish()
signal change_device(meta_device)
var flag_mode = Constants.ADDRESSES[0][3] var flag_mode = Constants.ADDRESSES[0][3]
var broadcast_packet: PackedByteArray var broadcast_packet: PackedByteArray
var node_select1: Node var node_select1: Node
@@ -128,10 +130,10 @@ func _on_data_received(data_from_yau_07):
var j = int(not(dry_contact & (1 << i) == 0 and flag_yau_control)) var j = int(not(dry_contact & (1 << i) == 0 and flag_yau_control))
if j == 0: if j == 0:
node_power_ind[i].button_pressed = true node_power_ind[i].button_pressed = true
node_power_ind[i].disabled = false
else: else:
node_power_ind[i].button_pressed = false node_power_ind[i].button_pressed = false
node_power_ind[i].disabled = true
#node_select1.set_node_text(3, 0, '%d' % DKM) #node_select1.set_node_text(3, 0, '%d' % DKM)
## УКП ## УКП
@@ -184,8 +186,7 @@ func on_btn_select(intem_from_sector):
var node_select_device = $TabContainer/PRD/select_dev/select_dev var node_select_device = $TabContainer/PRD/select_dev/select_dev
var get_select_device = node_select_device.get_node2(1, 0) var get_select_device = node_select_device.get_node2(1, 0)
var meta = get_select_device.get_item_metadata(intem_from_sector) var meta = get_select_device.get_item_metadata(intem_from_sector)
Network.address = meta[0] emit_signal('change_device', meta)
Network.port = meta[1]
flag_mode = meta[2] flag_mode = meta[2]

View File

@@ -86,7 +86,7 @@ const OUT_x128: Array = [
'К', 'К',
'0', '0',
'1',] '1',]
## [Номер входа, Номер выхода]
enum MODE { enum MODE {
PRD_K, PRD_K,

View File

@@ -5,7 +5,7 @@ func _ready() -> void:
var style = get('theme_override_styles/panel') var style = get('theme_override_styles/panel')
style.bg_color = Color(0, 0, 0, 0.5) style.bg_color = Color(0, 0, 0, 0.5)
set('theme_override_styles/panel', style) set('theme_override_styles/panel', style)
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
pass pass

View File

@@ -18,8 +18,8 @@ anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_top = -103.0 offset_top = -103.0
offset_right = -477.0 offset_right = 75.0
offset_bottom = -714.0 offset_bottom = 137.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
@@ -34,3 +34,9 @@ alignment = 1
editable = false editable = false
caret_blink = true caret_blink = true
caret_blink_interval = 0.5 caret_blink_interval = 0.5
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 0
offset_right = 1933.0
offset_bottom = 1088.0
color = Color(1, 1, 1, 0)

View File

@@ -40,6 +40,10 @@ offset_bottom = 66.0
theme_override_styles/panel = SubResource("StyleBoxFlat_q1ixs") theme_override_styles/panel = SubResource("StyleBoxFlat_q1ixs")
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 2
color = Color(0, 0, 0, 0.195)
[node name="SZI_x" type="AnimatedSprite2D" parent="."] [node name="SZI_x" type="AnimatedSprite2D" parent="."]
position = Vector2(40, 11) position = Vector2(40, 11)
scale = Vector2(1.2, 1.2) scale = Vector2(1.2, 1.2)

View File

@@ -14,20 +14,22 @@
[node name="PanelContainer" type="PanelContainer"] [node name="PanelContainer" type="PanelContainer"]
offset_right = 186.0 offset_right = 186.0
offset_bottom = 40.0 offset_bottom = 44.0
mouse_default_cursor_shape = 6
theme_override_styles/panel = SubResource("StyleBoxFlat_r5cym") theme_override_styles/panel = SubResource("StyleBoxFlat_r5cym")
script = ExtResource("1_h0k6p") script = ExtResource("1_h0k6p")
[node name="ColorRect" type="ColorRect" parent="."] [node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 2 layout_mode = 2
color = Color(0, 0, 0, 0.011) color = Color(0, 0, 0, 0)
[node name="CheckButton" type="CheckButton" parent="."] [node name="CheckButton" type="CheckButton" parent="."]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 4
tooltip_text = "Соединить. Отсоединить"
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
theme_override_styles/focus = SubResource("StyleBoxTexture_b6sp7") theme_override_styles/focus = SubResource("StyleBoxTexture_b6sp7")
theme_override_styles/hover = SubResource("StyleBoxTexture_bc33d") theme_override_styles/hover = SubResource("StyleBoxTexture_bc33d")
theme_override_styles/pressed = SubResource("StyleBoxTexture_46fou") theme_override_styles/pressed = SubResource("StyleBoxTexture_46fou")
theme_override_styles/normal = SubResource("StyleBoxTexture_o64tc") theme_override_styles/normal = SubResource("StyleBoxTexture_o64tc")
metadata/_edit_lock_ = true