Доработка. Новая версия вкладки ЭМС.
This commit is contained in:
BIN
data/connect.png
Normal file
BIN
data/connect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
34
data/connect.png.import
Normal file
34
data/connect.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://7h55yvh84cve"
|
||||
path="res://.godot/imported/connect.png-46d08dc9ed7a37b7aaccaa5d321236c8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://data/connect.png"
|
||||
dest_files=["res://.godot/imported/connect.png-46d08dc9ed7a37b7aaccaa5d321236c8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -31,6 +31,8 @@ capsrpb="*res://scripts/capsrpb.gd"
|
||||
Table="*res://table/table.gd"
|
||||
Threats="*res://scripts/threats.gd"
|
||||
YemsDevs="*res://scripts/yems_devs.gd"
|
||||
Yemsboards="*res://scripts/yemsboards.gd"
|
||||
YemsConsts="*res://scripts/yems_consts.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://da7w3vkhadfwe"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/nine-patch-button.gd" id="1_wpbps"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_1xr6o"]
|
||||
[ext_resource type="Script" path="res://scenes/nine-patch-button.gd" id="1_ugn6y"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_aupr1"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="1"]
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
theme_override_styles/panel = SubResource("1")
|
||||
script = ExtResource("1_wpbps")
|
||||
script = ExtResource("1_ugn6y")
|
||||
toggle_mode = true
|
||||
|
||||
[node name="state" type="NinePatchRect" parent="."]
|
||||
show_behind_parent = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_1xr6o")
|
||||
texture = ExtResource("2_aupr1")
|
||||
patch_margin_left = 10
|
||||
patch_margin_top = 10
|
||||
patch_margin_right = 10
|
||||
|
||||
@@ -9,30 +9,30 @@ var FILES_ROWS_ALIGNMENT = [ HORIZONTAL_ALIGNMENT_LEFT, HORIZONTAL_ALIGNM
|
||||
|
||||
|
||||
func fill_files_table(tbl: Table, folder: String, rows_types: Array):
|
||||
var dir: = DirAccess.open(folder)
|
||||
if dir == null:
|
||||
return
|
||||
var files: = []
|
||||
var exclude_names: = ['.', '..']
|
||||
dir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547
|
||||
while true:
|
||||
var file: = dir.get_next()
|
||||
if file == '':
|
||||
break
|
||||
if file in exclude_names:
|
||||
continue
|
||||
var file_name = folder + '/' + file
|
||||
var fd = FileAccess.open(file_name, FileAccess.READ)
|
||||
if not fd:
|
||||
continue
|
||||
var glob_path = ProjectSettings.globalize_path(file_name)
|
||||
var sz = fd.get_length()
|
||||
var ut = fd.get_modified_time(file_name)
|
||||
fd.close()
|
||||
var mt = Time.get_datetime_dict_from_unix_time(ut)
|
||||
var file_row = [file, '%d' % sz, '%d-%02d-%02d %02d:%02d' % [mt.year, mt.month, mt.day, mt.hour, mt.minute]]
|
||||
tbl.add_row(rows_types)
|
||||
var i_row = tbl.get_rows_count() - 1
|
||||
tbl.set_row_text(i_row, file_row)
|
||||
tbl.set_node_meta(0, i_row, 'file_path', glob_path)
|
||||
dir.list_dir_end()
|
||||
var dir: = DirAccess.open(folder)
|
||||
if dir == null:
|
||||
return
|
||||
var files: = []
|
||||
var exclude_names: = ['.', '..']
|
||||
dir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547
|
||||
while true:
|
||||
var file: = dir.get_next()
|
||||
if file == '':
|
||||
break
|
||||
if file in exclude_names:
|
||||
continue
|
||||
var file_name = folder + '/' + file
|
||||
var fd = FileAccess.open(file_name, FileAccess.READ)
|
||||
if not fd:
|
||||
continue
|
||||
var glob_path = ProjectSettings.globalize_path(file_name)
|
||||
var sz = fd.get_length()
|
||||
var ut = fd.get_modified_time(file_name)
|
||||
fd.close()
|
||||
var mt = Time.get_datetime_dict_from_unix_time(ut)
|
||||
var file_row = [file, '%d' % sz, '%d-%02d-%02d %02d:%02d' % [mt.year, mt.month, mt.day, mt.hour, mt.minute]]
|
||||
tbl.add_row(rows_types)
|
||||
var i_row = tbl.get_rows_count() - 1
|
||||
tbl.set_row_text(i_row, file_row)
|
||||
tbl.set_node_meta(0, i_row, 'file_path', glob_path)
|
||||
dir.list_dir_end()
|
||||
|
||||
@@ -5,31 +5,31 @@ var TableNode = preload('res://table/node.tscn')
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
assert(TableHeader)
|
||||
assert(TableNode)
|
||||
call_deferred('init_table')
|
||||
assert(TableHeader)
|
||||
assert(TableNode)
|
||||
call_deferred('init_table')
|
||||
|
||||
|
||||
func init_table():
|
||||
$scrl_threats/tbl_threats.set_header([TableHeader, TableHeader, TableHeader, TableHeader])
|
||||
$scrl_threats/tbl_threats.set_header_text(['Номер', 'Пеленг', 'Частота, МГц', 'Назначено'])
|
||||
$scrl_threats/tbl_threats.set_columns_min_size([50, 140, 140, 100])
|
||||
$scrl_threats/tbl_threats.pin_header($scrl_threats, self)
|
||||
$scrl_threats/tbl_threats.connect('row_pressed', Callable(self, 'on_row_pressed'))
|
||||
$scrl_threats/tbl_threats.set_header([TableHeader, TableHeader, TableHeader, TableHeader])
|
||||
$scrl_threats/tbl_threats.set_header_text(['Номер', 'Пеленг', 'Частота, МГц', 'Назначено'])
|
||||
$scrl_threats/tbl_threats.set_columns_min_size([50, 140, 140, 100])
|
||||
$scrl_threats/tbl_threats.pin_header($scrl_threats, self)
|
||||
$scrl_threats/tbl_threats.connect('row_pressed', Callable(self, 'on_row_pressed'))
|
||||
|
||||
|
||||
func on_row_pressed(i_row: int):
|
||||
$scrl_threats/tbl_threats.set_row_selected(i_row, true)
|
||||
$scrl_threats/tbl_threats.set_row_selected(i_row, true)
|
||||
|
||||
|
||||
func _on_btn_add_thr_pressed() -> void:
|
||||
var i_row = $scrl_threats/tbl_threats.get_rows_count()
|
||||
$scrl_threats/tbl_threats.add_row([TableNode, TableNode, TableNode, TableNode])
|
||||
$scrl_threats/tbl_threats.set_row_text(i_row, ['%d' % i_row, '%d' % ((i_row * 100) + 2000), '%d' % ((i_row * 20) % 360), 'Нет'])
|
||||
var i_row = $scrl_threats/tbl_threats.get_rows_count()
|
||||
$scrl_threats/tbl_threats.add_row([TableNode, TableNode, TableNode, TableNode])
|
||||
$scrl_threats/tbl_threats.set_row_text(i_row, ['%d' % i_row, '%d' % ((i_row * 100) + 2000), '%d' % ((i_row * 20) % 360), 'Нет'])
|
||||
|
||||
|
||||
func _on_btn_del_thr_pressed() -> void:
|
||||
var i_rows: = Array()
|
||||
$scrl_threats/tbl_threats.get_selected_rows(i_rows)
|
||||
for i in i_rows:
|
||||
$scrl_threats/tbl_threats.remove_row(i)
|
||||
var i_rows: = Array()
|
||||
$scrl_threats/tbl_threats.get_selected_rows(i_rows)
|
||||
for i in i_rows:
|
||||
$scrl_threats/tbl_threats.remove_row(i)
|
||||
|
||||
24
scenes/line_edit_empty.tscn
Normal file
24
scenes/line_edit_empty.tscn
Normal file
@@ -0,0 +1,24 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c480ipkjckkdn"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_00xmt"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mla3y"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xp0rn"]
|
||||
|
||||
[node name="LineEdit" type="LineEdit"]
|
||||
offset_right = 58.0
|
||||
offset_bottom = 33.0
|
||||
theme_override_colors/font_color = Color(1, 0.596078, 0.4, 1)
|
||||
theme_override_colors/font_uneditable_color = Color(1, 0.596078, 0.4, 1)
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_00xmt")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_mla3y")
|
||||
theme_override_styles/read_only = SubResource("StyleBoxEmpty_xp0rn")
|
||||
alignment = 1
|
||||
context_menu_enabled = false
|
||||
shortcut_keys_enabled = false
|
||||
middle_mouse_paste_enabled = false
|
||||
selecting_enabled = false
|
||||
deselect_on_focus_loss_enabled = false
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.1
|
||||
@@ -4,28 +4,28 @@ extends PanelContainer
|
||||
|
||||
|
||||
@export var texture_state0: Texture2D = preload('res://data/кнопка-квадрат-0.png'):
|
||||
set(val): $state.set_texture(val)
|
||||
set(val): $state.set_texture(val)
|
||||
|
||||
|
||||
@export var texture_state1: Texture2D = preload('res://data/кнопка-квадрат-1.png'):
|
||||
set(val): $state.set_texture(val)
|
||||
set(val): $state.set_texture(val)
|
||||
|
||||
|
||||
@export var text: String = '':
|
||||
set(val): $button.set_text(val)
|
||||
get: return $button.get_text()
|
||||
set(val): $button.set_text(val)
|
||||
get: return $button.get_text()
|
||||
|
||||
|
||||
@export var pressed: bool = false:
|
||||
set(val): $button.set_pressed(val)
|
||||
get: return $button.is_pressed()
|
||||
set(val): $button.set_pressed(val)
|
||||
get: return $button.is_pressed()
|
||||
|
||||
|
||||
@export var toggle_mode: bool = false:
|
||||
set(val):
|
||||
if is_inside_tree():
|
||||
$button.set_toggle_mode(val)
|
||||
get: return $button.is_toggle_mode()
|
||||
set(val):
|
||||
if is_inside_tree():
|
||||
$button.set_toggle_mode(val)
|
||||
get: return $button.is_toggle_mode()
|
||||
|
||||
|
||||
func set_text (val: String): $button.set_text(val)
|
||||
@@ -33,8 +33,8 @@ func set_pressed (val: bool): $button.set_pressed(val)
|
||||
|
||||
|
||||
func set_toggle_mode (val: bool):
|
||||
if is_inside_tree():
|
||||
$button.set_toggle_mode(val)
|
||||
if is_inside_tree():
|
||||
$button.set_toggle_mode(val)
|
||||
|
||||
|
||||
func get_text(): return $button.get_text()
|
||||
@@ -43,9 +43,9 @@ func is_toggle_mode(): return $button.is_toggle_mode()
|
||||
|
||||
|
||||
func _on_button_toggled(val: bool):
|
||||
if val: $state.set_texture(texture_state1)
|
||||
else: $state.set_texture(texture_state0)
|
||||
if val: $state.set_texture(texture_state1)
|
||||
else: $state.set_texture(texture_state0)
|
||||
|
||||
|
||||
func button_connect(button_signal: String, proc: Callable):
|
||||
$button.connect(button_signal, proc)
|
||||
$button.connect(button_signal, proc)
|
||||
|
||||
@@ -3,13 +3,13 @@ extends TabContainer
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
REPNetwork.logger_page = $'журнал'
|
||||
REPNetwork.logger_page = $'журнал'
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://3slb0i3pvowc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/tab_switch.gd" id="1_33fiq"]
|
||||
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="1_uow82"]
|
||||
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="2_83m7a"]
|
||||
[ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал.tscn" id="3_hgnup"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/ЭМС.tscn" id="4_2bmbm"]
|
||||
[ext_resource type="Script" path="res://scenes/tab_switch.gd" id="1_siu2d"]
|
||||
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="2_c0cdr"]
|
||||
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="3_44o58"]
|
||||
[ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал.tscn" id="4_vpsr1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/ЭМС.tscn" id="5_jlo8o"]
|
||||
|
||||
[node name="tab_switch" type="TabContainer"]
|
||||
offset_right = 1600.0
|
||||
offset_bottom = 1200.0
|
||||
script = ExtResource("1_33fiq")
|
||||
script = ExtResource("1_siu2d")
|
||||
|
||||
[node name="работа" parent="." instance=ExtResource("1_uow82")]
|
||||
[node name="работа" parent="." instance=ExtResource("2_c0cdr")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="контроль" parent="." instance=ExtResource("2_83m7a")]
|
||||
[node name="контроль" parent="." instance=ExtResource("3_44o58")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="журнал" parent="." instance=ExtResource("3_hgnup")]
|
||||
[node name="журнал" parent="." instance=ExtResource("4_vpsr1")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ЭМС" parent="." instance=ExtResource("4_2bmbm")]
|
||||
[node name="ЭМС" parent="." instance=ExtResource("5_jlo8o")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
398
scenes/ЭМС.gd
398
scenes/ЭМС.gd
@@ -1,190 +1,272 @@
|
||||
extends Panel
|
||||
|
||||
var TableHeader = preload('res://table/header.tscn')
|
||||
var TableNode = preload('res://scenes/ячейка-1.tscn')
|
||||
var CellYemsButton = preload('res://scenes/кнопка-эмс.tscn')
|
||||
var CellLineEdit = preload('res://scenes/ячейка-2.tscn')
|
||||
var CellState = preload('res://scenes/состояния-эмс.tscn')
|
||||
var CellOptBtn = preload('res://scenes/кнопка-5.tscn')
|
||||
|
||||
# Таблица с данными для входов, первое значение - индекс устройства в ячейке КЭМС
|
||||
const INPUT_ROWS = [
|
||||
[1,['НРЛС МР-231S, УИЗП', 'X31', '0', '0']],
|
||||
[2,['НРЛС МР-231S, Строб ЭМС', 'X32', '0', '0']],
|
||||
[3,['НРЛС МР-231-3, УИЗП', 'X34', '0', '0']],
|
||||
[4,['НРЛС МР-231-3, Строб ЭМС', 'X35', '0', '0']],
|
||||
[5,['ЦИСВС-1010, УИЗП', 'X43', '0', '0']],
|
||||
[8,['4302-01, 4302-04, УИЗП', 'X46', '0', '0']],
|
||||
[11,['НРЛС МР-231S, УИЗП', 'X51', '0', '0']],
|
||||
[12,['НРЛС МР-231S, Строб ЭМС', 'X52', '0', '0']],
|
||||
[13,['НРЛС МР-231-3, УИЗП', 'X54', '0', '0']],
|
||||
[14,['НРЛС МР-231-3, Строб ЭМС', 'X55', '0', '0']],
|
||||
[15,['ЦИСВС-1010, УИЗП', 'X23', '0', '0']],
|
||||
[21,['НРЛС МР-231S, УИЗП', 'X21', '0', '0']],
|
||||
[22,['НРЛС МР-231S, Строб ЭМС', 'X22', '0', '0']],
|
||||
[23,['НРЛС МР-231-3, УИЗП', 'X24', '0', '0']],
|
||||
[24,['НРЛС МР-231-3, Строб ЭМС', 'X25', '0', '0']],
|
||||
[25,['ЦИСВС-1010, УИЗП', 'X23', '0', '0']]]
|
||||
|
||||
# Таблица с данными для выходов, первое значение - индекс устройства в ячейке КЭМС
|
||||
const OUTPUT_ROWS = [
|
||||
[41,['НРЛС МР-231S, БИ', 'X61', '0', '0']],
|
||||
[42,['НРЛС МР-231S', 'X62', '0', '0']],
|
||||
[43,['НРЛС МР-231-3, БИ', 'X64', '0', '0']],
|
||||
[44,['НРЛС МР-231-3', 'X65', '0', '0']],
|
||||
[45,['ЦИСВС-1010, БИ', 'X63', '0', '0']],
|
||||
[46,['4302-01, 4302-04, БИ', 'X66', '0', '0']],
|
||||
[48,['НРЛС 11111111', 'X69', '0', '0']],
|
||||
[49,['НРЛС-222222, БИ', 'X62', '0', '0']]]
|
||||
const TableHeader = preload('res://table/header.tscn')
|
||||
const TableNode = preload('res://scenes/ячейка-1.tscn')
|
||||
const CellYemsButton = preload('res://scenes/кнопка-эмс.tscn')
|
||||
const CellLineEdit = preload('res://scenes/ячейка-2.tscn')
|
||||
const CellState = preload('res://scenes/состояния-эмс.tscn')
|
||||
const CellOptBtn = preload('res://scenes/кнопка-5.tscn')
|
||||
const CellLEEmpty = preload('res://scenes/line_edit_empty.tscn')
|
||||
|
||||
# Режимы работы выходов
|
||||
const OUT_MODE: Array = ['Работа', 'Контроль', '1', '0']
|
||||
const COLUMN_OPTS_BTN: Array = [6]
|
||||
const COLUMN_OPTS_BTN: Array = [5]
|
||||
const TABLE_ENTRY_COLUMNS: Array = [2,3]
|
||||
const OUT_SET_ROW: Array = [CellLineEdit, CellLEEmpty, CellLEEmpty, CellLEEmpty, CellLEEmpty, CellLEEmpty]
|
||||
const IN_SET_ROW: Array = [CellLineEdit, CellLEEmpty, CellLEEmpty, CellLEEmpty, CellLEEmpty]
|
||||
|
||||
const TABLE_ENTRY_COLUMNS: Array = [2,3,5]
|
||||
var g_boards: Dictionary # Список плат
|
||||
|
||||
var g_in_devices : Dictionary # Словарь с входными устройствами КЭМС
|
||||
var g_out_devices : Dictionary # Словарь с выходными устройствами КЭМС
|
||||
|
||||
var posx: int = 50 # Позиция элементов по x
|
||||
var posy: int = 80 # Позиция элементов по y
|
||||
var posx: int = 35 # Позиция элементов по x
|
||||
var posy: int = 60 # Позиция элементов по y
|
||||
|
||||
func _ready() -> void:
|
||||
$tbl_in.set_position(Vector2(posx,posy))
|
||||
$tbl_out.set_position(Vector2(posx,len(INPUT_ROWS)*33+posy+10))
|
||||
$tbl_files.set_position(Vector2(posx + 890,len(INPUT_ROWS)*33+posy+300))
|
||||
$btn_new.set_position(Vector2(posx + 1270,len(INPUT_ROWS)*33+posy+294))
|
||||
$btn_save.set_position(Vector2(posx + 1270,len(INPUT_ROWS)*33+posy+344))
|
||||
$btn_edit.set_position(Vector2(posx + 1270,len(INPUT_ROWS)*33+posy+394))
|
||||
$lbl_online.set_position(Vector2(posx,posy-40))
|
||||
$marker_in.set_position(Vector2(posx-15,posy+35))
|
||||
$marker_out.set_position(Vector2(posx-15,len(INPUT_ROWS)*33+posy+45))
|
||||
$btn_flash_read.set_position(Vector2(posx+1400,posy))
|
||||
$btn_flash_write.set_position(Vector2(posx+1400,posy+35))
|
||||
call_deferred('init_tbl_out')
|
||||
call_deferred('init_tbl_in')
|
||||
call_deferred('init_tbl_files')
|
||||
$btn_flash_read.button_connect('pressed', Callable(self, 'on_btn_flash_read').bind($btn_flash_read))
|
||||
$btn_flash_write.button_connect('pressed', Callable(self, 'on_btn_flash_write').bind($btn_flash_write))
|
||||
$tbl_in.connect('row_pressed', Callable(self, 'on_row_pressed'))
|
||||
$tbl_out.connect('row_pressed', Callable(self, 'on_row_pressed'))
|
||||
call_deferred('init_boards')
|
||||
|
||||
|
||||
func on_btn_flash_read(btn):
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
btn.pressed = false
|
||||
func init_boards():
|
||||
$scrollin.set_position(Vector2(posx,posy))
|
||||
$scrollout.set_position(Vector2(posx+650,posy))
|
||||
$scrl_in_set.set_position(Vector2(posx,posy + 700))
|
||||
$scrl_out_set.set_position(Vector2(posx+650,posy + 700))
|
||||
#$tbl_files.set_position(Vector2(posx + 890,len(INPUT_ROWS)*33+posy+300))
|
||||
#$btn_new.set_position(Vector2(posx + 1270,len(INPUT_ROWS)*33+posy+294))
|
||||
#$btn_save.set_position(Vector2(posx + 1270,len(INPUT_ROWS)*33+posy+344))
|
||||
#$btn_copy.set_position(Vector2(posx + 1270,len(INPUT_ROWS)*33+posy+394))
|
||||
$lbl_online.set_position(Vector2(posx,posy-60))
|
||||
$btn_flash_read.set_position(Vector2(posx+1400,posy))
|
||||
$btn_flash_write.set_position(Vector2(posx+1400,posy+35))
|
||||
$btn_connect.set_position(Vector2(posx+590,posy-25))
|
||||
g_boards['КЭМС'] = Yemsboards.EmsBoard.new('КЭМС', 0x130, YemsConsts.INPUT_ROWS0, YemsConsts.OUTPUT_ROWS0)
|
||||
g_boards['П5-28'] = Yemsboards.EmsBoard.new('П5-28', 0x140, YemsConsts.INPUT_ROWS1, YemsConsts.OUTPUT_ROWS1)
|
||||
init_tbls_in()
|
||||
$scrollin/tbl_in.pin_header($scrollin, self)
|
||||
init_tbls_out()
|
||||
$scrollout/tbl_out.pin_header($scrollout, self)
|
||||
$scrl_in_set/tbl_in_set.pin_header($scrl_in_set, self)
|
||||
$scrl_out_set/tbl_out_set.pin_header($scrl_out_set, self)
|
||||
$btn_connect.connect('pressed', Callable(self, 'on_btn_connect'))
|
||||
|
||||
|
||||
func on_btn_flash_write(btn):
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
btn.pressed = false
|
||||
func init_tbls_in():
|
||||
var header_type: Array = [TableHeader, TableHeader, TableHeader, TableHeader, TableHeader]
|
||||
var header_text: Array = ['Входы', 'Соединитель', 'мкс', 'мкс', 'Состояние']
|
||||
var row_type: Array = [CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, CellState]
|
||||
var yams_alligment_in: Array = [ HORIZONTAL_ALIGNMENT_LEFT, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
|
||||
var column_size: Array = [250, 100, 70, 70, 50]
|
||||
$scrollin/tbl_in.set_header(header_type)
|
||||
$scrollin/tbl_in.set_header_text(header_text)
|
||||
$scrollin/tbl_in.set_columns_alignments(yams_alligment_in)
|
||||
for board in g_boards:
|
||||
for item in g_boards[board].in_tbl:
|
||||
$scrollin/tbl_in.add_row(row_type)
|
||||
var row_index : int = $scrollin/tbl_in.get_rows_count() - 1
|
||||
var params : Array = item[1]
|
||||
var in_dev: YemsDevs.InDev = YemsDevs.InDev.new(item[0], params, row_index)
|
||||
in_dev.board = board
|
||||
for i in range(len(row_type)):
|
||||
if i < len(params):
|
||||
var node = $scrollin/tbl_in.get_node2(i, row_index)
|
||||
node.text = params[i]
|
||||
node.editable = false
|
||||
$scrollin/tbl_in.set_node_user_data(i, row_index, [in_dev, board])
|
||||
$scrollin/tbl_in.set_columns_min_size(column_size)
|
||||
$scrollin/tbl_in.connect('row_pressed', Callable(self, 'on_row_pressed_in'))
|
||||
$scrollin/tbl_in.connect('selected_changed', Callable(self, 'on_selected_changed_in'))
|
||||
|
||||
|
||||
header_text[0] = 'Вход'
|
||||
$scrl_in_set/tbl_in_set.set_header(header_type)
|
||||
$scrl_in_set/tbl_in_set.set_header_text(header_text)
|
||||
$scrl_in_set/tbl_in_set.set_columns_alignments(yams_alligment_in)
|
||||
$scrl_in_set/tbl_in_set.set_columns_min_size(column_size)
|
||||
|
||||
$scrl_in_set/tbl_in_set.connect('row_pressed', Callable(self, 'on_row_pressed_si'))
|
||||
$scrl_in_set/tbl_in_set.connect('selected_changed', Callable(self, 'on_selected_changed_si'))
|
||||
|
||||
|
||||
func on_row_pressed(i_row: int):
|
||||
$tbl_in.set_row_selected(i_row, false)
|
||||
func on_selected_changed_in(i_row: int):
|
||||
var selecter_rows: Array = []
|
||||
$scrollin/tbl_in.get_selected_rows(selecter_rows)
|
||||
var user_data = $scrollin/tbl_in.get_node_user_data(0, i_row)
|
||||
var dev = user_data[0]
|
||||
var board = user_data[1]
|
||||
set_in_dev(board, dev)
|
||||
|
||||
|
||||
func init_tbl_files():
|
||||
$tbl_files.set_header([TableHeader, TableHeader, TableHeader])
|
||||
$tbl_files.set_header_text(['Имя файла', 'Размер', 'Дата'])
|
||||
$tbl_files.set_columns_min_size([200, 70, 100])
|
||||
func on_row_pressed_in(i_row: int):
|
||||
on_row_pressed(i_row, $scrollin/tbl_in)
|
||||
on_selected_changed_in(i_row)
|
||||
|
||||
|
||||
func init_tbl_out():
|
||||
var header_text = ['Выходы', 'Разъём', 'мкс', 'мкс', 'Состояние', 'Частота, Мгц', 'Режим']
|
||||
$tbl_out.set_header([TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader])
|
||||
$tbl_out.set_header_text(header_text)
|
||||
for item in OUTPUT_ROWS:
|
||||
$tbl_out.add_row([TableNode, TableNode, CellLineEdit, CellLineEdit, CellState, CellLineEdit, CellOptBtn])
|
||||
var row_index : int = $tbl_out.get_rows_count() - 1
|
||||
var params : Array = item[1]
|
||||
var out_dev = YemsDevs.OutDev.new(item[0], params, row_index)
|
||||
g_out_devices[item[0]] = out_dev
|
||||
for i in range(len(header_text)):
|
||||
if i < len(params):
|
||||
var cell = $tbl_out.get_node2(i, row_index)
|
||||
cell.text = params[i]
|
||||
$tbl_out.set_node_user_data(i, row_index, out_dev)
|
||||
if i in COLUMN_OPTS_BTN:
|
||||
var cell = $tbl_out.get_node2(i, row_index)
|
||||
for opt in OUT_MODE:
|
||||
cell.add_item(opt)
|
||||
cell.select(0)
|
||||
$tbl_out.set_columns_min_size([270, 100, 70, 70, 100, 100, 100])
|
||||
$tbl_out.connect_columns(self, 'text_submitted', 'on_edit_entry_in', TABLE_ENTRY_COLUMNS, [])
|
||||
$tbl_out.connect_columns(self, 'item_selected', 'on_item_selected', COLUMN_OPTS_BTN, [])
|
||||
func set_in_dev(_board, dev):
|
||||
var row_type: Array = [CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, CellState]
|
||||
set_dev($scrl_in_set/tbl_in_set, dev, row_type, IN_SET_ROW, 'Список соединённых выходов :')
|
||||
|
||||
|
||||
func init_tbl_in():
|
||||
var header_type: Array = [TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader]
|
||||
var header_text: Array = ['Входы', 'Разъём', 'мкс', 'мкс', 'Состояние', 'Частота, Мгц',' ']
|
||||
var row_type: Array = [TableNode, TableNode, CellLineEdit, CellLineEdit, CellState, CellLineEdit, TableNode]
|
||||
var yams_alligment_in: Array = [ HORIZONTAL_ALIGNMENT_LEFT, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
|
||||
var column_size: Array = [270, 100, 70, 70, 100, 100, 300]
|
||||
var dot_collums: Array = []
|
||||
var column_offset: int = 7
|
||||
for i in range(len(OUTPUT_ROWS)):
|
||||
header_type.append(TableHeader)
|
||||
header_text.append('...')
|
||||
row_type.append(CellYemsButton)
|
||||
yams_alligment_in.append(HORIZONTAL_ALIGNMENT_LEFT)
|
||||
column_size.append(25)
|
||||
dot_collums.append(column_offset+i)
|
||||
$tbl_in.set_header(header_type)
|
||||
$tbl_in.set_header_text(header_text)
|
||||
$tbl_in.set_columns_alignments(yams_alligment_in)
|
||||
for item in INPUT_ROWS:
|
||||
$tbl_in.add_row(row_type)
|
||||
var row_index : int = $tbl_in.get_rows_count() - 1
|
||||
var params : Array = item[1]
|
||||
var in_dev: YemsDevs.InDev = YemsDevs.InDev.new(item[0], params, row_index)
|
||||
g_in_devices[item[0]] = in_dev
|
||||
for i in range(len(row_type)):
|
||||
if i < len(params):
|
||||
var node = $tbl_in.get_node2(i, row_index)
|
||||
node.text = params[i]
|
||||
if i in dot_collums:
|
||||
var btn = $tbl_in.get_node2(i, row_index)
|
||||
var out_dev = g_out_devices[OUTPUT_ROWS[i-column_offset][0]]
|
||||
in_dev.out_dots = [btn, out_dev]
|
||||
btn.button_connect('pressed', Callable(self, 'on_dot_button').bind(btn, i, row_index))
|
||||
btn.connect('mouse_entered', Callable(self, 'on_mouse_entered').bind(btn, i - dot_collums[0], row_index))
|
||||
$tbl_in.set_node_user_data(i, row_index, in_dev)
|
||||
$tbl_in.set_columns_min_size(column_size)
|
||||
$tbl_in.connect_columns(self, 'text_submitted', 'on_edit_entry_in', TABLE_ENTRY_COLUMNS, [])
|
||||
func on_selected_changed_si(i_row: int):
|
||||
if i_row < 2:
|
||||
return
|
||||
var out_user_data = $scrl_in_set/tbl_in_set.get_node_user_data(0, i_row)
|
||||
var dev = out_user_data[0]
|
||||
var dev_name = dev.dev_name
|
||||
for i in range($scrollout/tbl_out.get_rows_count()):
|
||||
var node = $scrollout/tbl_out.get_node2(0, i)
|
||||
if dev_name == node.text:
|
||||
on_row_pressed_out(i)
|
||||
|
||||
|
||||
func on_dot_button(btn, i: int, j: int):
|
||||
""" Вызывается при нажатии на кнопку-точку (соединение)
|
||||
i - индекс входа, j - индекс выхода """
|
||||
print('on_dot_button(%d, %d)' % [i, j])
|
||||
func on_row_pressed_si(i_row: int):
|
||||
if i_row < 2:
|
||||
return
|
||||
on_row_pressed(i_row, $scrl_in_set/tbl_in_set)
|
||||
on_selected_changed_si(i_row)
|
||||
|
||||
|
||||
func on_edit_entry_in(text : String, entry):
|
||||
var indexis = $tbl_in.get_key_indexes(entry[0].name)
|
||||
var row_i = indexis[1]
|
||||
var col_i = indexis[0]
|
||||
print('ЭМС.gd -> on_edit_entry_in', text, row_i, col_i)
|
||||
func init_tbls_out():
|
||||
var header_text = ['Выходы', 'Соединитель', 'мкс', 'мкс', 'Состояние', 'Режим']
|
||||
$scrollout/tbl_out.set_header([TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader])
|
||||
$scrollout/tbl_out.set_header_text(header_text)
|
||||
for board in g_boards:
|
||||
for item in g_boards[board].out_tbl:
|
||||
$scrollout/tbl_out.add_row([CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, CellState, CellLineEdit])
|
||||
var row_index : int = $scrollout/tbl_out.get_rows_count() - 1
|
||||
var params : Array = item[1]
|
||||
var out_dev = YemsDevs.OutDev.new(item[0], params, row_index)
|
||||
out_dev.board = board
|
||||
for i in range(len(header_text)):
|
||||
var cell = $scrollout/tbl_out.get_node2(i, row_index)
|
||||
if i < len(params):
|
||||
cell.text = params[i]
|
||||
cell.editable = false
|
||||
$scrollout/tbl_out.set_node_user_data(i, row_index, [out_dev, board])
|
||||
if i in COLUMN_OPTS_BTN:
|
||||
cell.text = out_dev.mode
|
||||
$scrollout/tbl_out.set_columns_min_size([250, 100, 70, 70, 70, 100])
|
||||
$scrollout/tbl_out.connect('row_pressed', Callable(self, 'on_row_pressed_out'))
|
||||
$scrollout/tbl_out.connect('selected_changed', Callable(self, 'on_selected_changed_out'))
|
||||
|
||||
header_text[0] = 'Выход'
|
||||
$scrl_out_set/tbl_out_set.set_header([TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader])
|
||||
$scrl_out_set/tbl_out_set.set_header_text(header_text)
|
||||
$scrl_out_set/tbl_out_set.set_columns_min_size([250, 100, 70, 70, 70, 100])
|
||||
$scrl_out_set/tbl_out_set.connect('row_pressed', Callable(self, 'on_row_pressed_so'))
|
||||
$scrl_out_set/tbl_out_set.connect('selected_changed', Callable(self, 'on_selected_changed_so'))
|
||||
|
||||
|
||||
func on_edit_entry_out(text : String, entry):
|
||||
var indexis = $tbl_out.get_key_indexes(entry[0].name)
|
||||
var row_i = indexis[1]
|
||||
var col_i = indexis[0]
|
||||
print('ЭМС.gd -> on_edit_entry_out', text, row_i, col_i)
|
||||
func on_selected_changed_so(i_row: int):
|
||||
if i_row < 2:
|
||||
return
|
||||
var in_user_data = $scrl_out_set/tbl_out_set.get_node_user_data(0, i_row)
|
||||
var dev = in_user_data[0]
|
||||
var dev_name = dev.dev_name
|
||||
for i in range($scrollin/tbl_in.get_rows_count()):
|
||||
var node = $scrollin/tbl_in.get_node2(0, i)
|
||||
if dev_name == node.text:
|
||||
on_row_pressed_in(i)
|
||||
|
||||
|
||||
func on_item_selected(item_num, node):
|
||||
var optbtn_text = node[0].text
|
||||
var indexis = $tbl_out.get_key_indexes(node[0].name)
|
||||
var row_i = indexis[1]
|
||||
var col_i = indexis[0]
|
||||
print('ЭМС.gd -> on_item_selected row: %d col: %d text: %s' %[row_i, col_i, optbtn_text])
|
||||
func on_row_pressed_so(i_row: int):
|
||||
if i_row < 2:
|
||||
return
|
||||
on_row_pressed(i_row, $scrl_out_set/tbl_out_set)
|
||||
on_selected_changed_so(i_row)
|
||||
|
||||
|
||||
func on_mouse_entered(btn, i, j):
|
||||
$marker_in.position.y = $tbl_in.position.y + btn.position.y + btn.size.y / 2
|
||||
$marker_out.position.y = $tbl_out.position.y + (btn.size.y + 4) * i + btn.size.y / 2
|
||||
func on_selected_changed_out(i_row: int):
|
||||
var selecter_rows: Array = []
|
||||
$scrollout/tbl_out.get_selected_rows(selecter_rows)
|
||||
var user_data = $scrollout/tbl_out.get_node_user_data(0, i_row)
|
||||
var dev = user_data[0]
|
||||
var board = user_data[1]
|
||||
set_out_dev(board, dev)
|
||||
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func on_row_pressed_out(i_row: int):
|
||||
on_row_pressed(i_row, $scrollout/tbl_out)
|
||||
on_selected_changed_out(i_row)
|
||||
|
||||
|
||||
func set_out_dev(_board, dev):
|
||||
var row_type: Array = [CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, CellState, CellOptBtn]
|
||||
set_dev($scrl_out_set/tbl_out_set, dev, row_type, OUT_SET_ROW, 'Список соединённых входов :')
|
||||
var mode = $scrl_out_set/tbl_out_set.get_node2(5, 0)
|
||||
for opt in OUT_MODE:
|
||||
mode.add_item(opt)
|
||||
var mode_index: int = OUT_MODE.find(dev.mode)
|
||||
if mode_index != -1:
|
||||
mode.select(mode_index)
|
||||
|
||||
|
||||
func set_dev(tbl, dev, row_type, row_type_conn, lbl_text):
|
||||
tbl.clear_rows()
|
||||
tbl.add_row(row_type)
|
||||
var le_name: LineEdit = tbl.get_node2(0, 0)
|
||||
le_name.editable = false
|
||||
le_name.text = dev.dev_name
|
||||
var connector: LineEdit = tbl.get_node2(1, 0)
|
||||
connector.editable = false
|
||||
connector.text = dev.connector
|
||||
var delay: LineEdit = tbl.get_node2(2, 0)
|
||||
delay.text = '%4.2f'%dev.delay
|
||||
var offset: LineEdit = tbl.get_node2(3, 0)
|
||||
offset.text = '%4.2f'%dev.offset
|
||||
var state = tbl.get_node2(4, 0)
|
||||
state.set_frame(dev.state)
|
||||
|
||||
tbl.add_row(row_type_conn)
|
||||
var lbl: LineEdit = tbl.get_node2(0, 1)
|
||||
lbl.text = lbl_text
|
||||
for i in len(row_type_conn):
|
||||
var le: LineEdit = tbl.get_node2(i, 1)
|
||||
le.editable = false
|
||||
|
||||
for i in dev.connect_devs:
|
||||
var dev_con = dev.connect_devs[i][0]
|
||||
tbl.add_row(row_type_conn)
|
||||
var node_index: Array = [0, tbl.get_rows_count() -1]
|
||||
var le_name_out: LineEdit = tbl.get_node2(node_index[0], node_index[1])
|
||||
disable_edit(tbl, len(row_type_conn), node_index[1])
|
||||
le_name_out.text = dev_con.dev_name
|
||||
tbl.set_node_user_data(node_index[0], node_index[1], dev.connect_devs[i])
|
||||
|
||||
|
||||
func on_btn_connect():
|
||||
var in_row_index: Array = []
|
||||
var out_row_index: Array = []
|
||||
$scrollin/tbl_in.get_selected_rows(in_row_index)
|
||||
$scrollout/tbl_out.get_selected_rows(out_row_index)
|
||||
if len(in_row_index) and len(out_row_index):
|
||||
var in_user_data = $scrollin/tbl_in.get_node_user_data(0, in_row_index[0])
|
||||
var out_user_data = $scrollout/tbl_out.get_node_user_data(0, out_row_index[0])
|
||||
var in_dev = in_user_data[0]
|
||||
var out_dev = out_user_data[0]
|
||||
add_connection_dev($scrl_out_set/tbl_out_set, in_dev, out_dev, OUT_SET_ROW, in_user_data)
|
||||
add_connection_dev($scrl_in_set/tbl_in_set, out_dev, in_dev, IN_SET_ROW, out_user_data)
|
||||
|
||||
|
||||
func add_connection_dev(tbl, dev1, dev2, set_row, user_data):
|
||||
if not dev1.dev_name in dev2.connect_devs:
|
||||
tbl.add_row(set_row)
|
||||
var node_index: Array = [0, tbl.get_rows_count() -1]
|
||||
var le_name: LineEdit = tbl.get_node2(node_index[0], node_index[1])
|
||||
le_name.text = dev1.dev_name
|
||||
disable_edit(tbl, len(set_row), node_index[1])
|
||||
tbl.set_node_user_data(node_index[0], node_index[1], user_data)
|
||||
dev2.connect_devs[dev1.dev_name] = user_data
|
||||
|
||||
|
||||
func disable_edit(tbl, num_col: int, i_row: int):
|
||||
for col in range(num_col):
|
||||
var node: LineEdit = tbl.get_node2(col, i_row)
|
||||
node.editable = false
|
||||
|
||||
|
||||
func on_row_pressed(i_row: int, tbl):
|
||||
tbl.clear_rows_selected()
|
||||
var is_row_selected = tbl.is_row_selected(i_row)
|
||||
tbl.set_row_selected(i_row, not is_row_selected)
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
pass
|
||||
|
||||
112
scenes/ЭМС.tscn
112
scenes/ЭМС.tscn
@@ -1,17 +1,17 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://c6uls7q4e2m4h"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dab6loryocc73"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/ЭМС.gd" id="1_t1s35"]
|
||||
[ext_resource type="Script" path="res://table/table.gd" id="2_6x8yw"]
|
||||
[ext_resource type="Texture2D" uid="uid://dahjma3aqkfc0" path="res://data/эмс-указатель.png" id="3_j3w75"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button_flat.tscn" id="4_v64lt"]
|
||||
[ext_resource type="Texture2D" uid="uid://dd60btbqnpiqw" path="res://data/document-new-0.png" id="5_osu07"]
|
||||
[ext_resource type="Texture2D" uid="uid://coqg6wsftvtxr" path="res://data/document-save-0.png" id="6_8684b"]
|
||||
[ext_resource type="Texture2D" uid="uid://cywuevvpkxl7v" path="res://data/edit-copy-0.png" id="7_85ydm"]
|
||||
[ext_resource type="Script" path="res://scenes/ЭМС.gd" id="1_ei0cy"]
|
||||
[ext_resource type="Script" path="res://table/table.gd" id="2_n0fa5"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button_flat.tscn" id="3_htu6q"]
|
||||
[ext_resource type="Texture2D" uid="uid://dd60btbqnpiqw" path="res://data/document-new-0.png" id="4_udjkh"]
|
||||
[ext_resource type="Texture2D" uid="uid://coqg6wsftvtxr" path="res://data/document-save-0.png" id="5_cwv76"]
|
||||
[ext_resource type="Texture2D" uid="uid://cywuevvpkxl7v" path="res://data/edit-copy-0.png" id="6_hr8ru"]
|
||||
[ext_resource type="Texture2D" uid="uid://7h55yvh84cve" path="res://data/connect.png" id="7_8mn17"]
|
||||
|
||||
[node name="ЭМС" type="Panel"]
|
||||
offset_right = 1598.0
|
||||
offset_bottom = 1201.0
|
||||
script = ExtResource("1_t1s35")
|
||||
script = ExtResource("1_ei0cy")
|
||||
|
||||
[node name="lbl_online" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -22,41 +22,15 @@ offset_bottom = 30.0
|
||||
theme_override_colors/font_color = Color(1, 0, 0, 1)
|
||||
text = "Ячейка не на связи"
|
||||
|
||||
[node name="tbl_in" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 30.0
|
||||
offset_top = 46.0
|
||||
offset_right = 825.0
|
||||
offset_bottom = 182.0
|
||||
script = ExtResource("2_6x8yw")
|
||||
|
||||
[node name="tbl_out" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 46.0
|
||||
offset_top = 588.0
|
||||
offset_right = 598.0
|
||||
offset_bottom = 688.0
|
||||
script = ExtResource("2_6x8yw")
|
||||
|
||||
[node name="tbl_files" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1050.0
|
||||
offset_top = 993.0
|
||||
offset_right = 1602.0
|
||||
offset_bottom = 1093.0
|
||||
script = ExtResource("2_6x8yw")
|
||||
script = ExtResource("2_n0fa5")
|
||||
|
||||
[node name="marker_in" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.964706, 0.490196, 0, 1)
|
||||
position = Vector2(19, 37)
|
||||
texture = ExtResource("3_j3w75")
|
||||
|
||||
[node name="marker_out" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.964706, 0.490196, 0, 1)
|
||||
position = Vector2(19, 77)
|
||||
texture = ExtResource("3_j3w75")
|
||||
|
||||
[node name="btn_flash_read" parent="." instance=ExtResource("4_v64lt")]
|
||||
[node name="btn_flash_read" parent="." instance=ExtResource("3_htu6q")]
|
||||
layout_mode = 0
|
||||
offset_left = 1446.0
|
||||
offset_top = 55.0
|
||||
@@ -64,7 +38,7 @@ offset_right = 1583.0
|
||||
offset_bottom = 85.0
|
||||
text = "Прочитать"
|
||||
|
||||
[node name="btn_flash_write" parent="." instance=ExtResource("4_v64lt")]
|
||||
[node name="btn_flash_write" parent="." instance=ExtResource("3_htu6q")]
|
||||
layout_mode = 0
|
||||
offset_left = 1446.0
|
||||
offset_top = 99.0
|
||||
@@ -81,7 +55,7 @@ offset_bottom = 1016.0
|
||||
focus_mode = 0
|
||||
shortcut_feedback = false
|
||||
shortcut_in_tooltip = false
|
||||
icon = ExtResource("5_osu07")
|
||||
icon = ExtResource("4_udjkh")
|
||||
|
||||
[node name="btn_save" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -90,13 +64,67 @@ offset_top = 1017.0
|
||||
offset_right = 1509.0
|
||||
offset_bottom = 1073.0
|
||||
focus_mode = 0
|
||||
icon = ExtResource("6_8684b")
|
||||
icon = ExtResource("5_cwv76")
|
||||
|
||||
[node name="btn_edit" type="Button" parent="."]
|
||||
[node name="btn_copy" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1454.0
|
||||
offset_top = 1074.0
|
||||
offset_right = 1510.0
|
||||
offset_bottom = 1130.0
|
||||
focus_mode = 0
|
||||
icon = ExtResource("7_85ydm")
|
||||
icon = ExtResource("6_hr8ru")
|
||||
|
||||
[node name="btn_connect" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 627.0
|
||||
offset_top = 55.0
|
||||
offset_right = 683.0
|
||||
offset_bottom = 111.0
|
||||
focus_mode = 0
|
||||
theme_override_colors/icon_normal_color = Color(1, 1, 1, 1)
|
||||
icon = ExtResource("7_8mn17")
|
||||
|
||||
[node name="scrollin" type="ScrollContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 56.0
|
||||
offset_top = 52.0
|
||||
offset_right = 641.0
|
||||
offset_bottom = 679.0
|
||||
|
||||
[node name="tbl_in" type="GridContainer" parent="scrollin"]
|
||||
layout_mode = 2
|
||||
script = ExtResource("2_n0fa5")
|
||||
|
||||
[node name="scrollout" type="ScrollContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 657.0
|
||||
offset_top = 50.0
|
||||
offset_right = 1351.0
|
||||
offset_bottom = 679.0
|
||||
|
||||
[node name="tbl_out" type="GridContainer" parent="scrollout"]
|
||||
layout_mode = 2
|
||||
script = ExtResource("2_n0fa5")
|
||||
|
||||
[node name="scrl_in_set" type="ScrollContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 120.0
|
||||
offset_top = 776.0
|
||||
offset_right = 689.0
|
||||
offset_bottom = 942.0
|
||||
|
||||
[node name="tbl_in_set" type="GridContainer" parent="scrl_in_set"]
|
||||
layout_mode = 2
|
||||
script = ExtResource("2_n0fa5")
|
||||
|
||||
[node name="scrl_out_set" type="ScrollContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 719.0
|
||||
offset_top = 773.0
|
||||
offset_right = 1437.0
|
||||
offset_bottom = 924.0
|
||||
|
||||
[node name="tbl_out_set" type="GridContainer" parent="scrl_out_set"]
|
||||
layout_mode = 2
|
||||
script = ExtResource("2_n0fa5")
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://dwcol6jg2syof"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dwcol6jg2syof"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ftyvw"]
|
||||
|
||||
[node name="OptionButton" type="OptionButton"]
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_ftyvw")
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://lwmw4egynmd1"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/контроль.gd" id="1_i5eo5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_drana"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkqlvd750pplc" path="res://data/СПТ.png" id="3_v54hc"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="4_kwlmx"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="5_8abdt"]
|
||||
[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="6_sgnkf"]
|
||||
[ext_resource type="Script" path="res://scenes/контроль.gd" id="1_x5d6w"]
|
||||
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkqlvd750pplc" path="res://data/СПТ.png" id="3_hhadv"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="4_l0nc7"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="5_kvnex"]
|
||||
[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="6_i1yfn"]
|
||||
|
||||
[node name="Контроль" type="Panel"]
|
||||
anchors_preset = 15
|
||||
@@ -13,7 +13,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_i5eo5")
|
||||
script = ExtResource("1_x5d6w")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="pribor_uf" type="TextureButton" parent="."]
|
||||
@@ -24,7 +24,7 @@ offset_right = 1191.0
|
||||
offset_bottom = 657.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("2_drana")
|
||||
texture_normal = ExtResource("2_0nvm1")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_rtr" type="TextureButton" parent="."]
|
||||
@@ -35,7 +35,7 @@ offset_right = 1198.0
|
||||
offset_bottom = 361.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("3_v54hc")
|
||||
texture_normal = ExtResource("3_hhadv")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_afsp_l" type="TextureButton" parent="."]
|
||||
@@ -47,7 +47,7 @@ offset_bottom = 860.0
|
||||
scale = Vector2(0.2, 0.2)
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("4_kwlmx")
|
||||
texture_normal = ExtResource("4_l0nc7")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_afsp_r" type="TextureButton" parent="."]
|
||||
@@ -59,7 +59,7 @@ offset_bottom = 865.0
|
||||
scale = Vector2(0.2, 0.2)
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("4_kwlmx")
|
||||
texture_normal = ExtResource("4_l0nc7")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_sch3" type="TextureButton" parent="."]
|
||||
@@ -70,7 +70,7 @@ offset_right = 1208.0
|
||||
offset_bottom = 951.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("5_8abdt")
|
||||
texture_normal = ExtResource("5_kvnex")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_spt_l" type="TextureButton" parent="."]
|
||||
@@ -81,7 +81,7 @@ offset_right = 1053.0
|
||||
offset_bottom = 951.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("3_v54hc")
|
||||
texture_normal = ExtResource("3_hhadv")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_spt_r" type="TextureButton" parent="."]
|
||||
@@ -92,7 +92,7 @@ offset_right = 1353.0
|
||||
offset_bottom = 951.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("3_v54hc")
|
||||
texture_normal = ExtResource("3_hhadv")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_prd_v_2" type="TextureButton" parent="."]
|
||||
@@ -103,7 +103,7 @@ offset_right = 872.0
|
||||
offset_bottom = 377.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_prd_n_2" type="TextureButton" parent="."]
|
||||
@@ -114,7 +114,7 @@ offset_right = 827.0
|
||||
offset_bottom = 553.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_prd_k_2" type="TextureButton" parent="."]
|
||||
@@ -125,7 +125,7 @@ offset_right = 952.0
|
||||
offset_bottom = 555.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_prd_v_3" type="TextureButton" parent="."]
|
||||
@@ -136,7 +136,7 @@ offset_right = 1494.0
|
||||
offset_bottom = 896.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
|
||||
@@ -148,7 +148,7 @@ offset_right = 1417.0
|
||||
offset_bottom = 721.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
|
||||
@@ -160,7 +160,7 @@ offset_right = 1537.0
|
||||
offset_bottom = 721.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
|
||||
@@ -172,7 +172,7 @@ offset_right = 1522.0
|
||||
offset_bottom = 391.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
|
||||
@@ -184,7 +184,7 @@ offset_right = 1412.0
|
||||
offset_bottom = 553.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
|
||||
@@ -196,7 +196,7 @@ offset_right = 1537.0
|
||||
offset_bottom = 562.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
|
||||
@@ -208,7 +208,7 @@ offset_right = 882.0
|
||||
offset_bottom = 896.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_prd_n_4" type="TextureButton" parent="."]
|
||||
@@ -219,7 +219,7 @@ offset_right = 827.0
|
||||
offset_bottom = 723.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_prd_k_4" type="TextureButton" parent="."]
|
||||
@@ -230,7 +230,7 @@ offset_right = 962.0
|
||||
offset_bottom = 723.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
texture_normal = ExtResource("6_sgnkf")
|
||||
texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="pribor_sch" type="Panel" parent="."]
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cmtgncelo01jh"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=1]
|
||||
[sub_resource type="StyleBoxEmpty" id="3"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=2]
|
||||
[sub_resource type="StyleBoxEmpty" id="5"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=3]
|
||||
[sub_resource type="StyleBoxEmpty" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=4]
|
||||
[sub_resource type="StyleBoxEmpty" id="2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=5]
|
||||
[sub_resource type="StyleBoxEmpty" id="4"]
|
||||
|
||||
[node name="Node2D" type="OptionButton"]
|
||||
self_modulate = Color( 1, 0.596078, 0.4, 1 )
|
||||
self_modulate = Color(1, 0.596078, 0.4, 1)
|
||||
custom_minimum_size = Vector2(60, 0)
|
||||
offset_right = 70.0
|
||||
offset_bottom = 23.0
|
||||
custom_minimum_size = Vector2( 60, 0 )
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
theme_override_styles/hover = SubResource( 1 )
|
||||
theme_override_styles/pressed = SubResource( 2 )
|
||||
theme_override_styles/focus = SubResource( 3 )
|
||||
theme_override_styles/disabled = SubResource( 4 )
|
||||
theme_override_styles/normal = SubResource( 5 )
|
||||
theme_override_styles/focus = SubResource("3")
|
||||
theme_override_styles/normal = SubResource("5")
|
||||
theme_override_styles/hover = SubResource("1")
|
||||
theme_override_styles/pressed = SubResource("2")
|
||||
theme_override_styles/disabled = SubResource("4")
|
||||
|
||||
138
scenes/работа.gd
138
scenes/работа.gd
@@ -54,106 +54,106 @@ signal full_screen
|
||||
|
||||
|
||||
func _ready():
|
||||
$btn_strobe.button_connect('pressed', Callable(self, 'on_button_strobe_pressed'))
|
||||
$btn_off.set_pressed(true)
|
||||
strob_center = $canvas.get_strob_center()
|
||||
on_button_strobe_pressed()
|
||||
drag_fsm = DRAG_FSM.OFF
|
||||
var nodes: = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
for btn in nodes:
|
||||
btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes))
|
||||
$btn_strobe.button_connect('pressed', Callable(self, 'on_button_strobe_pressed'))
|
||||
$btn_off.set_pressed(true)
|
||||
strob_center = $canvas.get_strob_center()
|
||||
on_button_strobe_pressed()
|
||||
drag_fsm = DRAG_FSM.OFF
|
||||
var nodes: = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
for btn in nodes:
|
||||
btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes))
|
||||
|
||||
|
||||
func on_button_strobe_pressed():
|
||||
if $btn_strobe.is_pressed():
|
||||
$canvas.set_strob_visible(true)
|
||||
drag_fsm = DRAG_FSM.IDLE
|
||||
else:
|
||||
$canvas.set_strob_visible(false)
|
||||
drag_fsm = DRAG_FSM.OFF
|
||||
if $btn_strobe.is_pressed():
|
||||
$canvas.set_strob_visible(true)
|
||||
drag_fsm = DRAG_FSM.IDLE
|
||||
else:
|
||||
$canvas.set_strob_visible(false)
|
||||
drag_fsm = DRAG_FSM.OFF
|
||||
|
||||
|
||||
func on_button_pressed(btn_this, btn_others):
|
||||
# поведение радиокнопок в группе
|
||||
for btn_other in btn_others:
|
||||
btn_other.set_pressed(btn_this == btn_other)
|
||||
# поведение радиокнопок в группе
|
||||
for btn_other in btn_others:
|
||||
btn_other.set_pressed(btn_this == btn_other)
|
||||
|
||||
|
||||
func clip_value(val, val_min, val_max):
|
||||
if val < val_min: val = val_min
|
||||
if val > val_max: val = val_max
|
||||
return val
|
||||
if val < val_min: val = val_min
|
||||
if val > val_max: val = val_max
|
||||
return val
|
||||
|
||||
|
||||
func get_strob_width(pos: Vector2, prev: float) -> float:
|
||||
var strob_dir_width: float = prev + (drag_pos_begin.y - pos.y) * drag_scale_width
|
||||
strob_dir_width = clip_value(strob_dir_width, strob_min_width, strob_max_width)
|
||||
return strob_dir_width
|
||||
var strob_dir_width: float = prev + (drag_pos_begin.y - pos.y) * drag_scale_width
|
||||
strob_dir_width = clip_value(strob_dir_width, strob_min_width, strob_max_width)
|
||||
return strob_dir_width
|
||||
|
||||
|
||||
func get_strob_band(pos: Vector2, prev: float) -> float:
|
||||
var strob_dir_band: float = prev - (drag_pos_begin.y - pos.y) * drag_scale_band
|
||||
strob_dir_band = clip_value(strob_dir_band, strob_min_band, strob_max_band)
|
||||
return strob_dir_band
|
||||
var strob_dir_band: float = prev - (drag_pos_begin.y - pos.y) * drag_scale_band
|
||||
strob_dir_band = clip_value(strob_dir_band, strob_min_band, strob_max_band)
|
||||
return strob_dir_band
|
||||
|
||||
|
||||
func set_strob(pos: Vector2):
|
||||
var radp: Vector2 = Tools.map_dec_to_rad(strob_center, pos)
|
||||
if radp.y < $canvas.get_radius_max():
|
||||
$canvas.set_strob_dir(radp.x)
|
||||
$canvas.set_strob_radius(radp.y)
|
||||
var radp: Vector2 = Tools.map_dec_to_rad(strob_center, pos)
|
||||
if radp.y < $canvas.get_radius_max():
|
||||
$canvas.set_strob_dir(radp.x)
|
||||
$canvas.set_strob_radius(radp.y)
|
||||
|
||||
|
||||
func _on_drag_continue(event):
|
||||
if drag_button == MOUSE_BUTTON_RIGHT:
|
||||
if shift_pressed:
|
||||
var strob_width: float = get_strob_width(event.position, strob_width_begin)
|
||||
$canvas.set_strob_width(strob_width)
|
||||
else:
|
||||
var strob_band: float = get_strob_band(event.position, strob_band_begin)
|
||||
$canvas.set_strob_band(strob_band)
|
||||
elif drag_button == MOUSE_BUTTON_LEFT:
|
||||
set_strob(event.position)
|
||||
if drag_button == MOUSE_BUTTON_RIGHT:
|
||||
if shift_pressed:
|
||||
var strob_width: float = get_strob_width(event.position, strob_width_begin)
|
||||
$canvas.set_strob_width(strob_width)
|
||||
else:
|
||||
var strob_band: float = get_strob_band(event.position, strob_band_begin)
|
||||
$canvas.set_strob_band(strob_band)
|
||||
elif drag_button == MOUSE_BUTTON_LEFT:
|
||||
set_strob(event.position)
|
||||
|
||||
|
||||
func _on_drag_begin(event):
|
||||
drag_pos_begin = event.position
|
||||
if drag_button == MOUSE_BUTTON_LEFT:
|
||||
set_strob(event.position)
|
||||
elif drag_button == MOUSE_BUTTON_RIGHT:
|
||||
strob_width_begin = $canvas.get_strob_width()
|
||||
strob_band_begin = $canvas.get_strob_band()
|
||||
drag_pos_begin = event.position
|
||||
if drag_button == MOUSE_BUTTON_LEFT:
|
||||
set_strob(event.position)
|
||||
elif drag_button == MOUSE_BUTTON_RIGHT:
|
||||
strob_width_begin = $canvas.get_strob_width()
|
||||
strob_band_begin = $canvas.get_strob_band()
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
if drag_fsm == DRAG_FSM.DRAG:
|
||||
emit_signal('drag_continue', event)
|
||||
elif event is InputEventMouseButton:
|
||||
drag_button = event.button_index
|
||||
if event.pressed:
|
||||
if drag_fsm == DRAG_FSM.IDLE:
|
||||
drag_fsm = DRAG_FSM.DRAG
|
||||
emit_signal('drag_begin', event)
|
||||
else:
|
||||
drag_fsm = DRAG_FSM.IDLE
|
||||
emit_signal('drag_end', event)
|
||||
elif event is InputEventKey:
|
||||
if event.pressed and event.physical_keycode == KEY_F11:
|
||||
emit_signal('full_screen')
|
||||
elif event.physical_keycode == KEY_SHIFT:
|
||||
shift_pressed = event.pressed
|
||||
if event is InputEventMouseMotion:
|
||||
if drag_fsm == DRAG_FSM.DRAG:
|
||||
emit_signal('drag_continue', event)
|
||||
elif event is InputEventMouseButton:
|
||||
drag_button = event.button_index
|
||||
if event.pressed:
|
||||
if drag_fsm == DRAG_FSM.IDLE:
|
||||
drag_fsm = DRAG_FSM.DRAG
|
||||
emit_signal('drag_begin', event)
|
||||
else:
|
||||
drag_fsm = DRAG_FSM.IDLE
|
||||
emit_signal('drag_end', event)
|
||||
elif event is InputEventKey:
|
||||
if event.pressed and event.physical_keycode == KEY_F11:
|
||||
emit_signal('full_screen')
|
||||
elif event.physical_keycode == KEY_SHIFT:
|
||||
shift_pressed = event.pressed
|
||||
|
||||
|
||||
func toggle_full_screen(id: int):
|
||||
var mode = DisplayServer.window_get_mode(id)
|
||||
if mode == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
mode = DisplayServer.WINDOW_MODE_WINDOWED
|
||||
else:
|
||||
mode = DisplayServer.WINDOW_MODE_FULLSCREEN
|
||||
DisplayServer.window_set_mode(mode, id)
|
||||
var mode = DisplayServer.window_get_mode(id)
|
||||
if mode == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
mode = DisplayServer.WINDOW_MODE_WINDOWED
|
||||
else:
|
||||
mode = DisplayServer.WINDOW_MODE_FULLSCREEN
|
||||
DisplayServer.window_set_mode(mode, id)
|
||||
|
||||
|
||||
func _on_full_screen():
|
||||
toggle_full_screen(window_0_id)
|
||||
toggle_full_screen(window_0_id)
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://b276iygic5itk"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/работа.gd" id="1_qjoce"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_bl0yt"]
|
||||
[ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="3_l1omj"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button_flat.tscn" id="4_5es2r"]
|
||||
[ext_resource type="Script" path="res://scenes/frm_threats.gd" id="4_hg23i"]
|
||||
[ext_resource type="Script" path="res://table/table.gd" id="4_mqhcf"]
|
||||
[ext_resource type="Script" path="res://scenes/работа.gd" id="1_bsaom"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_s3084"]
|
||||
[ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="3_08tg0"]
|
||||
[ext_resource type="Script" path="res://scenes/frm_threats.gd" id="4_jh6td"]
|
||||
[ext_resource type="Script" path="res://table/table.gd" id="5_txdob"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button_flat.tscn" id="6_diqdc"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5ugj8"]
|
||||
|
||||
[node name="Работа" type="Panel"]
|
||||
script = ExtResource("1_qjoce")
|
||||
script = ExtResource("1_bsaom")
|
||||
col_red = Color(1, 0.568627, 0.431373, 0.239216)
|
||||
col_grey = Color(0.34902, 0.643137, 0.772549, 0.168627)
|
||||
strob_min_width = 5.0
|
||||
@@ -22,20 +22,20 @@ drag_scale_band = 0.05
|
||||
metadata/_edit_vertical_guides_ = []
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="canvas" parent="." instance=ExtResource("2_bl0yt")]
|
||||
[node name="canvas" parent="." instance=ExtResource("2_s3084")]
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="frm_threats" parent="." instance=ExtResource("3_l1omj")]
|
||||
[node name="frm_threats" parent="." instance=ExtResource("3_08tg0")]
|
||||
layout_mode = 0
|
||||
offset_left = 1121.0
|
||||
offset_top = 6.0
|
||||
offset_right = 1594.0
|
||||
offset_bottom = 642.0
|
||||
script = ExtResource("4_hg23i")
|
||||
script = ExtResource("4_jh6td")
|
||||
text = "Список целей"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="рамка-параметры-цели" parent="frm_threats" instance=ExtResource("3_l1omj")]
|
||||
[node name="рамка-параметры-цели" parent="frm_threats" instance=ExtResource("3_08tg0")]
|
||||
layout_mode = 0
|
||||
offset_left = 5.0
|
||||
offset_top = 313.0
|
||||
@@ -225,9 +225,9 @@ horizontal_scroll_mode = 0
|
||||
[node name="tbl_threats" type="GridContainer" parent="frm_threats/scrl_threats"]
|
||||
layout_mode = 2
|
||||
columns = 4
|
||||
script = ExtResource("4_mqhcf")
|
||||
script = ExtResource("5_txdob")
|
||||
|
||||
[node name="рамка-сеансы-помех" parent="." instance=ExtResource("3_l1omj")]
|
||||
[node name="рамка-сеансы-помех" parent="." instance=ExtResource("3_08tg0")]
|
||||
layout_mode = 0
|
||||
offset_left = 1121.0
|
||||
offset_top = 648.0
|
||||
@@ -321,7 +321,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
|
||||
text = "ПД-М4С"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="рамка-помеха" parent="рамка-сеансы-помех" instance=ExtResource("3_l1omj")]
|
||||
[node name="рамка-помеха" parent="рамка-сеансы-помех" instance=ExtResource("3_08tg0")]
|
||||
layout_mode = 0
|
||||
offset_left = 5.0
|
||||
offset_top = 250.0
|
||||
@@ -480,7 +480,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
|
||||
text = "ЛЧМ"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="btn_auto_threat" parent="." instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_auto_threat" parent="." instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 912.0
|
||||
offset_top = 67.0
|
||||
@@ -488,7 +488,7 @@ offset_right = 1102.0
|
||||
offset_bottom = 117.0
|
||||
text = "Автоматически"
|
||||
|
||||
[node name="btn_strobe" parent="." instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_strobe" parent="." instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 912.0
|
||||
offset_top = 6.0
|
||||
@@ -496,7 +496,7 @@ offset_right = 1102.0
|
||||
offset_bottom = 56.0
|
||||
text = "Строб"
|
||||
|
||||
[node name="btn_p5" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p5" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 980.0
|
||||
@@ -508,7 +508,7 @@ grow_vertical = 2
|
||||
text = "ОЗП-1"
|
||||
metadata/rfi_name = "ozp1"
|
||||
|
||||
[node name="btn_p4" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p4" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 1052.0
|
||||
@@ -521,7 +521,7 @@ tooltip_text = "Выбор цели или сектора"
|
||||
text = "<-"
|
||||
metadata/rfi_name = "<pick>"
|
||||
|
||||
[node name="btn_p6" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p6" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 840.0
|
||||
offset_top = 1118.0
|
||||
@@ -530,7 +530,7 @@ offset_bottom = 1168.0
|
||||
text = "СВ-М2"
|
||||
metadata/rfi_name = "svm2"
|
||||
|
||||
[node name="btn_p7" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p7" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 910.0
|
||||
offset_top = 1118.0
|
||||
@@ -539,7 +539,7 @@ offset_bottom = 1168.0
|
||||
text = "K1"
|
||||
metadata/rfi_name = "k1"
|
||||
|
||||
[node name="btn_p8" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p8" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 770.0
|
||||
offset_top = 1118.0
|
||||
@@ -548,7 +548,7 @@ offset_bottom = 1168.0
|
||||
text = "СВ-И1"
|
||||
metadata/rfi_name = "svi1"
|
||||
|
||||
[node name="btn_p9" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p9" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 700.0
|
||||
offset_top = 1118.0
|
||||
@@ -557,7 +557,7 @@ offset_bottom = 1168.0
|
||||
text = "ПД-ЧМ"
|
||||
metadata/rfi_name = "pdchm"
|
||||
|
||||
[node name="btn_p10" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p10" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 630.0
|
||||
@@ -569,7 +569,7 @@ grow_vertical = 2
|
||||
text = "ПД-М4С"
|
||||
metadata/rfi_name = "pdm4s"
|
||||
|
||||
[node name="btn_p11" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p11" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 350.0
|
||||
offset_top = 1118.0
|
||||
@@ -578,7 +578,7 @@ offset_bottom = 1168.0
|
||||
text = "ЛЧМ-1"
|
||||
metadata/rfi_name = "lchm1"
|
||||
|
||||
[node name="btn_p12" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p12" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 420.0
|
||||
@@ -590,7 +590,7 @@ grow_vertical = 2
|
||||
text = "МЧМ-1"
|
||||
metadata/rfi_name = "mchm1"
|
||||
|
||||
[node name="btn_p13" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p13" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 490.0
|
||||
@@ -602,7 +602,7 @@ grow_vertical = 2
|
||||
text = "ПД-М2"
|
||||
metadata/rfi_name = "pdm2"
|
||||
|
||||
[node name="btn_p14" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p14" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 560.0
|
||||
@@ -614,7 +614,7 @@ grow_vertical = 2
|
||||
text = "ПД-М4"
|
||||
metadata/rfi_name = "pdm4"
|
||||
|
||||
[node name="btn_p15" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p15" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = 280.0
|
||||
@@ -626,7 +626,7 @@ grow_vertical = 2
|
||||
text = "СРН-М2"
|
||||
metadata/rfi_name = "srnm2"
|
||||
|
||||
[node name="btn_p16" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_p16" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 210.0
|
||||
offset_top = 1118.0
|
||||
@@ -635,7 +635,7 @@ offset_bottom = 1168.0
|
||||
text = "СРН-И1"
|
||||
metadata/rfi_name = "srni1"
|
||||
|
||||
[node name="btn_off" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_off" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 140.0
|
||||
offset_top = 1118.0
|
||||
@@ -644,7 +644,7 @@ offset_bottom = 1168.0
|
||||
text = "Откл."
|
||||
metadata/rfi_name = "<off>"
|
||||
|
||||
[node name="btn_auto_rfi" parent="." groups=["группа-режим-помехи"] instance=ExtResource("4_5es2r")]
|
||||
[node name="btn_auto_rfi" parent="." groups=["группа-режим-помехи"] instance=ExtResource("6_diqdc")]
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 1118.0
|
||||
|
||||
@@ -3,3 +3,5 @@ var align : get = get_align, set = set_align
|
||||
var _align: int = 0
|
||||
func set_align(val: int): _align = val
|
||||
func get_align(): return _align
|
||||
func set_frame(val: int): $sprite.set_frame(val)
|
||||
func get_frame(): return $sprite.get_frame()
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://by22sta8tt8dn"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="1_0wisd"]
|
||||
[ext_resource type="Script" path="res://scenes/состояния-эмс.gd" id="1_vw38j"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="2_nbah5"]
|
||||
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="3_vsgfs"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="4_qu3c5"]
|
||||
[ext_resource type="Script" path="res://scenes/состояния-эмс.gd" id="1_ak0xd"]
|
||||
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="2_1bili"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="3_yw5yv"]
|
||||
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="4_1fli0"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="5_sbva1"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_ow7xh"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("1_0wisd")
|
||||
"texture": ExtResource("2_1bili")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_nbah5")
|
||||
"texture": ExtResource("3_yw5yv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_vsgfs")
|
||||
"texture": ExtResource("4_1fli0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_qu3c5")
|
||||
"texture": ExtResource("5_sbva1")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
@@ -33,7 +33,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_vw38j")
|
||||
script = ExtResource("1_ak0xd")
|
||||
|
||||
[node name="sprite" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(14, 9)
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
[gd_scene format=3 uid="uid://dspa16ufrpanp"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dspa16ufrpanp"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mla3y"]
|
||||
|
||||
[node name="LineEdit" type="LineEdit"]
|
||||
offset_right = 58.0
|
||||
offset_bottom = 33.0
|
||||
theme_override_colors/font_color = Color(1, 0.596078, 0.4, 1)
|
||||
theme_override_colors/font_uneditable_color = Color(1, 0.596078, 0.4, 1)
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_mla3y")
|
||||
alignment = 1
|
||||
context_menu_enabled = false
|
||||
shortcut_keys_enabled = false
|
||||
middle_mouse_paste_enabled = false
|
||||
selecting_enabled = false
|
||||
deselect_on_focus_loss_enabled = false
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.13
|
||||
caret_blink_interval = 0.1
|
||||
|
||||
@@ -2,9 +2,9 @@ extends Node
|
||||
|
||||
|
||||
class Socket extends PacketPeerUDP:
|
||||
func send_to(addr, data):
|
||||
self.set_dest_address(addr[0], addr[1])
|
||||
self.put_packet(data)
|
||||
func send_to(addr, data):
|
||||
self.set_dest_address(addr[0], addr[1])
|
||||
self.put_packet(data)
|
||||
|
||||
|
||||
const PROTO_TYPE: = {'yau07tx': yau07.YaU07, 'jsontx': capsrpb.CapsRpb}
|
||||
@@ -15,51 +15,51 @@ var logger_page: Node
|
||||
|
||||
|
||||
func create_socket(nm) -> Socket:
|
||||
var addr = REPSettings.addr[nm][1]
|
||||
var port = REPSettings.addr[nm][2]
|
||||
var broad = REPSettings.addr[nm][3]
|
||||
var bind = REPSettings.addr[nm][4]
|
||||
var sock: = Socket.new()
|
||||
sock.set_broadcast_enabled(broad)
|
||||
var rc = Error.OK if not bind else sock.bind(port, addr)
|
||||
var errlevel = Log.INFO if rc == Error.OK else Log.ERROR
|
||||
Log.message(errlevel, '%s: сокет:%s:%d привязанный:%s %s' % [nm, addr, port, ['нет', 'да'][int(bind)], error_string(rc)])
|
||||
return sock
|
||||
var addr = REPSettings.addr[nm][1]
|
||||
var port = REPSettings.addr[nm][2]
|
||||
var broad = REPSettings.addr[nm][3]
|
||||
var bind = REPSettings.addr[nm][4]
|
||||
var sock: = Socket.new()
|
||||
sock.set_broadcast_enabled(broad)
|
||||
var rc = Error.OK if not bind else sock.bind(port, addr)
|
||||
var errlevel = Log.INFO if rc == Error.OK else Log.ERROR
|
||||
Log.message(errlevel, '%s: сокет:%s:%d привязанный:%s %s' % [nm, addr, port, ['нет', 'да'][int(bind)], error_string(rc)])
|
||||
return sock
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var addr = REPSettings.addr['уарэп-яу07-частный'][1]
|
||||
var port = REPSettings.addr['уарэп-яу07-частный'][2]
|
||||
sock_unicast = Socket.new()
|
||||
sock_unicast.bind(port, addr)
|
||||
for key in REPSettings.addr:
|
||||
var setting = REPSettings.addr[key]
|
||||
var proto = setting[0]
|
||||
if proto in PROTO_TYPE:
|
||||
var unit = PROTO_TYPE[proto].new(key)
|
||||
var k = REPSettings.get_unit_key(setting)
|
||||
units[k] = unit
|
||||
unit.connect('line_changed', Callable(logger_page, 'on_line_changed').bind(k))
|
||||
unit.connect('command_fail', Callable(logger_page, 'on_command_fail').bind(k))
|
||||
var addr = REPSettings.addr['уарэп-яу07-частный'][1]
|
||||
var port = REPSettings.addr['уарэп-яу07-частный'][2]
|
||||
sock_unicast = Socket.new()
|
||||
sock_unicast.bind(port, addr)
|
||||
for key in REPSettings.addr:
|
||||
var setting = REPSettings.addr[key]
|
||||
var proto = setting[0]
|
||||
if proto in PROTO_TYPE:
|
||||
var unit = PROTO_TYPE[proto].new(key)
|
||||
var k = REPSettings.get_unit_key(setting)
|
||||
units[k] = unit
|
||||
unit.connect('line_changed', Callable(logger_page, 'on_line_changed').bind(k))
|
||||
unit.connect('command_fail', Callable(logger_page, 'on_command_fail').bind(k))
|
||||
|
||||
for key in units:
|
||||
var unit = units[key]
|
||||
Log.info('%s %s:%d' % [unit.name, key[0], key[1]])
|
||||
for key in units:
|
||||
var unit = units[key]
|
||||
Log.info('%s %s:%d' % [unit.name, key[0], key[1]])
|
||||
|
||||
|
||||
func poll_receive(sock: Socket):
|
||||
while sock.get_available_packet_count() > 0:
|
||||
var data: = sock.get_packet()
|
||||
var addr: = sock.get_packet_ip()
|
||||
var port: = sock.get_packet_port()
|
||||
var addr_port: = [addr, port]
|
||||
if addr_port in units: units[addr_port].parse(data)
|
||||
while sock.get_available_packet_count() > 0:
|
||||
var data: = sock.get_packet()
|
||||
var addr: = sock.get_packet_ip()
|
||||
var port: = sock.get_packet_port()
|
||||
var addr_port: = [addr, port]
|
||||
if addr_port in units: units[addr_port].parse(data)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
for addr in units:
|
||||
var unit = units[addr]
|
||||
match unit.process(delta):
|
||||
Error.OK: sock_unicast.send_to(addr, unit.data_tx)
|
||||
Error.FAILED: emit_signal('socket_error', 'ошибка: %s %s:%d' % [unit, addr[0], addr[1]])
|
||||
for sock in poll_sockets: poll_receive(sock)
|
||||
for addr in units:
|
||||
var unit = units[addr]
|
||||
match unit.process(delta):
|
||||
Error.OK: sock_unicast.send_to(addr, unit.data_tx)
|
||||
Error.FAILED: emit_signal('socket_error', 'ошибка: %s %s:%d' % [unit, addr[0], addr[1]])
|
||||
for sock in poll_sockets: poll_receive(sock)
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
extends Node
|
||||
|
||||
enum ThreatSrc {
|
||||
MP405,
|
||||
RLKS,
|
||||
RPB,
|
||||
SIGMA }
|
||||
MP405,
|
||||
RLKS,
|
||||
RPB,
|
||||
SIGMA }
|
||||
|
||||
|
||||
class Threat:
|
||||
|
||||
enum FFlags { # Допустимые значения для Threat.fflags
|
||||
ALT = 1 << 1,
|
||||
AOA = 1 << 2,
|
||||
ATIME = 1 << 3,
|
||||
BAUD = 1 << 4,
|
||||
FFLAGS = 1 << 5,
|
||||
FREQ = 1 << 6,
|
||||
FREQM = 1 << 7,
|
||||
LAT = 1 << 8,
|
||||
LON = 1 << 9,
|
||||
POW_RX = 1 << 10,
|
||||
PROTO = 1 << 11,
|
||||
RKRP = 1 << 12,
|
||||
RPARAMS = 1 << 13,
|
||||
SALT = 1 << 14,
|
||||
SLAT = 1 << 15,
|
||||
SLON = 1 << 16,
|
||||
TICK = 1 << 17,
|
||||
TMOD = 1 << 18,
|
||||
UTIME = 1 << 19,
|
||||
WIDTH = 1 << 20 }
|
||||
enum FFlags { # Допустимые значения для Threat.fflags
|
||||
ALT = 1 << 1,
|
||||
AOA = 1 << 2,
|
||||
ATIME = 1 << 3,
|
||||
BAUD = 1 << 4,
|
||||
FFLAGS = 1 << 5,
|
||||
FREQ = 1 << 6,
|
||||
FREQM = 1 << 7,
|
||||
LAT = 1 << 8,
|
||||
LON = 1 << 9,
|
||||
POW_RX = 1 << 10,
|
||||
PROTO = 1 << 11,
|
||||
RKRP = 1 << 12,
|
||||
RPARAMS = 1 << 13,
|
||||
SALT = 1 << 14,
|
||||
SLAT = 1 << 15,
|
||||
SLON = 1 << 16,
|
||||
TICK = 1 << 17,
|
||||
TMOD = 1 << 18,
|
||||
UTIME = 1 << 19,
|
||||
WIDTH = 1 << 20 }
|
||||
|
||||
var alt: float # Текущая высота, метры.
|
||||
var aoa: float # Курсовой угол на источник сигнала, градусы.
|
||||
var atime: Dictionary # Время обнаружения.
|
||||
var baud: float # Модуляционная скорость.
|
||||
var fflags: FFlags # Флаги достоверности полей.
|
||||
var freq: float # Частота несущей или центральная частота, МГц.
|
||||
var freqm: String # Режим смены частоты.
|
||||
var lat: float # Текущие координаты, долгота в градусах.
|
||||
var lon: float # Текущие координаты, широта в градусах.
|
||||
var pow_rx: float # Уровень принимаемого сигнала, дБм.
|
||||
var proto: String # Тип протокола источника сигнала.
|
||||
var rkrp: String # Рекомендуемый режим помехи.
|
||||
var rparams: String # Рекомендуемые параметры помехи.
|
||||
var salt: float # Координаты старта, высота от уровня моря, м.
|
||||
var slat: float # Координаты старта, широта в градусах.
|
||||
var slon: float # Координаты старта, долгота в градусах.
|
||||
var tick: int # Время приёма сигнала, мс.
|
||||
var tmod: String # Тип модуляции.
|
||||
var utime: Dictionary # Время крайнего обновления.
|
||||
var width: float # Ширина занимаемого диапазона частот, МГц.
|
||||
var alt: float # Текущая высота, метры.
|
||||
var aoa: float # Курсовой угол на источник сигнала, градусы.
|
||||
var atime: Dictionary # Время обнаружения.
|
||||
var baud: float # Модуляционная скорость.
|
||||
var fflags: FFlags # Флаги достоверности полей.
|
||||
var freq: float # Частота несущей или центральная частота, МГц.
|
||||
var freqm: String # Режим смены частоты.
|
||||
var lat: float # Текущие координаты, долгота в градусах.
|
||||
var lon: float # Текущие координаты, широта в градусах.
|
||||
var pow_rx: float # Уровень принимаемого сигнала, дБм.
|
||||
var proto: String # Тип протокола источника сигнала.
|
||||
var rkrp: String # Рекомендуемый режим помехи.
|
||||
var rparams: String # Рекомендуемые параметры помехи.
|
||||
var salt: float # Координаты старта, высота от уровня моря, м.
|
||||
var slat: float # Координаты старта, широта в градусах.
|
||||
var slon: float # Координаты старта, долгота в градусах.
|
||||
var tick: int # Время приёма сигнала, мс.
|
||||
var tmod: String # Тип модуляции.
|
||||
var utime: Dictionary # Время крайнего обновления.
|
||||
var width: float # Ширина занимаемого диапазона частот, МГц.
|
||||
|
||||
|
||||
var _threats = {}
|
||||
@@ -60,16 +60,16 @@ var _threats = {}
|
||||
"""
|
||||
|
||||
func on_parse_threads(unit: capsrpb.CapsRpb):
|
||||
print_debug(unit)
|
||||
print_debug(unit)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Log.info('Модуль обработки целей готов')
|
||||
var unit = REPSettings.addrs[]
|
||||
unit.connect('data_received', Callable(self, 'on_data_capsrpb_received'))
|
||||
Log.info('Модуль обработки целей готов')
|
||||
#var unit = REPSettings.addrs[]
|
||||
#unit.connect('data_received', Callable(self, 'on_data_capsrpb_received'))
|
||||
|
||||
|
||||
|
||||
func on_data_capsrpb_received(unit: capsrpb.CapsRpb):
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
65
scripts/yems_consts.gd
Normal file
65
scripts/yems_consts.gd
Normal file
@@ -0,0 +1,65 @@
|
||||
extends Node
|
||||
|
||||
|
||||
# Таблица с данными для входов, первое значение - индекс устройства в ячейке КЭМС
|
||||
const INPUT_ROWS0 = [
|
||||
[1,['1111 МР-231S, УИЗП', 'X31', '0.00', '0.00']],
|
||||
[2,['2222 МР-231S, Строб ЭМС', 'X32', '0.00', '0.00']],
|
||||
[3,['3НРЛС МР-231-3, УИЗП', 'X34', '0.00', '0.00']],
|
||||
[4,['4НРЛС МР-231-3, Строб ЭМС', 'X35', '0.00', '0.00']],
|
||||
[5,['5ЦИСВС-1010, УИЗП', 'X43', '0.00', '0.00']],
|
||||
[8,['64302-01, 4302-04, УИЗП', 'X46', '0.00', '0.00']],
|
||||
[11,['7НРЛС МР-231S, УИЗП', 'X51', '0.00', '0.00']],
|
||||
[22,['8222 МР-231S, Строб ЭМС', 'X32', '0.00', '0.00']],
|
||||
[23,['9РЛС МР-231-3, УИЗП', 'X34', '0.00', '0.00']],
|
||||
[24,['10НРЛС МР-231-3, Строб ЭМС', 'X35', '0.00', '0.00']],
|
||||
[25,['11ЦИСВС-1010, УИЗП', 'X43', '0.00', '0.00']],
|
||||
[28,['124302-01, 4302-04, УИЗП', 'X46', '0.00', '0.00']],
|
||||
[21,['13НРЛС МР-231S, УИЗП', 'X51', '0.00', '0.00']]]
|
||||
|
||||
# Таблица с данными для выходов, первое значение - индекс устройства в ячейке КЭМС
|
||||
const OUTPUT_ROWS0 = [
|
||||
[41,['15НРЛС МР-231S, БИ', 'X61', '0.00', '0.00']],
|
||||
[42,['16НРЛС МР-231S', 'X62', '0.00', '0.00']],
|
||||
[43,['17НРЛС МР-231-3, БИ', 'X64', '0.00', '0.00']],
|
||||
[44,['18НРЛС МР-231-3', 'X65', '0.00', '0.00']],
|
||||
[45,['19ЦИСВС-1010, БИ', 'X63', '0.00', '0.00']],
|
||||
[46,['204302-01, 4302-04, БИ', 'X66', '0.00', '0.00']],
|
||||
[48,['21НРЛС 11111111', 'X69', '0.00', '0.00']],
|
||||
[52,['22НРЛС МР-231S', 'X62', '0.00', '0.00']],
|
||||
[53,['23НРЛС МР-231-3, БИ', 'X64', '0.00', '0.00']],
|
||||
[54,['24НРЛС МР-231-3', 'X65', '0.00', '0.00']],
|
||||
[55,['25ЦИСВС-1010, БИ', 'X63', '0.00', '0.00']],
|
||||
[56,['264302-01, 4302-04, БИ', 'X66', '0.00', '0.00']],
|
||||
[58,['27НРЛС 11111111', 'X69', '0.00', '0.00']]]
|
||||
|
||||
const INPUT_ROWS1 = [
|
||||
[12,['283333 МР-231S, Строб ЭМС', 'X52', '0.00', '0.00']],
|
||||
[13,['29НРЛС МР-231-3, УИЗП', 'X54', '0.00', '0.00']],
|
||||
[14,['30НРЛС МР-231-3, Строб ЭМС', 'X55', '0.00', '0.00']],
|
||||
[15,['31ЦИСВС-1010, УИЗП', 'X23', '0.00', '0.00']],
|
||||
[21,['32НРЛС МР-231S, УИЗП', 'X21', '0.00', '0.00']],
|
||||
[22,['33НРЛС МР-231S, Строб ЭМС', 'X22', '0.00', '0.00']],
|
||||
[23,['34НРЛС МР-231-3, УИЗП', 'X24', '0.00', '0.00']],
|
||||
[32,['352222 МР-231S, Строб ЭМС', 'X32', '0.00', '0.00']],
|
||||
[33,['36НРЛС МР-231-3, УИЗП', 'X34', '0.00', '0.00']],
|
||||
[34,['37НРЛС МР-231-3, Строб ЭМС', 'X35', '0.00', '0.00']],
|
||||
[35,['38ЦИСВС-1010, УИЗП', 'X43', '0.00', '0.00']],
|
||||
[38,['394302-01, 4302-04, УИЗП', 'X46', '0.00', '0.00']],
|
||||
[31,['40НРЛС МР-231S, УИЗП', 'X51', '0.00', '0.00']]]
|
||||
|
||||
# Таблица с данными для выходов, первое значение - индекс устройства в ячейке КЭМС
|
||||
const OUTPUT_ROWS1 = [
|
||||
[41,['41НРЛС МР-231S, БИ', 'X61', '0.00', '0.00']],
|
||||
[42,['42НРЛС МР-231S', 'X62', '0.00', '0.00']],
|
||||
[43,['43НРЛС МР-231-3, БИ', 'X64', '0.00', '0.00']],
|
||||
[44,['44НРЛС МР-231-3', 'X65', '0.00', '0.00']],
|
||||
[45,['45ЦИСВС-1010, БИ', 'X63', '0.00', '0.00']],
|
||||
[46,['464302-01, 4302-04, БИ', 'X66', '0.00', '0.00']],
|
||||
[48,['47НРЛС 11111111', 'X69', '0.00', '0.00']],
|
||||
[62,['48НРЛС МР-231S', 'X62', '0.00', '0.00']],
|
||||
[63,['49НРЛС МР-231-3, БИ', 'X64', '0.00', '0.00']],
|
||||
[64,['50НРЛС МР-231-3', 'X65', '0.00', '0.00']],
|
||||
[65,['51ЦИСВС-1010, БИ', 'X63', '0.00', '0.00']],
|
||||
[66,['524302-01, 4302-04, БИ', 'X66', '0.00', '0.00']],
|
||||
[68,['53НРЛС 11111111', 'X69', '0.00', '0.00']]]
|
||||
@@ -2,16 +2,18 @@ extends Node
|
||||
|
||||
|
||||
class InDev:
|
||||
var id: int # Идентификатор индекс устройства
|
||||
var dev_name: String # Имя подключаемого комплекса
|
||||
var connector: String # Номер разъёма в приборе
|
||||
var delay: float # Задержка фронта импульса
|
||||
var offset: float # Смещение фронта импульса
|
||||
var state: int # Состояние входа
|
||||
var freq: int # Предполагаемая частота на которой работает комплекс
|
||||
var ports_data: Dictionary # Словарь состояния портов устройства
|
||||
var tbl_row_id: int # Индекс устройства в таблице входов
|
||||
var out_dots: Array # Список выходных устройств в порядке, как в таблице и точки матрицы
|
||||
var id: int # Идентификатор индекс устройства
|
||||
var dev_name: String # Имя подключаемого комплекса
|
||||
var connector: String # Номер разъёма в приборе
|
||||
var delay: float # Задержка фронта импульса
|
||||
var offset: float # Смещение фронта импульса
|
||||
var state: int # Состояние входа
|
||||
var freq: int # Предполагаемая частота на которой работает комплекс
|
||||
var ports_data: Dictionary # Словарь состояния портов устройства
|
||||
var tbl_row_id: int # Индекс устройства в таблице выходов
|
||||
var out_dots: Array # Список выходных устройств в порядке, как в таблице и точки матрицы
|
||||
var connect_devs: Dictionary # Список присоединённых устройств
|
||||
var board: String # Плата в которой находится устройство
|
||||
|
||||
func _init(dev_id : int, params : Array, row_id : int):
|
||||
id = dev_id
|
||||
@@ -22,17 +24,8 @@ class InDev:
|
||||
tbl_row_id = row_id
|
||||
|
||||
|
||||
class OutDev:
|
||||
var id: int # Идентификатор индекс устройства
|
||||
var dev_name: String # Имя подключаемого комплекса
|
||||
var connector: String # Номер разъёма в приборе
|
||||
var delay: float # Задержка фронта импульса
|
||||
var offset: float # Смещение фронта импульса
|
||||
var state: int # Состояние входа
|
||||
var freq: int # Предполагаемая частота на которой работает комплекс
|
||||
var ports_data: Dictionary # Словарь состояния портов устройства
|
||||
var tbl_row_id: int # Индекс устройства в таблице выходов
|
||||
var mode: int # Режим работы выхода
|
||||
class OutDev extends InDev:
|
||||
var mode: String # Режим работы выхода
|
||||
|
||||
func _init(dev_id : int, params : Array, row_id : int):
|
||||
id = dev_id
|
||||
@@ -41,4 +34,4 @@ class OutDev:
|
||||
delay = float(params[2])
|
||||
offset = float(params[3])
|
||||
tbl_row_id = row_id
|
||||
mode = 0
|
||||
mode = 'Работа'
|
||||
|
||||
15
scripts/yemsboards.gd
Normal file
15
scripts/yemsboards.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
extends Node
|
||||
|
||||
class EmsBoard:
|
||||
var id_board: String
|
||||
var in_devs: Dictionary # Словарь с входными устройствами
|
||||
var out_devs: Dictionary # Словарь с выходными устройствами
|
||||
var base_addr_isa: int # Базовый адрес ячейки isa
|
||||
var in_tbl: Array
|
||||
var out_tbl: Array
|
||||
|
||||
func _init(id, base_addr, in_table, out_table):
|
||||
id_board = id
|
||||
in_tbl = in_table
|
||||
out_tbl = out_table
|
||||
base_addr_isa = base_addr
|
||||
704
table/table.gd
704
table/table.gd
@@ -37,524 +37,524 @@ var scroll_adj: = Vector2(0, 0)
|
||||
|
||||
|
||||
func pin_header(scrl: ScrollContainer, prnt):
|
||||
scrl.remove_child(header)
|
||||
prnt.add_child(header)
|
||||
# TODO: Это значение следует получить из темы
|
||||
var v_separation: = 3.0
|
||||
header.position = scrl.position - Vector2(0, header.size.y + v_separation)
|
||||
scroll = scrl
|
||||
scroll_adj = scrl.position
|
||||
scrl.remove_child(header)
|
||||
prnt.add_child(header)
|
||||
# TODO: Это значение следует получить из темы
|
||||
var v_separation: = 3.0
|
||||
header.position = scrl.position - Vector2(0, header.size.y + v_separation)
|
||||
scroll = scrl
|
||||
scroll_adj = scrl.position
|
||||
|
||||
|
||||
func selector_up():
|
||||
var i_rows: = []
|
||||
get_selected_rows(i_rows)
|
||||
for i in i_rows:
|
||||
set_row_selected(i, false)
|
||||
var rows_count: = get_rows_count()
|
||||
if not (i_rows.size() and (rows_count > 1)):
|
||||
return
|
||||
var i_row = i_rows[0]
|
||||
i_row -= 1
|
||||
if i_row < 0:
|
||||
i_row = rows_count - 1
|
||||
set_row_selected(i_row, true)
|
||||
emit_signal('selected_changed', i_row)
|
||||
var i_rows: = []
|
||||
get_selected_rows(i_rows)
|
||||
for i in i_rows:
|
||||
set_row_selected(i, false)
|
||||
var rows_count: = get_rows_count()
|
||||
if not (i_rows.size() and (rows_count > 1)):
|
||||
return
|
||||
var i_row = i_rows[0]
|
||||
i_row -= 1
|
||||
if i_row < 0:
|
||||
i_row = rows_count - 1
|
||||
set_row_selected(i_row, true)
|
||||
emit_signal('selected_changed', i_row)
|
||||
|
||||
|
||||
func selector_down():
|
||||
var i_rows: = []
|
||||
get_selected_rows(i_rows)
|
||||
for i in i_rows:
|
||||
set_row_selected(i, false)
|
||||
var rows_count: = get_rows_count()
|
||||
if not (i_rows.size() and (rows_count > 1)):
|
||||
return
|
||||
var i_row = i_rows[0]
|
||||
i_row += 1
|
||||
i_row %= rows_count
|
||||
set_row_selected(i_row, true)
|
||||
emit_signal('selected_changed', i_row)
|
||||
var i_rows: = []
|
||||
get_selected_rows(i_rows)
|
||||
for i in i_rows:
|
||||
set_row_selected(i, false)
|
||||
var rows_count: = get_rows_count()
|
||||
if not (i_rows.size() and (rows_count > 1)):
|
||||
return
|
||||
var i_row = i_rows[0]
|
||||
i_row += 1
|
||||
i_row %= rows_count
|
||||
set_row_selected(i_row, true)
|
||||
emit_signal('selected_changed', i_row)
|
||||
|
||||
|
||||
func set_columns_alignments(alignments):
|
||||
assert(columns == alignments.size())
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
for i_col in alignments.size():
|
||||
set_node_alligment(i_col, i_row, alignments[i_col])
|
||||
assert(columns == alignments.size())
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
for i_col in alignments.size():
|
||||
set_node_alligment(i_col, i_row, alignments[i_col])
|
||||
|
||||
|
||||
func load_selector_scene(file_name: String):
|
||||
selector_type_file = file_name
|
||||
ScnSelector = load(file_name)
|
||||
selector_type_file = file_name
|
||||
ScnSelector = load(file_name)
|
||||
|
||||
|
||||
func load_node_scene(file_name: String):
|
||||
node_type_file = file_name
|
||||
ScnNode = load(file_name)
|
||||
node_type_file = file_name
|
||||
ScnNode = load(file_name)
|
||||
|
||||
|
||||
func get_node_scene():
|
||||
return node_type_file
|
||||
return node_type_file
|
||||
|
||||
|
||||
func _ready():
|
||||
ScnSelector = load(selector_type_file)
|
||||
ScnNode = load(node_type_file)
|
||||
assert(ScnSelector)
|
||||
assert(ScnNode)
|
||||
ScnSelector = load(selector_type_file)
|
||||
ScnNode = load(node_type_file)
|
||||
assert(ScnSelector)
|
||||
assert(ScnNode)
|
||||
|
||||
|
||||
func align_to_left_bottompos(hdr: Control, gap: = Vector2(0, 0)):
|
||||
""" Выравнивает по нижнему левому углу.
|
||||
Используется для выравнивания по заголовку """
|
||||
position.x = hdr.position.x + gap.x
|
||||
position.y = hdr.position.y + hdr.size.y + gap.y
|
||||
""" Выравнивает по нижнему левому углу.
|
||||
Используется для выравнивания по заголовку """
|
||||
position.x = hdr.position.x + gap.x
|
||||
position.y = hdr.position.y + hdr.size.y + gap.y
|
||||
|
||||
|
||||
func _assert_meta(i_col: int, i_row: int, pname: String, node):
|
||||
assert(node.has_meta(pname), 'ошибка: нет мета-свойства \"%s\" у ячейки (%s): колонка:%d ряд:%d' % [pname, typeof(node), i_col, i_row])
|
||||
assert(node.has_meta(pname), 'ошибка: нет мета-свойства \"%s\" у ячейки (%s): колонка:%d ряд:%d' % [pname, typeof(node), i_col, i_row])
|
||||
|
||||
|
||||
func set_node_meta(i_col: int, i_row: int, pname: String, val) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.set_meta(pname, val)
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.set_meta(pname, val)
|
||||
|
||||
|
||||
func get_node_meta(i_col: int, i_row: int, pname: String):
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
_assert_meta(i_col, i_row, pname, node)
|
||||
return node.get_meta(pname)
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
_assert_meta(i_col, i_row, pname, node)
|
||||
return node.get_meta(pname)
|
||||
|
||||
|
||||
func set_node_property(i_col: int, i_row: int, pname: String, val) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.set(pname, val)
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.set(pname, val)
|
||||
|
||||
|
||||
func get_node_property(i_col: int, i_row: int, pname: String):
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
return node.get(pname)
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
return node.get(pname)
|
||||
|
||||
|
||||
func get_node_key(format: String, i_col: int, i_row: int) -> String:
|
||||
var key: String = format % [i_row, i_col]
|
||||
assert(nodes.has(key), 'ошибка: нет такой ячейки: колонка:%d ряд:%d' % [i_col, i_row])
|
||||
return key
|
||||
var key: String = format % [i_row, i_col]
|
||||
assert(nodes.has(key), 'ошибка: нет такой ячейки: колонка:%d ряд:%d' % [i_col, i_row])
|
||||
return key
|
||||
|
||||
|
||||
func get_key_indexes(key: String) -> Array:
|
||||
var tokens: = key.split('_')
|
||||
assert(tokens.size() == 3, 'ошибка: неверный ключ: \"%s\"' % key)
|
||||
return [int(tokens[2]), int(tokens[1])]
|
||||
var tokens: = key.split('_')
|
||||
assert(tokens.size() == 3, 'ошибка: неверный ключ: \"%s\"' % key)
|
||||
return [int(tokens[2]), int(tokens[1])]
|
||||
|
||||
|
||||
func set_columns_min_size(sizes: Array) -> void:
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
set_nodes_min_size(i_row, sizes)
|
||||
set_nodes_min_size(0, sizes, HEAD_KEY_FORMAT)
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
set_nodes_min_size(i_row, sizes)
|
||||
set_nodes_min_size(0, sizes, HEAD_KEY_FORMAT)
|
||||
|
||||
|
||||
func set_columns_aligment(alignments: Array) -> void:
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
for i_col in alignments.size():
|
||||
set_node_alligment(i_col, i_row, alignments[i_col])
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
for i_col in alignments.size():
|
||||
set_node_alligment(i_col, i_row, alignments[i_col])
|
||||
|
||||
|
||||
func _input(event) -> void:
|
||||
if event is InputEventKey:
|
||||
if in_focus and event.pressed:
|
||||
if event.keycode == selector_key_up:
|
||||
selector_up()
|
||||
elif event.keycode == selector_key_down:
|
||||
selector_down()
|
||||
elif event is InputEventMouseButton:
|
||||
if not event.pressed:
|
||||
return
|
||||
if check_event_pos(event.position, scroll):
|
||||
if not in_focus:
|
||||
in_focus = true
|
||||
emit_signal('focus_entered')
|
||||
elif not check_event_pos(event.position, scroll):
|
||||
if in_focus:
|
||||
in_focus = false
|
||||
emit_signal('focus_exited')
|
||||
if event is InputEventKey:
|
||||
if in_focus and event.pressed:
|
||||
if event.keycode == selector_key_up:
|
||||
selector_up()
|
||||
elif event.keycode == selector_key_down:
|
||||
selector_down()
|
||||
elif event is InputEventMouseButton:
|
||||
if not event.pressed:
|
||||
return
|
||||
if check_event_pos(event.position, scroll):
|
||||
if not in_focus:
|
||||
in_focus = true
|
||||
emit_signal('focus_entered')
|
||||
elif not check_event_pos(event.position, scroll):
|
||||
if in_focus:
|
||||
in_focus = false
|
||||
emit_signal('focus_exited')
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
selector_color_proc = Callable(self, 'defaultselector_color_proc')
|
||||
assert(selector_color_proc.is_valid())
|
||||
selector_size_proc = Callable(self, 'default_selector_size_proc')
|
||||
assert(selector_size_proc.is_valid())
|
||||
scroll = self
|
||||
selector_color_proc = Callable(self, 'defaultselector_color_proc')
|
||||
assert(selector_color_proc.is_valid())
|
||||
selector_size_proc = Callable(self, 'default_selector_size_proc')
|
||||
assert(selector_size_proc.is_valid())
|
||||
scroll = self
|
||||
|
||||
|
||||
func check_event_pos(event_pos: Vector2, obj: Control):
|
||||
return \
|
||||
(event_pos.x > obj.position.x) \
|
||||
and (event_pos.x < (obj.position.x + obj.size.x)) \
|
||||
and (event_pos.y > obj.position.y) \
|
||||
and (event_pos.y < (obj.position.y + obj.size.y))
|
||||
return \
|
||||
(event_pos.x > obj.position.x) \
|
||||
and (event_pos.x < (obj.position.x + obj.size.x)) \
|
||||
and (event_pos.y > obj.position.y) \
|
||||
and (event_pos.y < (obj.position.y + obj.size.y))
|
||||
|
||||
|
||||
func defaultselector_color_proc(_i_row: int):
|
||||
return selector_color
|
||||
return selector_color
|
||||
|
||||
|
||||
func setselector_color_proc(instance: Object, function: String) -> void:
|
||||
selector_color_proc = Callable(instance, function)
|
||||
assert(selector_color_proc.is_valid())
|
||||
selector_color_proc = Callable(instance, function)
|
||||
assert(selector_color_proc.is_valid())
|
||||
|
||||
|
||||
func set_selector_size_proc(instance: Object, function: String) -> void:
|
||||
selector_size_proc = Callable(instance, function)
|
||||
assert(selector_size_proc.is_valid())
|
||||
selector_size_proc = Callable(instance, function)
|
||||
assert(selector_size_proc.is_valid())
|
||||
|
||||
|
||||
func default_selector_size_proc(i_row: int, rect: Array) -> void:
|
||||
get_row_rect(i_row, rect)
|
||||
rect[0] += position.x - node_gap.x / 2.0
|
||||
rect[1] += position.y - node_gap.y / 2.0
|
||||
rect[2] += node_gap.x
|
||||
rect[3] += node_gap.y
|
||||
get_row_rect(i_row, rect)
|
||||
rect[0] += position.x - node_gap.x / 2.0
|
||||
rect[1] += position.y - node_gap.y / 2.0
|
||||
rect[2] += node_gap.x
|
||||
rect[3] += node_gap.y
|
||||
|
||||
|
||||
func clear_rows_selected():
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
set_row_selected(i_row, false)
|
||||
var rows_count: = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
set_row_selected(i_row, false)
|
||||
|
||||
|
||||
func set_row_selected(i_row: int, selected: bool = true) -> void:
|
||||
var key: = ROW_SELECTOR_KEY_FORMAT % [i_row, 0]
|
||||
var node = nodes[NODE_KEY_FORMAT % [i_row, 0]]
|
||||
if nodes.has(key) and (not selected):
|
||||
var selector = nodes[key]
|
||||
node.remove_child(selector)
|
||||
selector.queue_free()
|
||||
nodes.erase(key)
|
||||
elif (not nodes.has(key)) and selected:
|
||||
var selector = ScnSelector.instantiate()
|
||||
var rect: = [0, 0, 0, 0]
|
||||
selector_size_proc.call(i_row, rect)
|
||||
selector.size.x = rect[2]
|
||||
selector.size.y = rect[3]
|
||||
selector.modulate = selector_color_proc.call(i_row)
|
||||
selector.z_index = z_index + 1
|
||||
nodes[key] = selector
|
||||
node.add_child(selector)
|
||||
var key: = ROW_SELECTOR_KEY_FORMAT % [i_row, 0]
|
||||
var node = nodes[NODE_KEY_FORMAT % [i_row, 0]]
|
||||
if nodes.has(key) and (not selected):
|
||||
var selector = nodes[key]
|
||||
node.remove_child(selector)
|
||||
selector.queue_free()
|
||||
nodes.erase(key)
|
||||
elif (not nodes.has(key)) and selected:
|
||||
var selector = ScnSelector.instantiate()
|
||||
var rect: = [0, 0, 0, 0]
|
||||
selector_size_proc.call(i_row, rect)
|
||||
selector.size.x = rect[2]
|
||||
selector.size.y = rect[3]
|
||||
selector.modulate = selector_color_proc.call(i_row)
|
||||
selector.z_index = z_index + 1
|
||||
nodes[key] = selector
|
||||
node.add_child(selector)
|
||||
|
||||
|
||||
func is_row_selected(i_row: int) -> bool:
|
||||
var key: = ROW_SELECTOR_KEY_FORMAT % [i_row, 0]
|
||||
return nodes.has(key)
|
||||
var key: = ROW_SELECTOR_KEY_FORMAT % [i_row, 0]
|
||||
return nodes.has(key)
|
||||
|
||||
|
||||
func get_selected_rows(i_rows: Array) -> void:
|
||||
for key in nodes.keys():
|
||||
if SLCT_PREFIX in key:
|
||||
var indexes = get_key_indexes(key)
|
||||
i_rows.append(indexes[1])
|
||||
for key in nodes.keys():
|
||||
if SLCT_PREFIX in key:
|
||||
var indexes = get_key_indexes(key)
|
||||
i_rows.append(indexes[1])
|
||||
|
||||
|
||||
func get_rows_count() -> int:
|
||||
var rows_count: int = 0
|
||||
for key in nodes:
|
||||
rows_count += int(NODE_PREFIX in key)
|
||||
return rows_count / columns
|
||||
var rows_count: int = 0
|
||||
for key in nodes:
|
||||
rows_count += int(NODE_PREFIX in key)
|
||||
return rows_count / columns
|
||||
|
||||
|
||||
func get_node2(i_col: int, i_row: int) -> Node:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
return nodes[key]
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
return nodes[key]
|
||||
|
||||
|
||||
func set_node_user_data(i_col: int, i_row: int, user_data: Object) -> void:
|
||||
var key: = DATA_KEY_FORMAT % [i_row, i_col]
|
||||
nodes[key] = user_data
|
||||
func set_node_user_data(i_col: int, i_row: int, user_data) -> void:
|
||||
var key: = DATA_KEY_FORMAT % [i_row, i_col]
|
||||
nodes[key] = user_data
|
||||
|
||||
|
||||
func add_row(row_types: Array) -> void:
|
||||
assert(row_types.size() < MAX_INDEX, 'ошибка: слишком много колонок, больше %d' % (MAX_INDEX + 1))
|
||||
if columns == 1:
|
||||
set_columns(row_types.size())
|
||||
else:
|
||||
assert(columns == row_types.size(), 'ошибка: %s количество колонок установлено ранее - %d, но требуется %d' % [self, columns, row_types.size()])
|
||||
var rows_count: int = get_rows_count()
|
||||
assert(rows_count < MAX_INDEX, 'ошибка: слишком много рядов, больше %d' % (MAX_INDEX + 1))
|
||||
for i_col in columns:
|
||||
var node = row_types[i_col].instantiate()
|
||||
var head = nodes[HEAD_KEY_FORMAT % [0, i_col]]
|
||||
node.custom_minimum_size.x = head.custom_minimum_size.x
|
||||
node.size.x = head.size.x
|
||||
var key: String = NODE_KEY_FORMAT % [rows_count, i_col]
|
||||
node.name = key
|
||||
add_child(node)
|
||||
nodes[key] = node
|
||||
node.connect('focus_entered', Callable(self, '_on_focus_entered').bind(key))
|
||||
assert(row_types.size() < MAX_INDEX, 'ошибка: слишком много колонок, больше %d' % (MAX_INDEX + 1))
|
||||
if columns == 1:
|
||||
set_columns(row_types.size())
|
||||
else:
|
||||
assert(columns == row_types.size(), 'ошибка: %s количество колонок установлено ранее - %d, но требуется %d' % [self, columns, row_types.size()])
|
||||
var rows_count: int = get_rows_count()
|
||||
assert(rows_count < MAX_INDEX, 'ошибка: слишком много рядов, больше %d' % (MAX_INDEX + 1))
|
||||
for i_col in columns:
|
||||
var node = row_types[i_col].instantiate()
|
||||
var head = nodes[HEAD_KEY_FORMAT % [0, i_col]]
|
||||
node.custom_minimum_size.x = head.custom_minimum_size.x
|
||||
node.set_deferred('size.x', head.size.x)
|
||||
var key: String = NODE_KEY_FORMAT % [rows_count, i_col]
|
||||
node.name = key
|
||||
add_child(node)
|
||||
nodes[key] = node
|
||||
node.connect('focus_entered', Callable(self, '_on_focus_entered').bind(key))
|
||||
|
||||
|
||||
func _on_focus_entered(key):
|
||||
var indexes = get_key_indexes(key)
|
||||
emit_signal('row_pressed', indexes[1])
|
||||
var indexes = get_key_indexes(key)
|
||||
emit_signal('row_pressed', indexes[1])
|
||||
|
||||
|
||||
func set_header(header_types: Array):
|
||||
assert(header_types.size() < MAX_INDEX, 'ошибка: слишком много колонок, больше %d' % (MAX_INDEX + 1))
|
||||
if columns == 1:
|
||||
set_columns(header_types.size())
|
||||
else:
|
||||
assert(columns == header_types.size())
|
||||
var do_adj: = false
|
||||
if not header:
|
||||
header = GridContainer.new()
|
||||
header.position = position
|
||||
header.columns = header_types.size()
|
||||
header.size.x = size.x
|
||||
var parent = scroll.get_parent()
|
||||
parent.add_child(header)
|
||||
do_adj = true
|
||||
else:
|
||||
var childrens = header.get_children()
|
||||
for node in childrens:
|
||||
childrens.erase(node.name)
|
||||
childrens.remove_child(node)
|
||||
node.queue_free()
|
||||
for i_col in columns:
|
||||
var node = header_types[i_col].instantiate()
|
||||
var key: String = HEAD_KEY_FORMAT % [0, i_col]
|
||||
node.name = key
|
||||
nodes[key] = node
|
||||
header.add_child(node)
|
||||
if do_adj:
|
||||
var rect = [0, 0, 0, 0]
|
||||
get_node_rect(0, 0, rect, HEAD_KEY_FORMAT)
|
||||
position.y += rect[3]
|
||||
assert(header_types.size() < MAX_INDEX, 'ошибка: слишком много колонок, больше %d' % (MAX_INDEX + 1))
|
||||
if columns == 1:
|
||||
set_columns(header_types.size())
|
||||
else:
|
||||
assert(columns == header_types.size())
|
||||
var do_adj: = false
|
||||
if not header:
|
||||
header = GridContainer.new()
|
||||
header.position = position
|
||||
header.columns = header_types.size()
|
||||
header.size.x = size.x
|
||||
var parent = scroll.get_parent()
|
||||
parent.add_child(header)
|
||||
do_adj = true
|
||||
else:
|
||||
var childrens = header.get_children()
|
||||
for node in childrens:
|
||||
childrens.erase(node.name)
|
||||
childrens.remove_child(node)
|
||||
node.queue_free()
|
||||
for i_col in columns:
|
||||
var node = header_types[i_col].instantiate()
|
||||
var key: String = HEAD_KEY_FORMAT % [0, i_col]
|
||||
node.name = key
|
||||
nodes[key] = node
|
||||
header.add_child(node)
|
||||
if do_adj:
|
||||
var rect = [0, 0, 0, 0]
|
||||
get_node_rect(0, 0, rect, HEAD_KEY_FORMAT)
|
||||
position.y += rect[3]
|
||||
|
||||
|
||||
func set_header_text(headers: Array):
|
||||
assert(columns == headers.size())
|
||||
set_row_text(0, headers, 0, HEAD_KEY_FORMAT)
|
||||
assert(columns == headers.size())
|
||||
set_row_text(0, headers, 0, HEAD_KEY_FORMAT)
|
||||
|
||||
|
||||
func get_node_user_data(i_col: int, i_row: int) -> Object:
|
||||
var key: = get_node_key(DATA_KEY_FORMAT, i_col, i_row)
|
||||
return nodes[key]
|
||||
func get_node_user_data(i_col: int, i_row: int):
|
||||
var key: = get_node_key(DATA_KEY_FORMAT, i_col, i_row)
|
||||
return nodes[key]
|
||||
|
||||
|
||||
func remove_row(i_row: int):
|
||||
var sel_key: String = ROW_SELECTOR_KEY_FORMAT % [i_row, 0]
|
||||
if nodes.has(sel_key):
|
||||
var selector = nodes[sel_key]
|
||||
var node_key: String = get_node_key(NODE_KEY_FORMAT, 0, i_row)
|
||||
var node = nodes[node_key]
|
||||
node.remove_child(selector)
|
||||
selector.queue_free()
|
||||
nodes.erase(sel_key)
|
||||
for i_col in columns:
|
||||
var node_key: String = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var conn_key: String = CONNECTED_KEY_FORMAT % [i_row, i_col]
|
||||
var data_key: String = DATA_KEY_FORMAT % [i_row, i_col]
|
||||
var node = nodes[node_key]
|
||||
nodes.erase(node_key)
|
||||
remove_child(node)
|
||||
node.queue_free()
|
||||
var sel_key: String = ROW_SELECTOR_KEY_FORMAT % [i_row, 0]
|
||||
if nodes.has(sel_key):
|
||||
var selector = nodes[sel_key]
|
||||
var node_key: String = get_node_key(NODE_KEY_FORMAT, 0, i_row)
|
||||
var node = nodes[node_key]
|
||||
node.remove_child(selector)
|
||||
selector.queue_free()
|
||||
nodes.erase(sel_key)
|
||||
for i_col in columns:
|
||||
var node_key: String = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var conn_key: String = CONNECTED_KEY_FORMAT % [i_row, i_col]
|
||||
var data_key: String = DATA_KEY_FORMAT % [i_row, i_col]
|
||||
var node = nodes[node_key]
|
||||
nodes.erase(node_key)
|
||||
remove_child(node)
|
||||
node.queue_free()
|
||||
|
||||
if nodes.has(data_key):
|
||||
nodes.erase(data_key)
|
||||
if nodes.has(conn_key):
|
||||
var conn = nodes[conn_key]
|
||||
var callback = conn[0]
|
||||
var dest_node = conn[1]
|
||||
node.disconnect('pressed', Callable(dest_node, callback))
|
||||
nodes.erase(conn_key)
|
||||
if nodes.has(data_key):
|
||||
nodes.erase(data_key)
|
||||
if nodes.has(conn_key):
|
||||
var conn = nodes[conn_key]
|
||||
var callback = conn[0]
|
||||
var dest_node = conn[1]
|
||||
node.disconnect('pressed', Callable(dest_node, callback))
|
||||
nodes.erase(conn_key)
|
||||
|
||||
|
||||
func rehash(swaps: Array):
|
||||
""" Переназначает ключи в соответствии с размерами таблицы.
|
||||
После вызова swaps содержит массив пар [<прежний ключ>, <текущий ключ>] """
|
||||
assert(not swaps.size(), 'ошибка: swaps не пустой')
|
||||
var nodes_copy: = {}
|
||||
var i_col: = 0
|
||||
var i_row: = 0
|
||||
for key0 in nodes:
|
||||
if NODE_PREFIX in key0:
|
||||
var node_key1: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[node_key1] = nodes[key0]
|
||||
swaps.append([key0, node_key1])
|
||||
""" Переназначает ключи в соответствии с размерами таблицы.
|
||||
После вызова swaps содержит массив пар [<прежний ключ>, <текущий ключ>] """
|
||||
assert(not swaps.size(), 'ошибка: swaps не пустой')
|
||||
var nodes_copy: = {}
|
||||
var i_col: = 0
|
||||
var i_row: = 0
|
||||
for key0 in nodes:
|
||||
if NODE_PREFIX in key0:
|
||||
var node_key1: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[node_key1] = nodes[key0]
|
||||
swaps.append([key0, node_key1])
|
||||
|
||||
var indxs = get_key_indexes(key0)
|
||||
var indxs = get_key_indexes(key0)
|
||||
|
||||
var slct_key0: String = ROW_SELECTOR_KEY_FORMAT % [indxs[1], indxs[0]]
|
||||
if nodes.has(slct_key0):
|
||||
var slct_key1: String = ROW_SELECTOR_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[slct_key1] = nodes[slct_key0]
|
||||
swaps.append([slct_key0, slct_key1])
|
||||
var slct_key0: String = ROW_SELECTOR_KEY_FORMAT % [indxs[1], indxs[0]]
|
||||
if nodes.has(slct_key0):
|
||||
var slct_key1: String = ROW_SELECTOR_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[slct_key1] = nodes[slct_key0]
|
||||
swaps.append([slct_key0, slct_key1])
|
||||
|
||||
var conn_key0: String = CONNECTED_KEY_FORMAT % [indxs[1], indxs[0]]
|
||||
if nodes.has(conn_key0):
|
||||
var conn_key1: String = CONNECTED_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[conn_key1] = nodes[conn_key0]
|
||||
swaps.append([conn_key0, conn_key1])
|
||||
var conn_key0: String = CONNECTED_KEY_FORMAT % [indxs[1], indxs[0]]
|
||||
if nodes.has(conn_key0):
|
||||
var conn_key1: String = CONNECTED_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[conn_key1] = nodes[conn_key0]
|
||||
swaps.append([conn_key0, conn_key1])
|
||||
|
||||
var data_key0: String = DATA_KEY_FORMAT % [indxs[1], indxs[0]]
|
||||
if nodes.has(data_key0):
|
||||
var data_key1: String = DATA_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[data_key1] = nodes[data_key0]
|
||||
swaps.append([data_key0, data_key1])
|
||||
var data_key0: String = DATA_KEY_FORMAT % [indxs[1], indxs[0]]
|
||||
if nodes.has(data_key0):
|
||||
var data_key1: String = DATA_KEY_FORMAT % [i_row, i_col]
|
||||
nodes_copy[data_key1] = nodes[data_key0]
|
||||
swaps.append([data_key0, data_key1])
|
||||
|
||||
i_col += 1
|
||||
if i_col == columns:
|
||||
i_col = 0
|
||||
i_row += 1
|
||||
nodes.clear()
|
||||
nodes.merge(nodes_copy)
|
||||
i_col += 1
|
||||
if i_col == columns:
|
||||
i_col = 0
|
||||
i_row += 1
|
||||
nodes.clear()
|
||||
nodes.merge(nodes_copy)
|
||||
|
||||
|
||||
func clear_rows() -> void:
|
||||
""" Удаляет все строки таблицы """
|
||||
var rows_count: int = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
remove_row(i_row)
|
||||
""" Удаляет все строки таблицы """
|
||||
var rows_count: int = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
remove_row(i_row)
|
||||
|
||||
|
||||
func connect_columns(dest_node: Node, event_name: String, callback: String, clmns: Array, user_data: Array) -> void:
|
||||
""" Настраивает обратные вызовы для колонок.
|
||||
:dest_node: Получатель события
|
||||
:event_name: Имя события
|
||||
:callback: Имя функции получателя события
|
||||
:clmns: Индексы колонок
|
||||
:user_data: Аргументы функции получателя события """
|
||||
var rows_count = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
for i_col in clmns:
|
||||
assert(i_col >= 0 and i_col < columns, 'ошибка: нет колонки %d' % i_col)
|
||||
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
var conn_key: String = CONNECTED_KEY_FORMAT % [i_row, i_col]
|
||||
var node = nodes[node_key]
|
||||
if nodes.has(conn_key):
|
||||
var conn = nodes[conn_key]
|
||||
var prev_callback = conn[0]
|
||||
var prev_dest_node = conn[1]
|
||||
node.disconnect(event_name, Callable(prev_dest_node, prev_callback))
|
||||
assert (OK == node.connect(event_name, Callable(dest_node, callback).bind([node] + user_data)))
|
||||
nodes[conn_key] = [callback, dest_node]
|
||||
""" Настраивает обратные вызовы для колонок.
|
||||
:dest_node: Получатель события
|
||||
:event_name: Имя события
|
||||
:callback: Имя функции получателя события
|
||||
:clmns: Индексы колонок
|
||||
:user_data: Аргументы функции получателя события """
|
||||
var rows_count = get_rows_count()
|
||||
for i_row in rows_count:
|
||||
for i_col in clmns:
|
||||
assert(i_col >= 0 and i_col < columns, 'ошибка: нет колонки %d' % i_col)
|
||||
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
var conn_key: String = CONNECTED_KEY_FORMAT % [i_row, i_col]
|
||||
var node = nodes[node_key]
|
||||
if nodes.has(conn_key):
|
||||
var conn = nodes[conn_key]
|
||||
var prev_callback = conn[0]
|
||||
var prev_dest_node = conn[1]
|
||||
node.disconnect(event_name, Callable(prev_dest_node, prev_callback))
|
||||
assert (OK == node.connect(event_name, Callable(dest_node, callback).bind([node] + user_data)))
|
||||
nodes[conn_key] = [callback, dest_node]
|
||||
|
||||
|
||||
func set_rows_text(rows: Array) -> void:
|
||||
for i_row in rows.size():
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.text = rows[i_row][i_col]
|
||||
for i_row in rows.size():
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.text = rows[i_row][i_col]
|
||||
|
||||
|
||||
func set_nodes_min_size(i_row: int, sizes: Array, key_format: String = NODE_KEY_FORMAT) -> void:
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(key_format, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.custom_minimum_size.x = sizes[i_col]
|
||||
node.size.x = sizes[i_col]
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(key_format, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
node.custom_minimum_size.x = sizes[i_col]
|
||||
node.set_deferred('size.x', sizes[i_col])
|
||||
|
||||
|
||||
func set_node_text(i_col: int, i_row: int, val: String) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].text = val
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].text = val
|
||||
|
||||
|
||||
func set_rows_state(rows: Array) -> void:
|
||||
for i_row in rows.size():
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].button_pressed = rows[i_row][i_col]
|
||||
for i_row in rows.size():
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].button_pressed = rows[i_row][i_col]
|
||||
|
||||
|
||||
func set_node_state(i_col: int, i_row: int, val: bool) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].button_pressed = val
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].button_pressed = val
|
||||
|
||||
|
||||
func set_node_frame(i_col: int, i_row: int, node_name: String, val: int) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
var sprite = node.get_node(node_name)
|
||||
sprite.frame = val
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
var node = nodes[key]
|
||||
var sprite = node.get_node(node_name)
|
||||
sprite.frame = val
|
||||
|
||||
|
||||
func set_node_editable(i_col: int, i_row: int, val: bool) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].editable = val
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].editable = val
|
||||
|
||||
|
||||
func set_node_alligment(i_col: int, i_row: int, val: int) -> void:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
if 'horizontal_alignment' in nodes[key]:
|
||||
nodes[key].horizontal_alignment = val
|
||||
elif 'alignment' in nodes[key]:
|
||||
nodes[key].alignment = val
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
if 'horizontal_alignment' in nodes[key]:
|
||||
nodes[key].horizontal_alignment = val
|
||||
elif 'alignment' in nodes[key]:
|
||||
nodes[key].alignment = val
|
||||
|
||||
|
||||
func set_row_alligments(i_row: int, aligns: Array) -> void:
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].align = aligns[i_col]
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
nodes[key].align = aligns[i_col]
|
||||
|
||||
|
||||
func get_row_text(i_row: int) -> Array:
|
||||
var row: = []
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
row.append(nodes[key].text)
|
||||
return row
|
||||
var row: = []
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
row.append(nodes[key].text)
|
||||
return row
|
||||
|
||||
|
||||
func set_row_text(i_row: int, row: Array, i_begin: int = 0, key_format: String = NODE_KEY_FORMAT) -> void:
|
||||
assert(i_begin >= 0)
|
||||
assert((columns - i_begin) <= row.size())
|
||||
for i_col in columns - i_begin:
|
||||
var key: = get_node_key(key_format, i_col + i_begin, i_row)
|
||||
nodes[key].text = row[i_col]
|
||||
assert(i_begin >= 0)
|
||||
assert((columns - i_begin) <= row.size())
|
||||
for i_col in columns - i_begin:
|
||||
var key: = get_node_key(key_format, i_col + i_begin, i_row)
|
||||
nodes[key].text = row[i_col]
|
||||
|
||||
|
||||
func get_rows_text() -> Array:
|
||||
var rows_count: = get_rows_count()
|
||||
var rows: = []
|
||||
for i_row in rows_count:
|
||||
var row = get_row_text(i_row)
|
||||
rows.append(row)
|
||||
return rows
|
||||
var rows_count: = get_rows_count()
|
||||
var rows: = []
|
||||
for i_row in rows_count:
|
||||
var row = get_row_text(i_row)
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
||||
func get_row(i_row: int) -> Array:
|
||||
var row: = []
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
row.append(nodes[key])
|
||||
return row
|
||||
var row: = []
|
||||
for i_col in columns:
|
||||
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
|
||||
row.append(nodes[key])
|
||||
return row
|
||||
|
||||
|
||||
func get_node_rect(i_col: int, i_row: int, rect: Array, key_format: String = NODE_KEY_FORMAT) -> void:
|
||||
assert(rect.size() >= 4, 'ошибка: мало элементов для возврата результата')
|
||||
var key: = get_node_key(key_format, i_col, i_row)
|
||||
var cell = nodes[key]
|
||||
rect[0] = cell.position.x
|
||||
rect[1] = cell.position.y
|
||||
rect[2] = cell.size.x
|
||||
rect[3] = cell.size.y
|
||||
assert(rect.size() >= 4, 'ошибка: мало элементов для возврата результата')
|
||||
var key: = get_node_key(key_format, i_col, i_row)
|
||||
var cell = nodes[key]
|
||||
rect[0] = cell.position.x
|
||||
rect[1] = cell.position.y
|
||||
rect[2] = cell.size.x
|
||||
rect[3] = cell.size.y
|
||||
|
||||
|
||||
func get_row_rect(i_row: int, rect: Array, key_format: String = NODE_KEY_FORMAT) -> void:
|
||||
assert(rect.size() >= 4, 'ошибка: мало элементов для возврата результата')
|
||||
var cell0 = nodes[get_node_key(key_format, 0, i_row)]
|
||||
var cell1 = nodes[get_node_key(key_format, columns - 1, i_row)]
|
||||
rect[0] = cell0.position.x + scroll_adj.x
|
||||
rect[1] = cell0.position.y + scroll_adj.y
|
||||
rect[2] = (cell1.position.x - cell0.position.x) + cell1.size.x
|
||||
rect[3] = cell0.size.y
|
||||
assert(rect.size() >= 4, 'ошибка: мало элементов для возврата результата')
|
||||
var cell0 = nodes[get_node_key(key_format, 0, i_row)]
|
||||
var cell1 = nodes[get_node_key(key_format, columns - 1, i_row)]
|
||||
rect[0] = cell0.position.x + scroll_adj.x
|
||||
rect[1] = cell0.position.y + scroll_adj.y
|
||||
rect[2] = (cell1.position.x - cell0.position.x) + cell1.size.x
|
||||
rect[3] = cell0.size.y
|
||||
|
||||
Reference in New Issue
Block a user