Доработка. WIP Добавление элементов для ЭМС-ТГ

This commit is contained in:
sasha80
2026-03-18 09:40:12 +03:00
parent c5bae21436
commit 190f06b72c
14 changed files with 726 additions and 643 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 707 B

View File

@@ -122,6 +122,7 @@ astrakb="*res://scripts/astra-kb.gd"
prd="*res://scripts/prd.gd" prd="*res://scripts/prd.gd"
navi="*res://scripts/navigation.gd" navi="*res://scripts/navigation.gd"
trassa="*res://scripts/trassa.gd" trassa="*res://scripts/trassa.gd"
yems_info="*res://scripts/yems-info.gd"
[debug] [debug]
@@ -194,8 +195,8 @@ folder_colors={
"res://scenes/контроль/": "green", "res://scenes/контроль/": "green",
"res://scenes/настройки/": "green", "res://scenes/настройки/": "green",
"res://scenes/работа/": "green", "res://scenes/работа/": "green",
"res://scenes/эмс-тг/": "green",
"res://scenes/эмс/": "green", "res://scenes/эмс/": "green",
"res://scenes/эмс2/": "green",
"res://scripts/": "pink", "res://scripts/": "pink",
"res://shaders/": "pink", "res://shaders/": "pink",
"res://table/": "blue" "res://table/": "blue"

View File

@@ -20,11 +20,19 @@ var txr_states: Array[CompressedTexture2D]
$done.texture = txr_states[val] $done.texture = txr_states[val]
@export var pressed: bool = false:
set(val):
pressed = val
if is_inside_tree():
$check.button_pressed = pressed
func _enter_tree() -> void: func _enter_tree() -> void:
txr_states.clear() txr_states.clear()
for fn in image_states: for fn in image_states:
txr_states.append(load(fn)) txr_states.append(load(fn))
$done.texture = txr_states[state] $done.texture = txr_states[state]
$check.button_pressed = pressed
func connect_check(signal_name: StringName, callable: Callable): func connect_check(signal_name: StringName, callable: Callable):

View File

@@ -5,7 +5,7 @@
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль/контроль.tscn" id="3_txp0s"] [ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль/контроль.tscn" id="3_txp0s"]
[ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал/журнал.tscn" id="4_cu5k8"] [ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал/журнал.tscn" id="4_cu5k8"]
[ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/эмс/эмс.tscn" id="5_u71bh"] [ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/эмс/эмс.tscn" id="5_u71bh"]
[ext_resource type="PackedScene" uid="uid://musb21x2u0xs" path="res://scenes/эмс2/эмс2.tscn" id="6_41d34"] [ext_resource type="PackedScene" uid="uid://musb21x2u0xs" path="res://scenes/эмс-тг/эмс-тг.tscn" id="6_41d34"]
[ext_resource type="PackedScene" uid="uid://bnptm4rlp60dq" path="res://scenes/настройки/настройки.tscn" id="6_i8iv3"] [ext_resource type="PackedScene" uid="uid://bnptm4rlp60dq" path="res://scenes/настройки/настройки.tscn" id="6_i8iv3"]
[ext_resource type="Script" uid="uid://b5ykwyk5vpi6" path="res://scenes/tabs-switch/lbl-ready.gd" id="8_tidwt"] [ext_resource type="Script" uid="uid://b5ykwyk5vpi6" path="res://scenes/tabs-switch/lbl-ready.gd" id="8_tidwt"]
[ext_resource type="Script" uid="uid://roajn6c6wvc1" path="res://scenes/tabs-switch/тренаж-режим.gd" id="9_41d34"] [ext_resource type="Script" uid="uid://roajn6c6wvc1" path="res://scenes/tabs-switch/тренаж-режим.gd" id="9_41d34"]

View File

@@ -1,14 +1,22 @@
@tool
extends Panel extends Panel
@export var matrix_conf: Array[Texture] ## [0] - чисто, нет конфликта, [1] - есть наложение частот @export var matrix_conf: Array[Texture] ## [0] - чисто, нет конфликта, [1] - есть наложение частот
@export var unit_names: Array[StringName] ## Имена устройств @export var unit_names: Array[StringName] ## Имена устройств
@export_file('*.tscn') var table_headers: Array[String]
@export_file('*.tscn') var table_cells: Array[String]
func _ready() -> void: func _ready() -> void:
var unit_trassa = network.get_unit_instance('уарэп-трасса') var unit_trassa = network.get_unit_instance('уарэп-трасса')
unit_trassa.connect('line_changed', Callable(self, 'on_trassa_line_changed')) unit_trassa.connect('line_changed', Callable(self, 'on_trassa_line_changed'))
signaller.connect('sector_klaster', Callable(self, 'on_sector_klaster').bind(unit_trassa)) signaller.connect('sector_klaster', Callable(self, 'on_sector_klaster').bind(unit_trassa))
var header_rows = []
for cell_scn in table_headers:
header_rows.append(load(cell_scn))
$'таблица/сетка'.set_header(header_rows)
$'таблица/сетка'.pin_header($'таблица', self)
func on_trassa_line_changed(_unit_trassa): func on_trassa_line_changed(_unit_trassa):

View File

@@ -2,6 +2,7 @@
class_name Network extends Node class_name Network extends Node
const YAU07_PROTO: = {'yau07tx': yau07.YaU07} const YAU07_PROTO: = {'yau07tx': yau07.YaU07}
const IYEMS_PROTO: = {'iyems-tx': yems_info.YeMSInfo}
const UDP_PROTO: = {'capsrpb': capsrpb.CapsRpb, 'trassa': trassa.Trassa} const UDP_PROTO: = {'capsrpb': capsrpb.CapsRpb, 'trassa': trassa.Trassa}
const TCP_PROTO: = {'5p28': tcp5p28.TCP5P28} const TCP_PROTO: = {'5p28': tcp5p28.TCP5P28}
const SERIAL_PROTO: = {'spt25': spt25.SPT25} const SERIAL_PROTO: = {'spt25': spt25.SPT25}

