Merge pull request 'Доработка. Теперь только для Godot4' (#1) from sasha80/imi_skysens:master into master

Reviewed-on: http://gitea.srez.local:3000/MaD_CaT/imi_skysens/pulls/1
This commit is contained in:
MaD_CaT
2023-06-13 14:26:31 +03:00
27 changed files with 934 additions and 886 deletions

1
.gitignore vendored
View File

@@ -18,3 +18,4 @@ mono_crash.*.json
/build/
/html/
/commit.gd
/.godot/

33
DejaVuSans.ttf.import Normal file
View File

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bxsp7iobid6r8"
path="res://.godot/imported/DejaVuSans.ttf-9b3237397afd1f73977bc4b24b10964d.fontdata"
[deps]
source_file="res://DejaVuSans.ttf"
dest_files=["res://.godot/imported/DejaVuSans.ttf-9b3237397afd1f73977bc4b24b10964d.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bmpyjokeeeq8l"
path="res://.godot/imported/DejaVuSansCondensed.ttf-cf82d94147dd2c629554494e5fd511f4.fontdata"
[deps]
source_file="res://DejaVuSansCondensed.ttf"
dest_files=["res://.godot/imported/DejaVuSansCondensed.ttf-cf82d94147dd2c629554494e5fd511f4.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -1,10 +1,10 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://nine-patch.png" type="Texture" id=1]
[ext_resource path="res://nine-patch.png" type="Texture2D" id=1]
[node name="NinePatchRect" type="NinePatchRect"]
margin_right = 42.0
margin_bottom = 33.0
offset_right = 42.0
offset_bottom = 33.0
texture = ExtResource( 1 )
draw_center = false
patch_margin_left = 8

View File

@@ -1,12 +1,11 @@
extends Node2D
export (String, FILE) var MENU_SCENE_FILE = 'res://меню.tscn'
const MENU_SCENE_FILE: String = 'res://меню.tscn'
# Адрес имитатора
const MAIN_ADDR = [ '10.1.1.5', 50005 ]
const DST_ADDR = [ '10.1.1.79', 50079 ]
const MAIN_ADDR = [ 'localhost', 50005 ]
const DST_ADDR = [ 'localhost', 50079 ]
const TABLE_ROW_HIGHT = 34 # Высота строки таблицы в пикселях

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/edit-add-0.png-caa21a9bbc05466cba52fa8d3bc8c950.stex"
type="CompressedTexture2D"
uid="uid://cex4jiu1pcj3x"
path="res://.godot/imported/edit-add-0.png-caa21a9bbc05466cba52fa8d3bc8c950.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://edit-add-0.png"
dest_files=[ "res://.import/edit-add-0.png-caa21a9bbc05466cba52fa8d3bc8c950.stex" ]
dest_files=["res://.godot/imported/edit-add-0.png-caa21a9bbc05466cba52fa8d3bc8c950.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/edit-add-1.png-8bbd18fd95c5b5bd62e9c26d8f22f02b.stex"
type="CompressedTexture2D"
uid="uid://cx746np1wexnd"
path="res://.godot/imported/edit-add-1.png-8bbd18fd95c5b5bd62e9c26d8f22f02b.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://edit-add-1.png"
dest_files=[ "res://.import/edit-add-1.png-8bbd18fd95c5b5bd62e9c26d8f22f02b.stex" ]
dest_files=["res://.godot/imported/edit-add-1.png-8bbd18fd95c5b5bd62e9c26d8f22f02b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
type="CompressedTexture2D"
uid="uid://bwqivxm0vit47"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[gd_resource type="FontFile" load_steps=2 format=2]
[ext_resource path="res://DejaVuSansCondensed.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://DejaVuSansCondensed.ttf" type="FontFile" id=1]
[resource]
size = 20

16
main.gd
View File

@@ -1,22 +1,22 @@
extends Node2D
var sock = PacketPeerUDP.new()
onready var header_threads = get_node('tabs/threats/header_t')
onready var table_threads = get_node('tabs/threats/table_t')
onready var btn_add_threads = get_node('tabs/threats/btn_add')
onready var btn_del_threads = get_node('tabs/threats/btn_del')
@onready var header_threads = get_node('tabs/threats/header_t')
@onready var table_threads = get_node('tabs/threats/table_t')
@onready var btn_add_threads = get_node('tabs/threats/btn_add')
@onready var btn_del_threads = get_node('tabs/threats/btn_del')
onready var header_pomehi = get_node('tabs/pomehi/header_p')
onready var table_pomehi = get_node('tabs/pomehi/table_p')
@onready var header_pomehi = get_node('tabs/pomehi/header_p')
@onready var table_pomehi = get_node('tabs/pomehi/table_p')
# Called when the node enters the scene tree for the first time.
func _ready():
sock.listen(Consts.MAIN_ADDR[1], Consts.MAIN_ADDR[0])
sock.bind(Consts.MAIN_ADDR[1], Consts.MAIN_ADDR[0])
sock.set_dest_address(Consts.DST_ADDR[0], Consts.DST_ADDR[1])
Threats.init_treats(header_threads, table_threads, btn_add_threads, btn_del_threads)
Pomehi.init_pomehi(header_pomehi, table_pomehi)
var timer = Timer.new()
timer.connect('timeout',self,'on_timeout',[])
timer.connect('timeout', Callable(self, 'on_timeout').bind())
add_child(timer) #to process
timer.start(1) #to start

View File

@@ -1,7 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[gd_resource type="Environment" load_steps=2 format=3 uid="uid://sjt0ts5hhqrl"]
[sub_resource type="ProceduralSky" id=1]
[sub_resource type="Sky" id="1"]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
sky = SubResource("1")

View File

@@ -1,69 +1,66 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=5 format=3 uid="uid://87gtvqd7bbje"]
[ext_resource path="res://table.gd" type="Script" id=1]
[ext_resource path="res://main.gd" type="Script" id=2]
[ext_resource path="res://edit-add-0.png" type="Texture" id=3]
[ext_resource path="res://edit-add-1.png" type="Texture" id=4]
[ext_resource type="Script" path="res://main.gd" id="1_kt06w"]
[ext_resource type="Script" path="res://table.gd" id="2_k7rc6"]
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_pruca"]
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_3d2wd"]
[node name="main" type="Node2D"]
script = ExtResource( 2 )
script = ExtResource("1_kt06w")
[node name="tabs" type="TabContainer" parent="."]
margin_right = 1594.0
margin_bottom = 897.0
tab_align = 0
offset_right = 1594.0
offset_bottom = 897.0
[node name="threats" type="Panel" parent="tabs"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 42.0
margin_right = -4.0
margin_bottom = -4.0
layout_mode = 2
[node name="table_t" type="GridContainer" parent="tabs/threats"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 100.0
margin_right = 1.0
margin_bottom = 10.0
script = ExtResource( 1 )
offset_top = 100.0
offset_right = 1.0
offset_bottom = 10.0
script = ExtResource("2_k7rc6")
[node name="header_t" type="GridContainer" parent="tabs/threats"]
margin_top = 57.0
margin_right = 1584.0
margin_bottom = 96.0
script = ExtResource( 1 )
layout_mode = 0
offset_top = 57.0
offset_right = 1584.0
offset_bottom = 96.0
script = ExtResource("2_k7rc6")
[node name="btn_add" type="TextureButton" parent="tabs/threats"]
margin_left = 1533.0
margin_top = -2.0
margin_right = 1581.0
margin_bottom = 46.0
texture_normal = ExtResource( 3 )
texture_pressed = ExtResource( 4 )
layout_mode = 0
offset_left = 1533.0
offset_top = -2.0
offset_right = 1581.0
offset_bottom = 46.0
texture_normal = ExtResource("3_pruca")
texture_pressed = ExtResource("4_3d2wd")
[node name="btn_del" type="TextureButton" parent="tabs/threats"]
margin_left = 1487.0
margin_top = 3.0
margin_right = 1527.0
margin_bottom = 43.0
layout_mode = 0
offset_left = 1487.0
offset_top = 3.0
offset_right = 1527.0
offset_bottom = 43.0
[node name="pomehi" type="Panel" parent="tabs"]
visible = false
margin_left = 4.0
margin_top = 42.0
margin_right = 1590.0
margin_bottom = 893.0
layout_mode = 2
[node name="table_p" type="GridContainer" parent="tabs/pomehi"]
margin_top = 100.0
margin_right = 1587.0
margin_bottom = 861.0
script = ExtResource( 1 )
layout_mode = 0
offset_top = 100.0
offset_right = 1587.0
offset_bottom = 861.0
script = ExtResource("2_k7rc6")
[node name="header_p" type="GridContainer" parent="tabs/pomehi"]
margin_top = 57.0
margin_right = 32.0
margin_bottom = 96.0
script = ExtResource( 1 )
layout_mode = 0
offset_top = 57.0
offset_right = 32.0
offset_bottom = 96.0
script = ExtResource("2_k7rc6")

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/nine-patch.png-57e7212ba67c39e7fc9011f4afa7baae.stex"
type="CompressedTexture2D"
uid="uid://bkjlwivmtq1rp"
path="res://.godot/imported/nine-patch.png-57e7212ba67c39e7fc9011f4afa7baae.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://nine-patch.png"
dest_files=[ "res://.import/nine-patch.png-57e7212ba67c39e7fc9011f4afa7baae.stex" ]
dest_files=["res://.godot/imported/nine-patch.png-57e7212ba67c39e7fc9011f4afa7baae.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -14,9 +14,9 @@ const TableCellType6 = preload('res://кнопка-5.tscn')
# Индекс колонки: 0 1 2 3 4 5 6
const TABLE_HEADERS = [ 'Индекс', 'Состояние', 'Помеха', 'Мощность', 'Кур. уг.', 'Частота', 'Ш. диап.']
const TABLE_HEADER_TYPES = [ TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4]
const TABLE_HEADER_ALIGNMENTS = [ HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER]
const TABLE_HEADER_ALIGNMENTS = [ HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
const TABLE_ROW_TYPES = [ TableCellType1, TableCellType6, TableCellType1, TableCellType1, TableCellType1, TableCellType1, TableCellType1]
const TABLE_ROW_ALIGNMENTS = [ HALIGN_CENTER, HALIGN_LEFT, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER]
const TABLE_ROW_ALIGNMENTS = [ HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
const TABLE_COLUMN_SIZES = [ 82, 120, 82, 100, 82, 90, 150]
const COLUMN_ISPP = 0 # Индекс сейанса постановки помехи
@@ -59,23 +59,22 @@ class Pomeha:
var width : String
func _init(args : Array):
ispp = String(args[0])
krp = String(args[1])
powp = String(args[2])
kni = String(args[3])
freq = String(args[4])
width = String(args[5])
ispp = '%s' % args[0]
krp = '%s' % args[1]
powp = '%s' % args[2]
kni = '%s' % args[3]
freq = '%s' % args[4]
width = '%s' % args[5]
func update_rows():
var new_rows: Array = []
new_rows.append(String(ispp))
new_rows.append(String(svk))
new_rows.append(String(krp))
new_rows.append(String(powp))
new_rows.append(String(kni))
new_rows.append(String(freq))
new_rows.append(String(width))
new_rows.append('%s' % ispp)
new_rows.append('%s' % svk)
new_rows.append('%s' % krp)
new_rows.append('%s' % powp)
new_rows.append('%s' % kni)
new_rows.append('%s' % freq)
new_rows.append('%s' % width)
return new_rows
@@ -106,13 +105,13 @@ func init_pomehi(header, table): # Инициализация вкладк
init_table(header, TABLE_COLUMN_SIZES)
init_table(table, TABLE_COLUMN_SIZES)
table.align_to_left_bottom(header, Vector2(0, 2))
table.connect('row_pressed', self, 'on_row_pressed', [table])
table.connect('row_pressed', Callable(self, 'on_row_pressed').bind(table))
table.set_callbacks(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [table])
func on_btn_add(table):
var pomeha : = Pomeha.new([1,2,3,4,5,6])
pomehi[String(1)] = pomeha
pomehi['%d' % 1] = pomeha
var row = pomeha.update_rows()
table.add_row(TABLE_ROW_TYPES)
table.set_row_text(table.get_rows_count()-1, row)

View File

@@ -6,12 +6,13 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
config_version=5
[application]
config/name="Imi Skysens"
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.1")
config/icon="res://icon.png"
[autoload]
@@ -24,15 +25,14 @@ Tools="*res://tools.gd"
[display]
window/size/width=1600
window/size/height=900
window/size/viewport_width=1600
window/size/viewport_height=900
window/stretch/mode="2d"
window/stretch/aspect="keep"
[gui]
common/drop_mouse_on_gui_input_disabled=true
theme/custom_font="res://main-font.tres"
common/drop_mouse_on_gui_input_disabled=true
[physics]
@@ -40,4 +40,4 @@ common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://main.tres"
environment/defaults/default_environment="res://main.tres"

100
table.gd
View File

@@ -1,10 +1,10 @@
tool
@tool
extends GridContainer
export (Color) var _selector_color = Color(1.0, 1.0, 1.0, 1.0)
export (int, 1, 256) var columns_count = 1 setget _set_columns_count
export (int, 1, 256) var rows_count = 1 setget _set_rows_count
export (String, FILE) var node_type_file = 'res://ячейка-1.tscn'
@export var _selector_color: Color = Color(1.0, 1.0, 1.0, 1.0)
@export var columns_count: int = 1: set = _set_columns_count
@export var rows_count: int = 1: set = _set_rows_count
@export var node_type_file: String = 'res://ячейка-1.tscn'
const Selector = preload('res://Selector.tscn')
const INDEX_FORMAT = '%02d_%02d'
const NODE_PREFIX = 'NODE_'
@@ -18,20 +18,20 @@ const CONNECTED_KEY_FORMAT = CONN_PREFIX + INDEX_FORMAT
const ROW_SELECTOR_KEY_FORMAT = SLCT_PREFIX + INDEX_FORMAT
var nodes: = {}
var selector_color_proc: FuncRef
var selector_size_proc: FuncRef
var selector_color_proc: Callable
var selector_size_proc: Callable
signal row_pressed(i_row) # Вызывается при нажатии кнопкой мыши на строку
const MAX_INDEX = 99 # Максимальное значение индекса для колонки и строки. Связано с форматом ключа
func align_to_left_bottom(header, gap: = Vector2(0, 0)):
""" Выравнивает по нижнему левому углу. Используется для выравнивания по заголовку """
rect_position.x = header.rect_position.x + gap.x
rect_position.y = header.rect_position.y + header.rect_size.y + gap.y
position.x = header.position.x + gap.x
position.y = header.position.y + header.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_columns_count(cc: int):
@@ -69,13 +69,13 @@ func get_node_property(i_col: int, i_row: int, pname: String):
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])
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)
assert(tokens.size() == 3) #,'ошибка: неверный ключ: \"%s\"' % key)
return [int(tokens[2]), int(tokens[1])]
@@ -94,25 +94,25 @@ func _input(event) -> void:
if event is InputEventMouseButton:
if not event.pressed:
return
if event.position.x < rect_position.x:
if event.position.x < position.x:
emit_signal('focus_exited')
return
if event.position.x > (rect_position.x + rect_size.x):
if event.position.x > (position.x + size.x):
emit_signal('focus_exited')
return
if event.position.y < rect_position.y:
if event.position.y < position.y:
emit_signal('focus_exited')
return
if event.position.y > (rect_position.y + rect_size.y):
if event.position.y > (position.y + size.y):
emit_signal('focus_exited')
return
var rows_count: = get_rows_count()
var parent = get_parent()
var y0 = parent.rect_position.y
var y0 = parent.position.y
for i_row in rows_count:
var rect = [0, 0, 0, 0]
get_node_rect(0, i_row, rect)
var y = rect[1] + rect_position.y + y0
var y = rect[1] + position.y + y0
if event.position.y < y:
continue
if event.position.y > (y + rect[3]):
@@ -122,13 +122,9 @@ func _input(event) -> void:
func _init() -> void:
selector_color_proc = FuncRef.new()
selector_color_proc.set_instance(self)
selector_color_proc.function = 'default_selector_color_proc'
selector_color_proc = Callable(self, 'default_selector_color_proc')
assert(selector_color_proc.is_valid())
selector_size_proc = FuncRef.new()
selector_size_proc.set_instance(self)
selector_size_proc.function = 'default_selector_size_proc'
selector_size_proc = Callable(self, 'default_selector_size_proc')
assert(selector_size_proc.is_valid())
@@ -137,22 +133,20 @@ func default_selector_color_proc(i_row: int):
func set_selector_color_proc(instance: Object, function: String) -> void:
selector_color_proc.set_instance(instance)
selector_color_proc.function = function
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.set_instance(instance)
selector_size_proc.function = function
selector_size_proc = Callable(instance, function)
assert(selector_size_proc.is_valid())
func default_selector_size_proc(i_row: int, rect: Array) -> void:
get_node_rect(0, i_row, rect)
rect[0] = rect[0] + rect_position.x - 1
rect[1] = rect[1] + rect_position.y - 4
rect[2] = rect_size.x + 2
rect[0] = rect[0] + position.x - 1
rect[1] = rect[1] + position.y - 4
rect[2] = size.x + 2
rect[3] = rect[3] + 8
@@ -171,14 +165,14 @@ func set_row_selected(i_row: int, selected: bool = true) -> void:
selector.queue_free()
nodes.erase(key)
elif (not nodes.has(key)) and selected:
var selector = Selector.instance()
var selector = Selector.instantiate()
var rect: = [0, 0, 0, 0]
selector_size_proc.call_func(i_row, rect)
selector.rect_position.x = rect[0]
selector.rect_position.y = rect[1]
selector.rect_size.x = rect[2]
selector.rect_size.y = rect[3]
selector.modulate = selector_color_proc.call_func(i_row)
selector_size_proc.call(i_row, rect)
selector.position.x = rect[0]
selector.position.y = rect[1]
selector.size.x = rect[2]
selector.size.y = rect[3]
selector.modulate = selector_color_proc.call(i_row)
nodes[key] = selector
parent.add_child(selector)
@@ -218,7 +212,7 @@ func add_row(row_types: Array) -> void:
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].instance()
var node = row_types[i_col].instantiate()
var key: String = NODE_KEY_FORMAT % [rows_count, i_col]
node.name = key
add_child(node)
@@ -253,14 +247,14 @@ func remove_row(i_row: int):
var conn = nodes[conn_key]
var callback = conn[0]
var dest_node = conn[1]
node.disconnect('pressed', dest_node, callback)
node.disconnect('pressed', Callable(dest_node, callback))
nodes.erase(conn_key)
func rehash(swaps: Array):
""" Переназначает ключи в соответствии с размерами таблицы.
После вызова swaps содержит массив пар [<прежний ключ>, <текущий ключ>] """
assert(not swaps.size(), 'ошибка: swaps не пустой')
assert(not swaps.size()) #,'ошибка: swaps не пустой')
var nodes_copy = {}
var i_col = 0
var i_row = 0
@@ -312,7 +306,7 @@ func set_callbacks(dest_node: Node, event_name: String, callback: String, clmns:
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)
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]
@@ -320,8 +314,8 @@ func set_callbacks(dest_node: Node, event_name: String, callback: String, clmns:
var conn = nodes[conn_key]
var prev_callback = conn[0]
var prev_dest_node = conn[1]
node.disconnect(event_name, prev_dest_node, prev_callback)
assert (OK == node.connect(event_name, dest_node, callback, [node] + user_data))
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]
@@ -337,8 +331,8 @@ func set_nodes_min_size(i_row: int, sizes: Array) -> void:
for i_col in columns:
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
var node = nodes[key]
node.rect_min_size.x = sizes[i_col]
node.rect_size.x = sizes[i_col]
node.custom_minimum_size.x = sizes[i_col]
node.size.x = sizes[i_col]
func set_node_text(i_col: int, i_row: int, val: String) -> void:
@@ -350,12 +344,12 @@ 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[name].pressed = rows[i_row][i_col]
nodes[name].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].pressed = val
nodes[key].button_pressed = val
func set_node_frame(i_col: int, i_row: int, name: String, val: int) -> void:
@@ -413,10 +407,10 @@ func get_row(i_row: int) -> Array:
func get_node_rect(i_col: int, i_row: int, rect: Array) -> void:
assert(rect.size() >= 4, 'ошибка: мало элементов для возврата результата')
assert(rect.size() >= 4) #,'ошибка: мало элементов для возврата результата')
var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row)
var cell = nodes[key]
rect[0] = cell.rect_position.x
rect[1] = cell.rect_position.y
rect[2] = cell.rect_size.x
rect[3] = cell.rect_size.y
rect[0] = cell.position.x
rect[1] = cell.position.y
rect[2] = cell.size.x
rect[3] = cell.size.y

View File

@@ -12,11 +12,11 @@ const TableCellType5 = preload('res://ячейка-2.tscn')
const TableCellType6 = preload('res://кнопка-5.tscn')
# Индекс колонки: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
const TABLE_HEADERS = ['ID Цели', 'Кур. уг.', 'Частота', 'Ш. диап.', 'Ампл.', 'T обнар.', 'Мод.', 'Реж. см. F', 'Ск. пер.', 'Протокол', 'Ст. дол.', 'Ст. шир.', 'Cт. выс.', 'Тек. дол.', 'Тек. шир.', 'Тек. выс.', ]
const TABLE_HEADERS = ['ID Цели', 'Курc.град', 'Частота', 'Ш. диап.', 'Ампл.', 'T обнар.', 'Мод.', 'Реж. см. F', 'Ск. пер.', 'Протокол', 'Ст. дол.', 'Ст. шир.', 'Cт. выс.', 'Тек. дол.', 'Тек. шир.', 'Тек. выс.', ]
const TABLE_HEADER_TYPES = [ TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4, TableCellType4]
const TABLE_HEADER_ALIGNMENTS = [ HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER]
const TABLE_HEADER_ALIGNMENTS = [ HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
const TABLE_ROW_TYPES = [ TableCellType1, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType6, TableCellType6, TableCellType5, TableCellType6, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType5]
const TABLE_ROW_ALIGNMENTS = [ HALIGN_CENTER, HALIGN_LEFT, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER, HALIGN_CENTER]
const TABLE_ROW_ALIGNMENTS = [ HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_LEFT, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
const TABLE_COLUMN_SIZES = [ 82, 82, 82, 82, 82, 90, 150, 150, 80, 150, 82, 82, 82, 82, 82, 82]
const COLUMN_ID = 0 # Идентификатор цели
@@ -142,7 +142,7 @@ class Threat:
func _check_value(val):
if val[1]:
return String(val[0])
return '%s' % val[0]
else:
return ''
@@ -234,7 +234,7 @@ class Threat:
row.lat[1] = Tools.check_empty(value)
return value
func set_alt(val):
func set_alt_pressed(val):
var value = float(val)
value = Tools.check_len(val, value)
row.alt[0] = value
@@ -269,11 +269,11 @@ func init_treats(header, table, btn_add, btn_del): # Инициализац
init_table(header, TABLE_COLUMN_SIZES)
init_table(table, TABLE_COLUMN_SIZES)
table.align_to_left_bottom(header, Vector2(0, 2))
table.connect('row_pressed', self, 'on_row_pressed', [table])
table.set_callbacks(self, 'text_entered', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [table])
table.connect('row_pressed', Callable(self, 'on_row_pressed').bind(table))
table.set_callbacks(self, 'text_submitted', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [table])
table.set_callbacks(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [table])
btn_add.connect('button_up', self, 'on_btn_add', [table])
btn_del.connect('button_up', self, 'on_btn_del', [table])
btn_add.connect('button_up', Callable(self, 'on_btn_add').bind(table))
btn_del.connect('button_up', Callable(self, 'on_btn_del').bind(table))
func selector_color_proc(_i_row: int):
@@ -346,7 +346,7 @@ func set_value(val : String, treat_id : String, column : int):
COLUMN_LON:
return treat.set_lat(val)
COLUMN_ALT:
return treat.set_alt(val)
return treat.set_alt_pressed(val)
func on_row_pressed(i_row: int, table):
@@ -357,12 +357,12 @@ func on_row_pressed(i_row: int, table):
func on_btn_add(table):
var id = pop_id()
var threat : = Threat.new(id)
treats[String(id)] = threat
treats['%d' % id] = threat
var row = threat.update_rows()
table.add_row(TABLE_ROW_TYPES)
table.set_row_text(table.get_rows_count()-1, row)
init_opt_btns(table.get_rows_count()-1, table)
table.set_callbacks(self, 'text_entered', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [])
table.set_callbacks(self, 'text_submitted', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [])
table.set_callbacks(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [])
@@ -380,7 +380,7 @@ func pop_id():
var id = 0
if len(id_array):
id = id_array[0]
id_array.remove(0)
id_array.remove_at(0)
return id
@@ -398,6 +398,6 @@ func get_threats_data():
for key in treats:
var data = treats[key].get_data()
data_to_json['mis'].append(data)
var json = to_json(data_to_json)
var pac = json.to_utf8()
var json = JSON.new().stringify(data_to_json)
var pac = json.to_utf8_buffer()
return pac

View File

@@ -4,12 +4,12 @@
bg_color = Color( 1, 0.596078, 0.4, 1 )
[node name="heder" type="Label"]
margin_right = 120.0
margin_bottom = 30.0
offset_right = 120.0
offset_bottom = 30.0
size_flags_horizontal = 15
size_flags_vertical = 15
custom_colors/font_color = Color( 0.0313726, 0.105882, 0.184314, 1 )
custom_styles/normal = SubResource( 1 )
theme_override_colors/font_color = Color( 0.0313726, 0.105882, 0.184314, 1 )
theme_override_styles/normal = SubResource( 1 )
align = 1
valign = 1
clip_text = true

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/индикатор-1-0.png-fc0a1949f86e54aad24513db3cf620a1.stex"
type="CompressedTexture2D"
uid="uid://dag8n0gknjwak"
path="res://.godot/imported/индикатор-1-0.png-fc0a1949f86e54aad24513db3cf620a1.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://индикатор-1-0.png"
dest_files=[ "res://.import/индикатор-1-0.png-fc0a1949f86e54aad24513db3cf620a1.stex" ]
dest_files=["res://.godot/imported/индикатор-1-0.png-fc0a1949f86e54aad24513db3cf620a1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/индикатор-1-1.png-8b27c7b615854227f833f39bac77ddc2.stex"
type="CompressedTexture2D"
uid="uid://b3ext3w4ftgg2"
path="res://.godot/imported/индикатор-1-1.png-8b27c7b615854227f833f39bac77ddc2.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://индикатор-1-1.png"
dest_files=[ "res://.import/индикатор-1-1.png-8b27c7b615854227f833f39bac77ddc2.stex" ]
dest_files=["res://.godot/imported/индикатор-1-1.png-8b27c7b615854227f833f39bac77ddc2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/кнопка-3-0.png-5f27389cf7d8b3614e031e6b8d168b3c.stex"
type="CompressedTexture2D"
uid="uid://cf0jds8v6lqin"
path="res://.godot/imported/кнопка-3-0.png-5f27389cf7d8b3614e031e6b8d168b3c.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://кнопка-3-0.png"
dest_files=[ "res://.import/кнопка-3-0.png-5f27389cf7d8b3614e031e6b8d168b3c.stex" ]
dest_files=["res://.godot/imported/кнопка-3-0.png-5f27389cf7d8b3614e031e6b8d168b3c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,8 +1,9 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/кнопка-3-1.png-d6f5584c24056a03a792e757c3c765b0.stex"
type="CompressedTexture2D"
uid="uid://ddxxauugcc14e"
path="res://.godot/imported/кнопка-3-1.png-d6f5584c24056a03a792e757c3c765b0.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://кнопка-3-1.png"
dest_files=[ "res://.import/кнопка-3-1.png-d6f5584c24056a03a792e757c3c765b0.stex" ]
dest_files=["res://.godot/imported/кнопка-3-1.png-d6f5584c24056a03a792e757c3c765b0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
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/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,12 +1,12 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://кнопка-3-1.png" type="Texture" id=1]
[ext_resource path="res://кнопка-3-0.png" type="Texture" id=2]
[ext_resource path="res://кнопка-3-1.png" type="Texture2D" id=1]
[ext_resource path="res://кнопка-3-0.png" type="Texture2D" id=2]
[node name="TextureButton" type="TextureButton"]
modulate = Color( 1.5, 1.5, 1.5, 1 )
margin_right = 140.0
margin_bottom = 34.0
offset_right = 140.0
offset_bottom = 34.0
toggle_mode = true
action_mode = 0
texture_normal = ExtResource( 2 )

View File

@@ -1,12 +1,12 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://индикатор-1-1.png" type="Texture" id=1]
[ext_resource path="res://индикатор-1-0.png" type="Texture" id=2]
[ext_resource path="res://индикатор-1-1.png" type="Texture2D" id=1]
[ext_resource path="res://индикатор-1-0.png" type="Texture2D" id=2]
[node name="indicator_1" type="TextureButton"]
modulate = Color( 1, 0.596078, 0.4, 1 )
margin_right = 35.0
margin_bottom = 29.0
offset_right = 35.0
offset_bottom = 29.0
toggle_mode = true
button_mask = 0
texture_normal = ExtResource( 2 )

View File

@@ -1,5 +1,5 @@
[gd_scene format=2]
[node name="OptionButton" type="OptionButton"]
margin_right = 80.0
margin_bottom = 34.0
offset_right = 80.0
offset_bottom = 34.0

View File

@@ -1,9 +1,9 @@
[gd_scene format=2]
[node name="Label" type="Label"]
margin_right = 122.0
margin_bottom = 34.0
custom_colors/font_color = Color( 1, 0.596078, 0.4, 1 )
offset_right = 122.0
offset_bottom = 34.0
theme_override_colors/font_color = Color( 1, 0.596078, 0.4, 1 )
align = 1
valign = 1
clip_text = true

View File

@@ -1,11 +1,11 @@
[gd_scene format=2]
[node name="LineEdit" type="LineEdit"]
margin_right = 82.0
margin_bottom = 34.0
custom_colors/font_color = Color( 1, 0.596078, 0.4, 1 )
offset_right = 82.0
offset_bottom = 34.0
theme_override_colors/font_color = Color( 1, 0.596078, 0.4, 1 )
context_menu_enabled = false
shortcut_keys_enabled = false
middle_mouse_paste_enabled = false
caret_blink = true
caret_blink_speed = 0.13
caret_blink_interval = 0.13