Доработка. Колонка со статусом выполнения помехи для конкретной цели. (замечание комиссии)
This commit is contained in:
23
scenes/frame-threats/emit-led.tscn
Normal file
23
scenes/frame-threats/emit-led.tscn
Normal file
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://d012h4hxf2anf"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b3woliae871je" path="res://data/отметка-неопред.png" id="1_0a4l0"]
|
||||
|
||||
[node name="emit-led" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="texture-led" type="TextureButton" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 26.0
|
||||
offset_top = 11.0
|
||||
offset_right = 3.0
|
||||
offset_bottom = -12.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture_normal = ExtResource("1_0a4l0")
|
||||
@@ -35,5 +35,5 @@ script = ExtResource("2_empn3")
|
||||
|
||||
[node name="table" type="GridContainer" parent="scroll"]
|
||||
layout_mode = 2
|
||||
columns = 4
|
||||
columns = 5
|
||||
script = ExtResource("3_4bupu")
|
||||
|
||||
@@ -5,14 +5,16 @@ class_name scroll_threats extends ScrollContainer
|
||||
|
||||
const CellLineEdit = preload('res://table/ячейка-2.tscn') ## Ячейка таблицы.
|
||||
const TableHeader = preload('res://table/header.tscn') ## Ячейка заголовок таблицы.
|
||||
const EmitLed = preload('res://scenes/frame-threats/emit-led.tscn') ## Ячейка заголовок таблицы.
|
||||
|
||||
const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader, TableHeader , TableHeader ] ## Описание ряда заголовка.
|
||||
const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, EmitLed ] ## Описание ряда.
|
||||
const TABLE_COLUMN_PARAM = ['id', 'aoa', 'freq', 'proto', 'emit' ] ## Параметры цели отображаемые в таблице.
|
||||
const TABLE_HEADERS_TEXT = ['№', 'Пеленг', 'Частота, МГц', 'Протокол', 'Помеха' ] ## Заголовки таблицы.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 70, 110, 140, 65] ## Ширины колонок.
|
||||
|
||||
const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader, TableHeader ] ## Описание ряда заголовка.
|
||||
const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit ] ## Описание ряда.
|
||||
const TABLE_COLUMN_PARAM = ['id', 'aoa', 'freq', 'proto' ] ## Параметры цели отображаемые в таблице.
|
||||
const TABLE_HEADERS_TEXT = ['№', 'Пеленг', 'Частота, МГц', 'Протокол' ] ## Заголовки таблицы.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 145, 145, 90 ] ## Ширины колонок.
|
||||
|
||||
const TABLE_TEXT_ROWS = 4
|
||||
const EMIT_STATE_COL = 4
|
||||
|
||||
## Снимает выделение цели.
|
||||
func on_rto_threat_unsel(_th_id): $table.clear_rows_selected()
|
||||
@@ -63,6 +65,17 @@ func on_threat_update(th, table_index: Dictionary):
|
||||
var row = map_th_to_row(th)
|
||||
var i_row = table_index[th.id]
|
||||
$table.set_row_text(i_row, row)
|
||||
var emit_node = $table.get_node2(EMIT_STATE_COL, i_row)
|
||||
var emit_txr = emit_node.get_node('texture-led')
|
||||
if th.emit_state == 0:
|
||||
emit_txr.visible = false
|
||||
elif th.emit_state == 1:
|
||||
emit_txr.visible = true
|
||||
emit_txr.self_modulate = Color.ORANGE
|
||||
elif th.emit_state == 2:
|
||||
emit_txr.visible = true
|
||||
emit_txr.self_modulate = Color.RED
|
||||
|
||||
|
||||
|
||||
## Обрабатывает сигнал [b]threat_lost[/b].
|
||||
@@ -78,7 +91,7 @@ func on_threat_new(th, table_index):
|
||||
$table.add_row(TABLE_ROW)
|
||||
var row = map_th_to_row(th)
|
||||
$table.set_row_text(i_row, row)
|
||||
$table.set_row_editable(i_row, false)
|
||||
disable_edit($table, TABLE_TEXT_ROWS, i_row)
|
||||
$table.set_node_user_data(0, i_row, th)
|
||||
table_index[th.id] = i_row
|
||||
|
||||
@@ -86,10 +99,11 @@ func on_threat_new(th, table_index):
|
||||
## Преобразует цель в строку таблицы.
|
||||
func map_th_to_row(th) -> Array:
|
||||
var row: = Array()
|
||||
row.resize(TABLE_COLUMN_PARAM.size())
|
||||
row.resize(TABLE_TEXT_ROWS)
|
||||
var i_col: int = 0
|
||||
for param_name in TABLE_COLUMN_PARAM:
|
||||
var val = th.get(param_name)
|
||||
if val == null: continue
|
||||
row[i_col] = '%0.1f' % val if val is float else '%s' % val
|
||||
if not th.fflags[param_name]:
|
||||
row[i_col] = ''
|
||||
@@ -104,3 +118,13 @@ func on_rto_threat_sel(th_id, tbl):
|
||||
if node.text.to_int() == th_id:
|
||||
row_pressed(i)
|
||||
break
|
||||
|
||||
|
||||
## Отключает возможность редактирования LineEdit в таблице.[br]
|
||||
## [param tbl] - таблица,[br]
|
||||
## [param num_col] - номер колонки,[br]
|
||||
## [param i_row] - номер столбца.[br]
|
||||
func disable_edit(tbl, num_col: int, i_row: int):
|
||||
for col in num_col:
|
||||
var node: LineEdit = tbl.get_node2(col, i_row)
|
||||
node.editable = false
|
||||
|
||||
@@ -590,6 +590,8 @@ func on_btn_center_toggled(toggled_on: bool) -> void:
|
||||
func on_btn_activate_toggled(toggled_on: bool) -> void:
|
||||
$btn_activate.tooltip_text = 'Включает подавление (%s)' % ('включено' if toggled_on else 'отключено')
|
||||
signaller.emit_signal('emit_changed', toggled_on)
|
||||
if not toggled_on:
|
||||
$btn_activate.self_modulate = Color.WHITE
|
||||
|
||||
|
||||
func on_update_coordinates_label(coordinates_label) -> void:
|
||||
|
||||
Reference in New Issue
Block a user