View File

@@ -26,7 +26,9 @@ var UnitProfiles: Dictionary[StringName, Array] = { \
'уарэп-яу07-3н': ['yau07tx', ['10.1.1.31', 50031, false, false], 'IP-адрес прибора ПРД-Н3'], 'уарэп-яу07-3н': ['yau07tx', ['10.1.1.31', 50031, false, false], 'IP-адрес прибора ПРД-Н3'],
'уарэп-яу07-3к': ['yau07tx', ['10.1.1.33', 50033, false, false], 'IP-адрес прибора ПРД-К3'], 'уарэп-яу07-3к': ['yau07tx', ['10.1.1.33', 50033, false, false], 'IP-адрес прибора ПРД-К3'],
'навигация': ['navi', ['*', 60000, true, true ], 'IP-адрес на котором принимают сообщения от навигации'], 'навигация': ['navi', ['*', 60000, true, true ], 'IP-адрес на котором принимают сообщения от навигации'],
'ор-63': ['iyems-rx', [ '192.168.10.1', 60001 ], 'IP-адрес для приёма докладов от информационному ЭМС устройств'],
# <Название: >
'ор-63': ['iyems-tx', [ '192.168.10.1', 60001 ], 'IP-адрес для приёма докладов от информационному ЭМС устройств'],
'454': ['iyems-tx', ['192.168.10.2', 60002 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], '454': ['iyems-tx', ['192.168.10.2', 60002 ], 'IP-адрес для передачи команд информационному ЭМС устройству'],
'го': ['iyems-tx', ['192.168.10.3', 60003 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], 'го': ['iyems-tx', ['192.168.10.3', 60003 ], 'IP-адрес для передачи команд информационному ЭМС устройству'],
'рлс1': ['iyems-tx', ['192.168.10.4', 60004 ], 'IP-адрес для передачи команд информационному ЭМС устройству'], 'рлс1': ['iyems-tx', ['192.168.10.4', 60004 ], 'IP-адрес для передачи команд информационному ЭМС устройству'],

25
scripts/yems-info.gd Normal file
View File

@@ -0,0 +1,25 @@
extends Node
class YeMSInfo extends unit.Unit:
static var json_conv: = JSON.new()
var online_timeout: float = 5000 ## Должен быть равен наибольшему времени дотоверности из всех кластеров
var info: = Dictionary()
func parse(data: PackedByteArray, now_tick: int):
self.rx_tick = now_tick
if not online:
online = true
emit_signal('line_changed', self)
var utf8_data: = data.get_string_from_utf8()
if Error.OK == json_conv.parse(utf8_data):
info.merge(json_conv.get_data(), true)
emit_signal('data_received', self)
else:
var msg = json_conv.get_error_message()
emit_signal('parse_error', self, msg)
func process(now_tick: int):
if online and ((now_tick - rx_tick) > online_timeout):
online = false
emit_signal('line_changed', self)
return Error.ERR_BUSY

1
scripts/yems-info.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://bst5wk3otwwai

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=3 uid="uid://cymcld4mjmlhj"] [gd_scene load_steps=4 format=3 uid="uid://cymcld4mjmlhj"]
[ext_resource type="Texture2D" uid="uid://c73tjrn8gr00o" path="res://data/Передатчик.png" id="1_nbmfn"] [ext_resource type="Texture2D" uid="uid://c73tjrn8gr00o" path="res://data/Передатчик.png" id="1_nbmfn"]
@@ -28,9 +28,16 @@ func _enter_tree() -> void:
$label.text = header_text $label.text = header_text
" "
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nbmfn"]
bg_color = Color(0.741395, 0.468103, 0.328942, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[node name="header-image" type="GridContainer"] [node name="header-image" type="GridContainer"]
offset_right = 91.0 offset_right = 91.0
offset_bottom = 19.0 offset_bottom = 25.0
columns = 2 columns = 2
script = SubResource("GDScript_63652") script = SubResource("GDScript_63652")
@@ -43,5 +50,8 @@ expand_mode = 3
[node name="label" type="Label" parent="."] [node name="label" type="Label" parent="."]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_styles/normal = SubResource("StyleBoxFlat_nbmfn")
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1

View File

@@ -25,15 +25,6 @@ func _init() -> void:
var style_dark: = style_light.duplicate(true) var style_dark: = style_light.duplicate(true)
style_dark.bg_color = Color(0.12, 0.12, 0.12) style_dark.bg_color = Color(0.12, 0.12, 0.12)
styles[0] = style_dark styles[0] = style_dark
ProjectSettings.connect('settings_changed', apply_colors)
apply_colors()
func apply_colors():
if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
add_theme_stylebox_override('normal', styles[1])
else:
add_theme_stylebox_override('normal', styles[0])
" "
[node name="Lable" type="Label"] [node name="Lable" type="Label"]

View File

@@ -414,6 +414,7 @@ func _on_focus_entered(node):
## ##
func set_header(header_types: Array): func set_header(header_types: Array):
_assert(header_types.size() > 0, 'количество колонок в заголовке: %d' % [header_types.size()])
_assert(header_types.size() < MAX_INDEX, 'количество колонок в заголовке: %d больше допустимого: %d' % [header_types.size(), MAX_INDEX + 1]) _assert(header_types.size() < MAX_INDEX, 'количество колонок в заголовке: %d больше допустимого: %d' % [header_types.size(), MAX_INDEX + 1])
if columns == 1: if columns == 1:
set_columns(header_types.size()) set_columns(header_types.size())