diff --git a/data/кнопка-масштаб.png b/data/кнопка-масштаб.png new file mode 100644 index 00000000..2cce2263 Binary files /dev/null and b/data/кнопка-масштаб.png differ diff --git a/data/кнопка-масштаб.png.import b/data/кнопка-масштаб.png.import new file mode 100644 index 00000000..911dd58a --- /dev/null +++ b/data/кнопка-масштаб.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c1maea6yhd3k7" +path="res://.godot/imported/кнопка-масштаб.png-506c26462e59a71e6707c554c495504e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://data/кнопка-масштаб.png" +dest_files=["res://.godot/imported/кнопка-масштаб.png-506c26462e59a71e6707c554c495504e.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 diff --git a/project.godot b/project.godot index a8f8d413..d526b261 100644 --- a/project.godot +++ b/project.godot @@ -35,6 +35,7 @@ YemsDevs="*res://scripts/yems-devs.gd" Yemsboards="*res://scripts/yemsboards.gd" YemsConsts="*res://scripts/yems-consts.gd" interfer="*res://scripts/interfer.gd" +hotkeys="*res://scripts/hotkeys.gd" [debug] @@ -55,7 +56,8 @@ gdscript/warnings/integer_division=0 window/size/viewport_width=1600 window/size/viewport_height=1200 window/subwindows/embed_subwindows=false -window/stretch/mode="viewport" +window/stretch/mode="canvas_items" +window/dpi/allow_hidpi=false window/vsync/vsync_mode=false [editor] diff --git a/scenes/button-flat.tscn b/scenes/button-flat.tscn index 997f3141..52de7142 100644 --- a/scenes/button-flat.tscn +++ b/scenes/button-flat.tscn @@ -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_uqldr"] -[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_0loew"] +[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_ak74m"] [sub_resource type="StyleBoxEmpty" id="1"] @@ -22,17 +22,6 @@ theme_override_styles/panel = SubResource("1") script = ExtResource("1_uqldr") toggle_mode = true -[node name="state" type="NinePatchRect" parent="."] -show_behind_parent = true -layout_mode = 2 -texture = ExtResource("2_0loew") -patch_margin_left = 10 -patch_margin_top = 10 -patch_margin_right = 10 -patch_margin_bottom = 10 -axis_stretch_horizontal = 1 -axis_stretch_vertical = 1 - [node name="button" type="Button" parent="."] layout_mode = 2 theme_override_styles/normal = SubResource("6") @@ -43,7 +32,15 @@ theme_override_styles/focus = SubResource("4") toggle_mode = true clip_text = true -[node name="label" type="Label" parent="."] +[node name="state" type="NinePatchRect" parent="."] +show_behind_parent = true layout_mode = 2 +texture = ExtResource("2_ak74m") +patch_margin_left = 10 +patch_margin_top = 10 +patch_margin_right = 10 +patch_margin_bottom = 10 +axis_stretch_horizontal = 2 +axis_stretch_vertical = 2 [connection signal="toggled" from="button" to="." method="_on_button_toggled"] diff --git a/scenes/canvas.gd b/scenes/canvas.gd index 804b4cb6..1d1793d2 100644 --- a/scenes/canvas.gd +++ b/scenes/canvas.gd @@ -1,5 +1,7 @@ extends Sprite2D +func sv(val: float) -> float: return val / ($строб.scale.x / 2.0) * 0.125 + func set_strob_visible(val: bool): $строб.visible = val func set_strob_center(val: Vector2): $строб.position = val func set_strob_dir(val: float): $строб.material.set('shader_parameter/dir', val) @@ -17,4 +19,4 @@ func get_strob_radius() -> float: return $строб.material.get('shader_par func get_radius_outter() -> float: return material.get('shader_parameter/radius_outter') func get_radius_inner() -> float: return material.get('shader_parameter/radius_inner') -func sv(val: float) -> float: return val / ($строб.scale.x / 2.0) * 0.125 +func set_view_mode(val: int): material.set('shader_parameter/mode', val); diff --git a/scenes/canvas.tscn b/scenes/canvas.tscn index ce18bb38..a9469770 100644 --- a/scenes/canvas.tscn +++ b/scenes/canvas.tscn @@ -8,7 +8,7 @@ [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2bft1"] size = Vector2(1600, 1200) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_wl0b8"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_pnsbm"] resource_local_to_scene = true shader = ExtResource("4_gb4a1") shader_parameter/color = Color(1, 1, 1, 0.168627) @@ -26,6 +26,6 @@ centered = false script = ExtResource("2_vkwmy") [node name="строб" parent="." instance=ExtResource("3_uhdvc")] -material = SubResource("ShaderMaterial_wl0b8") +material = SubResource("ShaderMaterial_pnsbm") position = Vector2(560, 560) scale = Vector2(1100, 1100) diff --git a/scenes/header.tscn b/scenes/header.tscn deleted file mode 100644 index e69de29b..00000000 diff --git a/scenes/tab-switch.gd b/scenes/tab-switch.gd index 33743e78..9f6ed340 100644 --- a/scenes/tab-switch.gd +++ b/scenes/tab-switch.gd @@ -1,3 +1,3 @@ extends TabContainer -func _enter_tree() -> void: REPNetwork.logger_page = $журнал +func _enter_tree() -> void: REPNetwork.logger_page = $Журнал diff --git a/scenes/tab-switch.tscn b/scenes/tab-switch.tscn index 2c3ccdbc..c2c1e3cb 100644 --- a/scenes/tab-switch.tscn +++ b/scenes/tab-switch.tscn @@ -1,27 +1,32 @@ -[gd_scene load_steps=6 format=3 uid="uid://3slb0i3pvowc"] +[gd_scene load_steps=7 format=3 uid="uid://3slb0i3pvowc"] [ext_resource type="Script" path="res://scenes/tab-switch.gd" id="1_qroqt"] [ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="2_pdbvn"] [ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="3_2apbp"] [ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал.tscn" id="4_yq6c0"] [ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/ЭМС.tscn" id="5_tlyql"] +[ext_resource type="PackedScene" uid="uid://bnptm4rlp60dq" path="res://scenes/настройки.tscn" id="6_rxq15"] [node name="tab_switch" type="TabContainer"] offset_right = 1600.0 offset_bottom = 1200.0 script = ExtResource("1_qroqt") -[node name="работа" parent="." instance=ExtResource("2_pdbvn")] +[node name="Работа" parent="." instance=ExtResource("2_pdbvn")] layout_mode = 2 -[node name="контроль" parent="." instance=ExtResource("3_2apbp")] +[node name="Контроль" parent="." instance=ExtResource("3_2apbp")] visible = false layout_mode = 2 -[node name="журнал" parent="." instance=ExtResource("4_yq6c0")] +[node name="Журнал" parent="." instance=ExtResource("4_yq6c0")] visible = false layout_mode = 2 [node name="ЭМС" parent="." instance=ExtResource("5_tlyql")] visible = false layout_mode = 2 + +[node name="Настройки" parent="." instance=ExtResource("6_rxq15")] +visible = false +layout_mode = 2 diff --git a/scenes/ЭМС.gd b/scenes/ЭМС.gd index a72c41b1..30d09234 100644 --- a/scenes/ЭМС.gd +++ b/scenes/ЭМС.gd @@ -29,7 +29,7 @@ func _ready() -> void: ## Инициализация основных элементов экрана ЭМС 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)) @@ -39,7 +39,7 @@ func init_boards(): $btn_flash_write.set_position(Vector2(posx,posy+ 935)) $btn_connect.set_position(Vector2(posx+590,posy-25)) $btn_disconnect.set_position(Vector2(posx+587,posy + 675)) - + g_boards['КЭМС'] = Yemsboards.EmsBoard.new('КЭМС', 0x130, YemsConsts.INPUT_ROWS, YemsConsts.OUTPUT_ROWS) g_boards['П5-28'] = Yemsboards.EmsBoard.new('П5-28', 0x140, YemsConsts.INPUT_ROWS1, YemsConsts.OUTPUT_ROWS1) init_tbl_in() @@ -47,7 +47,7 @@ func init_boards(): init_tbl_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) + $scrl_out_set/tbl_out_set.pin_header($scrl_out_set, self) init_tbl_files() $scrl_files/tbl_files.pin_header($scrl_files, self) $btn_connect.connect('pressed', Callable(self, 'on_btn_connect')) @@ -106,7 +106,7 @@ func init_tbl_files(): ## Инициализация таблиц входов func init_tbl_in(): - # Инициализация основной таблицы входов, в ней отображается информация о параметрах и состоянии + # Инициализация основной таблицы входов, в ней отображается информация о параметрах и состоянии var header_type: Array = [TableHeader, TableHeader, CellFront, CellFrontRear, TableHeader] var header_text: Array = ['Входы', 'Соединитель', 'мкс', 'мкс', 'Состояние'] var row_type: Array = [CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, CellState] @@ -131,7 +131,7 @@ func init_tbl_in(): $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) @@ -215,7 +215,7 @@ func init_tbl_out(): $scrollout/tbl_out.set_columns_alignments(yams_alligment_out) $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, CellFront, CellFrontRear, TableHeader, TableHeader]) @@ -340,7 +340,7 @@ func add_connection_dev(tbl, dev1, dev2, set_row, user_data): dev2.connect_devs[dev1.connector] = user_data -## Отключает возможность редактирования LineEdit в таблице [param tbl] - таблица, +## Отключает возможность редактирования LineEdit в таблице [param tbl] - таблица, ## [param num_col] - номер колонки, [param i_row] - номер столбца func disable_edit(tbl, num_col: int, i_row: int): for col in range(num_col): diff --git a/scenes/журнал.gd b/scenes/журнал.gd index ef6ac37a..6817e943 100644 --- a/scenes/журнал.gd +++ b/scenes/журнал.gd @@ -1,4 +1,4 @@ -extends Control +extends Panel func on_line_changed(unit, addr): Log.message(Logger.INFO, 'Состояние связи: %s %s' % [unit, addr]) @@ -16,8 +16,9 @@ func _enter_tree(): func _ready() -> void: Log.info('Модуль журнала работы готов') + Log.info('Аргументы коммандной строки: \"%s\"' % OS.get_cmdline_args()) Log.info('Операционная система: %s' % [OS.get_distribution_name()]) - Threats.connect('threat_new', Callable(self, 'on_threats_changed').bind('Цель обнаружена')) + Threats.connect('threat_new', Callable(self, 'on_threats_changed').bind('Цель обнаружена')) Threats.connect('threat_lost', Callable(self, 'on_threats_changed').bind('Цель потеряна')) diff --git a/scenes/журнал.tscn b/scenes/журнал.tscn index 10136dbe..24efc399 100644 --- a/scenes/журнал.tscn +++ b/scenes/журнал.tscn @@ -3,8 +3,7 @@ [ext_resource type="Script" path="res://scenes/журнал.gd" id="1_qjw6d"] [ext_resource type="Script" path="res://addons/godot-logger/scripts/logger_output.gd" id="2_l1pni"] -[node name="журнал" type="Control"] -layout_mode = 3 +[node name="журнал" type="Panel"] anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -47,8 +46,8 @@ text = "Очистить" [node name="dlg_file" type="FileDialog" parent="."] gui_embed_subwindows = true -initial_position = 2 title = "Сохранить журнал работы в файл" +initial_position = 2 size = Vector2i(900, 900) borderless = true ok_button_text = "Да" diff --git a/scenes/настройки.gd b/scenes/настройки.gd new file mode 100644 index 00000000..7a2fbebd --- /dev/null +++ b/scenes/настройки.gd @@ -0,0 +1,15 @@ +extends Panel + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + if OS.get_cmdline_args().has('++ограниченный'): + $Label2.text = 'Текущий режим доступа: ограниченный' + for node in $GridContainer.get_children(): + if node is Button: + node.disabled = true + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/scenes/настройки.tscn b/scenes/настройки.tscn new file mode 100644 index 00000000..281d9a17 --- /dev/null +++ b/scenes/настройки.tscn @@ -0,0 +1,240 @@ +[gd_scene load_steps=2 format=3 uid="uid://bnptm4rlp60dq"] + +[ext_resource type="Script" path="res://scenes/настройки.gd" id="1_2l3rd"] + +[node name="Настройки" type="Panel"] +script = ExtResource("1_2l3rd") + +[node name="GridContainer" type="GridContainer" parent="."] +layout_mode = 0 +offset_left = 44.0 +offset_top = 87.0 +offset_right = 336.0 +offset_bottom = 193.0 +columns = 2 + +[node name="Label" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Элемент" +vertical_alignment = 1 + +[node name="Label2" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Показывать" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Label4" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «ПД-M4»" +vertical_alignment = 1 + +[node name="CheckButton" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label5" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «ПД-M2»" +vertical_alignment = 1 + +[node name="CheckButton3" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label6" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «ОЗП-1»" +vertical_alignment = 1 + +[node name="CheckButton5" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label7" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «МЧМ-1»" +vertical_alignment = 1 + +[node name="CheckButton6" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label8" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «СРН-И1»" +vertical_alignment = 1 + +[node name="CheckButton7" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label9" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «СРН-М2»" +vertical_alignment = 1 + +[node name="CheckButton8" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label10" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «ЛЧМ-1»" +vertical_alignment = 1 + +[node name="CheckButton9" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label11" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «ПД-М4С»" +vertical_alignment = 1 + +[node name="CheckButton10" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label12" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «ПД-ЧМ»" +vertical_alignment = 1 + +[node name="CheckButton11" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label13" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «СВ-И1»" +vertical_alignment = 1 + +[node name="CheckButton12" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label14" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «К1»" +vertical_alignment = 1 + +[node name="CheckButton13" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label15" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «СВ-М2»" +vertical_alignment = 1 + +[node name="CheckButton14" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label16" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «СРН»" +vertical_alignment = 1 + +[node name="CheckButton15" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label17" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «JTIDS»" +vertical_alignment = 1 + +[node name="CheckButton16" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label18" type="Label" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «КУПД»" +vertical_alignment = 1 + +[node name="CheckButton17" type="CheckButton" parent="GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="Label1" type="Label" parent="."] +layout_mode = 0 +offset_left = 16.0 +offset_top = 60.0 +offset_right = 434.0 +offset_bottom = 82.0 +text = "Управление элементами в режиме с ограниченным доступом" + +[node name="Label2" type="Label" parent="."] +layout_mode = 0 +offset_left = 16.0 +offset_top = 27.0 +offset_right = 445.0 +offset_bottom = 49.0 +text = "Текущий режим доступа: полный" diff --git a/scenes/работа.gd b/scenes/работа.gd index 9425b1c5..1152f3be 100644 --- a/scenes/работа.gd +++ b/scenes/работа.gd @@ -33,7 +33,6 @@ var strob_width_begin: float ## Ширина строба по углу signal drag_begin ## Вызывается в момент начала перетаскивания signal drag_continue ## Вызывается во время продолжения перетаскивания signal drag_end ## Вызывается в момент завершения перетаскивания -signal full_screen ## Вызывается при смене режима окна полный экран - оконный ## Состояние перетаскивания @@ -44,8 +43,7 @@ enum DragFSM { } -## Переключант режим окна программы полный экран - обычный -func _on_full_screen(): toggle_full_screen(window_0_id) +func on_button_view_toggled(toggled: bool): $canvas.set_view_mode(int(toggled)) ## Обработчик сигнала изменения списка целей @@ -54,8 +52,9 @@ func on_threats_resized(threats: Dictionary): $count_all_pad/count_all.text = '% ## Производит инициализацию func _ready(): - $btn_strobe.button_connect('pressed', Callable(self, 'on_button_strobe_pressed')) - $btn_off.set_pressed(true) + $btn_strob.button_connect('pressed', Callable(self, 'on_button_strobe_pressed')) + $btn_view.button_connect('toggled', Callable(self, 'on_button_view_toggled')) + $grd_btns/btn_off.set_pressed(true) on_button_strobe_pressed() drag_fsm = DragFSM.OFF var nodes: Array = get_tree().get_nodes_in_group('группа-режим-помехи') @@ -101,12 +100,9 @@ func on_threat_lost(th) -> void: ## Обработчик нажатия кнопки "Строб". Управляет отображением строба func on_button_strobe_pressed() -> void: - if $btn_strobe.is_pressed(): - $canvas.set_strob_visible(true) - drag_fsm = DragFSM.IDLE - else: - $canvas.set_strob_visible(false) - drag_fsm = DragFSM.OFF + if not is_inside_tree(): return + drag_fsm = DragFSM.IDLE if $btn_strob.is_pressed() else DragFSM.OFF + $canvas.set_strob_visible(drag_fsm == DragFSM.IDLE) ## Поведение радиокнопок в группе. Управляет состоянием кнопок в радиогруппе @@ -175,16 +171,16 @@ func _input(event) -> void: drag_fsm = DragFSM.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: + if event.physical_keycode == KEY_SHIFT: shift_pressed = event.pressed -## Переключает режим окна программы полный - обычный экран -func toggle_full_screen(id: int) -> void: - var mode = DisplayServer.window_get_mode(id) - mode = DisplayServer.WINDOW_MODE_WINDOWED \ - if mode == DisplayServer.WINDOW_MODE_FULLSCREEN \ - else DisplayServer.WINDOW_MODE_FULLSCREEN - DisplayServer.window_set_mode(mode, id) +## Изменяет масштаб +func _on_btn_scale_pressed() -> void: + var i_scale = $btn_scale.get_meta('i_scale') + var prefix = $btn_scale.get_meta('prefix') + var scales = $btn_scale.get_meta('scales') + i_scale += 1 + i_scale %= scales.size() + $btn_scale.set_meta('i_scale', i_scale) + $btn_scale/lbl.text = '%s %.0f км' % [prefix, scales[i_scale]] diff --git a/scenes/работа.tscn b/scenes/работа.tscn index b5fe47bb..e3475f78 100644 --- a/scenes/работа.tscn +++ b/scenes/работа.tscn @@ -1,18 +1,19 @@ -[gd_scene load_steps=10 format=3 uid="uid://b276iygic5itk"] +[gd_scene load_steps=11 format=3 uid="uid://b276iygic5itk"] -[ext_resource type="Script" path="res://scenes/работа.gd" id="1_n5csv"] -[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip.tscn" id="2_27xk6"] -[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="3_pmi4q"] -[ext_resource type="Script" path="res://scenes/scroll-threats.gd" id="4_i4425"] -[ext_resource type="Script" path="res://table/table.gd" id="5_wx56q"] -[ext_resource type="Script" path="res://scenes/scroll-params.gd" id="6_sbmqs"] -[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="7_cnnmi"] -[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="8_ldm1g"] -[ext_resource type="FontFile" uid="uid://befva8r034a4v" path="res://data/DSEG7Classic-Regular.ttf" id="9_mjlke"] +[ext_resource type="Script" path="res://scenes/работа.gd" id="1_vmjjl"] +[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip.tscn" id="2_ew6j4"] +[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="3_38cyn"] +[ext_resource type="Script" path="res://scenes/scroll-threats.gd" id="4_6pit6"] +[ext_resource type="Script" path="res://table/table.gd" id="5_0lwxu"] +[ext_resource type="Script" path="res://scenes/scroll-params.gd" id="6_v4chn"] +[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="7_pvt8f"] +[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="8_r2k1p"] +[ext_resource type="FontFile" uid="uid://befva8r034a4v" path="res://data/DSEG7Classic-Regular.ttf" id="9_lr4kl"] +[ext_resource type="Texture2D" uid="uid://c1maea6yhd3k7" path="res://data/кнопка-масштаб.png" id="10_7gljt"] [node name="Работа" type="Panel"] -script = ExtResource("1_n5csv") -Bip = ExtResource("2_27xk6") +script = ExtResource("1_vmjjl") +Bip = ExtResource("2_ew6j4") col_grey = Color(0.34902, 0.643137, 0.772549, 0.168627) col_red = Color(1, 0.568627, 0.431373, 0.239216) drag_scale_band = 0.05 @@ -40,7 +41,7 @@ offset_bottom = 1169.0 layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource("3_pmi4q") +texture = ExtResource("3_38cyn") patch_margin_left = 15 patch_margin_top = 30 patch_margin_right = 15 @@ -64,18 +65,18 @@ offset_left = 4.0 offset_top = 51.0 offset_right = 476.0 offset_bottom = 282.0 -script = ExtResource("4_i4425") +script = ExtResource("4_6pit6") [node name="table" type="GridContainer" parent="grd_side/frm_threats/scroll"] layout_mode = 2 columns = 4 -script = ExtResource("5_wx56q") +script = ExtResource("5_0lwxu") [node name="frm_params" type="NinePatchRect" parent="grd_side"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource("3_pmi4q") +texture = ExtResource("3_38cyn") patch_margin_left = 15 patch_margin_top = 30 patch_margin_right = 15 @@ -99,17 +100,17 @@ offset_left = 4.0 offset_top = 27.0 offset_right = 476.0 offset_bottom = 282.0 -script = ExtResource("6_sbmqs") +script = ExtResource("6_v4chn") [node name="table" type="GridContainer" parent="grd_side/frm_params/scroll"] layout_mode = 2 -script = ExtResource("5_wx56q") +script = ExtResource("5_0lwxu") [node name="frm_ecm_list" type="NinePatchRect" parent="grd_side"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource("3_pmi4q") +texture = ExtResource("3_38cyn") patch_margin_left = 15 patch_margin_top = 30 patch_margin_right = 15 @@ -129,20 +130,60 @@ vertical_alignment = 1 [node name="scroll" type="ScrollContainer" parent="grd_side/frm_ecm_list"] layout_mode = 0 -offset_left = 4.0 +offset_left = 8.0 offset_top = 57.0 offset_right = 472.0 -offset_bottom = 285.0 +offset_bottom = 237.0 [node name="table" type="GridContainer" parent="grd_side/frm_ecm_list/scroll"] layout_mode = 2 -script = ExtResource("5_wx56q") +script = ExtResource("5_0lwxu") + +[node name="grd_forced" type="GridContainer" parent="grd_side/frm_ecm_list"] +layout_mode = 0 +offset_left = 8.0 +offset_top = 245.0 +offset_right = 472.0 +offset_bottom = 281.0 +columns = 4 + +[node name="btn_srn" parent="grd_side/frm_ecm_list/grd_forced" groups=["группа-принудительно"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = "Включает принудительную помеху" +text = "СРН" +metadata/rfi_name = "ozp1" + +[node name="btn_jtids" parent="grd_side/frm_ecm_list/grd_forced" groups=["группа-принудительно"] instance=ExtResource("8_r2k1p")] +editor_description = "Кнопка для принудительного включения группы секторов в режим JTIDS" +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "JTIDS" +metadata/rfi_name = "ozp1" + +[node name="btn_kupd" parent="grd_side/frm_ecm_list/grd_forced" groups=["группа-принудительно"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = "Кнопка для принудительного включения группы секторов в режим КУПД" +text = "КУПД" +metadata/rfi_name = "ozp1" + +[node name="btn_cancel" parent="grd_side/frm_ecm_list/grd_forced" groups=["прин-секторы-срн"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Отключить все" +pressed = true +metadata/rfi_name = "" [node name="frm_ecm_params" type="NinePatchRect" parent="grd_side"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource("3_pmi4q") +texture = ExtResource("3_38cyn") patch_margin_left = 15 patch_margin_top = 30 patch_margin_right = 15 @@ -156,7 +197,7 @@ anchor_right = 1.0 offset_bottom = 22.0 grow_horizontal = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) -text = "Параметры помехи" +text = "Параметры сеанса" horizontal_alignment = 1 vertical_alignment = 1 @@ -169,172 +210,118 @@ offset_bottom = 282.0 [node name="table" type="GridContainer" parent="grd_side/frm_ecm_params/scroll"] layout_mode = 2 -script = ExtResource("5_wx56q") +script = ExtResource("5_0lwxu") -[node name="canvas" parent="." instance=ExtResource("7_cnnmi")] +[node name="canvas" parent="." instance=ExtResource("7_pvt8f")] metadata/_edit_lock_ = true -[node name="btn_auto_threat" parent="." instance=ExtResource("8_ldm1g")] +[node name="grd_btns" type="GridContainer" parent="."] layout_mode = 0 -offset_left = 912.0 -offset_top = 67.0 -offset_right = 1102.0 -offset_bottom = 117.0 -text = "Автоматически" +offset_left = 8.0 +offset_top = 1116.0 +offset_right = 1104.0 +offset_bottom = 1170.0 +columns = 14 -[node name="btn_strobe" parent="." instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 912.0 -offset_top = 6.0 -offset_right = 1102.0 -offset_bottom = 56.0 -text = "Строб" - -[node name="btn_p5" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 1 -anchors_preset = -1 -offset_left = 980.0 -offset_top = 1118.0 -offset_right = 1045.0 -offset_bottom = 1168.0 -grow_horizontal = 2 -grow_vertical = 2 -text = "ОЗП-1" -metadata/rfi_name = "ozp1" - -[node name="btn_p6" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 840.0 -offset_top = 1118.0 -offset_right = 905.0 -offset_bottom = 1168.0 -text = "СВ-М2" -metadata/rfi_name = "svm2" - -[node name="btn_p7" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 910.0 -offset_top = 1118.0 -offset_right = 975.0 -offset_bottom = 1168.0 -text = "K1" -metadata/rfi_name = "k1" - -[node name="btn_p8" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 770.0 -offset_top = 1118.0 -offset_right = 835.0 -offset_bottom = 1168.0 -text = "СВ-И1" -metadata/rfi_name = "svi1" - -[node name="btn_p9" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 700.0 -offset_top = 1118.0 -offset_right = 765.0 -offset_bottom = 1168.0 -text = "ПД-ЧМ" -metadata/rfi_name = "pdchm" - -[node name="btn_p10" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 1 -anchors_preset = -1 -offset_left = 630.0 -offset_top = 1118.0 -offset_right = 695.0 -offset_bottom = 1168.0 -grow_horizontal = 2 -grow_vertical = 2 -text = "ПД-М4С" -metadata/rfi_name = "pdm4s" - -[node name="btn_p11" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 350.0 -offset_top = 1118.0 -offset_right = 415.0 -offset_bottom = 1168.0 -text = "ЛЧМ-1" -metadata/rfi_name = "lchm1" - -[node name="btn_p12" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 1 -anchors_preset = -1 -offset_left = 420.0 -offset_top = 1118.0 -offset_right = 485.0 -offset_bottom = 1168.0 -grow_horizontal = 2 -grow_vertical = 2 -text = "МЧМ-1" -metadata/rfi_name = "mchm1" - -[node name="btn_p13" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 1 -anchors_preset = -1 -offset_left = 490.0 -offset_top = 1118.0 -offset_right = 555.0 -offset_bottom = 1168.0 -grow_horizontal = 2 -grow_vertical = 2 -text = "ПД-М2" -metadata/rfi_name = "pdm2" - -[node name="btn_p14" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 1 -anchors_preset = -1 -offset_left = 560.0 -offset_top = 1118.0 -offset_right = 625.0 -offset_bottom = 1168.0 -grow_horizontal = 2 -grow_vertical = 2 -text = "ПД-М4" -metadata/rfi_name = "pdm4" - -[node name="btn_p15" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 1 -anchors_preset = -1 -offset_left = 280.0 -offset_top = 1118.0 -offset_right = 345.0 -offset_bottom = 1168.0 -grow_horizontal = 2 -grow_vertical = 2 -text = "СРН-М2" -metadata/rfi_name = "srnm2" - -[node name="btn_p16" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 210.0 -offset_top = 1118.0 -offset_right = 275.0 -offset_bottom = 1168.0 -text = "СРН-И1" -metadata/rfi_name = "srni1" - -[node name="btn_off" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 140.0 -offset_top = 1118.0 -offset_right = 205.0 -offset_bottom = 1168.0 +[node name="btn_off" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 text = "Откл." pressed = true metadata/rfi_name = "" -[node name="btn_auto_rfi" parent="." groups=["группа-режим-помехи"] instance=ExtResource("8_ldm1g")] -layout_mode = 0 -offset_left = 10.0 -offset_top = 1118.0 -offset_right = 135.0 -offset_bottom = 1168.0 -text = "Автоматически" +[node name="btn_auto_rfi" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Автомат" metadata/rfi_name = "" +[node name="btn_p12" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "МЧМ-1" +metadata/rfi_name = "mchm1" + +[node name="btn_p16" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "СРН-И1" +metadata/rfi_name = "srni1" + +[node name="btn_p15" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "СРН-М2" +metadata/rfi_name = "srnm2" + +[node name="btn_p14" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "ПД-М4" +metadata/rfi_name = "pdm4" + +[node name="btn_p13" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "ПД-М2" +metadata/rfi_name = "pdm2" + +[node name="btn_p11" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "ЛЧМ-1" +metadata/rfi_name = "lchm1" + +[node name="btn_p10" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "ПД-М4С" +metadata/rfi_name = "pdm4s" + +[node name="btn_p9" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "ПД-ЧМ" +metadata/rfi_name = "pdchm" + +[node name="btn_p8" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "СВ-И1" +metadata/rfi_name = "svi1" + +[node name="btn_p7" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "K1" +metadata/rfi_name = "k1" + +[node name="btn_p6" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "СВ-М2" +metadata/rfi_name = "svm2" + +[node name="btn_p5" parent="grd_btns" groups=["группа-режим-помехи"] instance=ExtResource("8_r2k1p")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "ОЗП-1" +metadata/rfi_name = "ozp1" + [node name="count_all_pad" type="Label" parent="."] self_modulate = Color(0.403922, 0.403922, 0.403922, 1) layout_mode = 0 @@ -342,7 +329,7 @@ offset_left = 96.0 offset_top = 109.0 offset_right = 164.0 offset_bottom = 142.0 -theme_override_fonts/font = ExtResource("9_mjlke") +theme_override_fonts/font = ExtResource("9_lr4kl") theme_override_font_sizes/font_size = 20 text = "88" vertical_alignment = 1 @@ -351,7 +338,7 @@ vertical_alignment = 1 layout_mode = 0 offset_right = 68.0 offset_bottom = 33.0 -theme_override_fonts/font = ExtResource("9_mjlke") +theme_override_fonts/font = ExtResource("9_lr4kl") theme_override_font_sizes/font_size = 20 text = "00" vertical_alignment = 1 @@ -363,15 +350,16 @@ offset_left = 96.0 offset_top = 29.0 offset_right = 188.0 offset_bottom = 88.0 -theme_override_fonts/font = ExtResource("9_mjlke") +theme_override_fonts/font = ExtResource("9_lr4kl") theme_override_font_sizes/font_size = 56 text = "88" [node name="count_danger" type="Label" parent="count_danger_pad"] +modulate = Color(0.8, 0.533333, 0.27451, 1) layout_mode = 0 offset_right = 92.0 offset_bottom = 59.0 -theme_override_fonts/font = ExtResource("9_mjlke") +theme_override_fonts/font = ExtResource("9_lr4kl") theme_override_font_sizes/font_size = 56 text = "00" @@ -401,6 +389,61 @@ offset_right = 83.0 offset_bottom = 72.0 text = "Опасных:" +[node name="btn_auto_threat" parent="." instance=ExtResource("8_r2k1p")] +layout_mode = 0 +offset_left = 1022.0 +offset_top = 6.0 +offset_right = 1096.0 +offset_bottom = 60.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Автомат" + +[node name="btn_strob" parent="." instance=ExtResource("8_r2k1p")] +layout_mode = 2 +offset_left = 1022.0 +offset_top = 66.0 +offset_right = 1096.0 +offset_bottom = 120.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой" +text = "Строб" + +[node name="btn_view" parent="." instance=ExtResource("8_r2k1p")] +layout_mode = 2 +offset_left = 874.0 +offset_top = 1023.0 +offset_right = 948.0 +offset_bottom = 1056.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Вид" + +[node name="btn_scale" type="TextureButton" parent="."] +self_modulate = Color(1, 1, 1, 0.509804) +layout_mode = 0 +offset_left = 952.0 +offset_top = 1038.0 +offset_right = 1104.0 +offset_bottom = 1056.0 +tooltip_text = "Измененяет масштаб" +action_mode = 0 +texture_normal = ExtResource("10_7gljt") +ignore_texture_size = true +stretch_mode = 0 +metadata/i_scale = 0 +metadata/prefix = "Масштаб:" +metadata/scales = [10.0, 20.0, 50.0, 100.0, 250.0] + +[node name="lbl" type="Label" parent="btn_scale"] +layout_mode = 0 +offset_top = -18.0 +offset_right = 152.0 +offset_bottom = 1.0 +text = "Масштаб: 200 км" +vertical_alignment = 1 + [connection signal="drag_begin" from="." to="." method="_on_drag_begin"] [connection signal="drag_continue" from="." to="." method="_on_drag_continue"] -[connection signal="full_screen" from="." to="." method="toggle_full_screen" binds= [0]] +[connection signal="pressed" from="btn_scale" to="." method="_on_btn_scale_pressed"] diff --git a/scripts/hotkeys.gd b/scripts/hotkeys.gd new file mode 100644 index 00000000..a75efc97 --- /dev/null +++ b/scripts/hotkeys.gd @@ -0,0 +1,20 @@ +extends Node + + +func _ready() -> void: + signaller.connect('full_screen', Callable(self, 'toggle_full_screen').bind(0)) + + +func _input(event: InputEvent) -> void: + if event is InputEventKey: + if event.pressed and event.physical_keycode == KEY_F11: + signaller.emit_signal('full_screen') + + +## Переключает режим окна программы полный - обычный экран +func toggle_full_screen(id: int) -> void: + var mode = DisplayServer.window_get_mode(id) + mode = DisplayServer.WINDOW_MODE_WINDOWED \ + if mode == DisplayServer.WINDOW_MODE_FULLSCREEN \ + else DisplayServer.WINDOW_MODE_FULLSCREEN + DisplayServer.window_set_mode(mode, id) diff --git a/scripts/repnetwork.gd b/scripts/repnetwork.gd index 4480270c..f4890f41 100644 --- a/scripts/repnetwork.gd +++ b/scripts/repnetwork.gd @@ -50,7 +50,7 @@ func _ready() -> void: unit.connect('command_fail', Callable(logger_page, 'on_command_fail').bind(unit_key)) for key in units: Log.info('%s %s:%d' % [units[key].name, key[0], key[1]]) - + var timer_interfer: = Timer.new() add_child(timer_interfer) timer_interfer.connect('timeout', Callable(self, 'on_timer_interfer')) @@ -73,7 +73,7 @@ func on_timer_interfer(): var pac = json.to_utf8_buffer() sock_capsrpb.set_dest_address(repsettings.UnitProfiles['уарэп-капсрпб-отп'][1], repsettings.UnitProfiles['уарэп-капсрпб-отп'][2]) sock_capsrpb.put_packet(pac) - + var msg_type8 = {} var time = Time.get_datetime_dict_from_system() msg_type8['ts'] = 8 diff --git a/scripts/signaller.gd b/scripts/signaller.gd index 670057df..03383b80 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -1,16 +1,22 @@ class_name Signaller extends Node -## Обмен сигналами между узлами +## Обмен сигналами между узлами. Здесь объявлены сигналы, которые используют +## два и более узла, из разных файлов. ## Вызывается, когда оператор выбирает цель. -## [param threats] - Словарь. Ключ - идентификатор (номер) цели. Значение - цель +## [param threats] - Словарь. Ключ - идентификатор (номер) цели. Значение - цель [br] ## [param th] - Выбранная цель [br] signal threat_selected(threats: Dictionary, th) ## Вызывается, когда оператор снимает выбор цели. -## [param threats] - Словарь. Ключ - идентификатор (номер) цели. Значение - цель +## [param threats] - Словарь. Ключ - идентификатор (номер) цели. Значение - цель [br] ## [param th] - Ранее выбранная цель [br] signal threat_unselected(threats: Dictionary, th) + + +## Вызывается, когда пользователь переключает режим окна программы полный экран - оконный +## [param id] - Идентификатор окна. Присваевается вручную +signal full_screen(id: int) diff --git a/shaders/shader_edu.tres b/shaders/shader_edu.tres index f51e41b5..f7d68e11 100644 --- a/shaders/shader_edu.tres +++ b/shaders/shader_edu.tres @@ -9,30 +9,33 @@ uniform vec4 color0: source_color = vec4(0.38, 0.47, 0.51, 0.4); uniform vec4 color1: source_color = vec4(0.39, 0.44, 0.50, 0.4); uniform float radius_inner = 200.0; /* Радиус внутренний. Должно быть равно ant_band_r0_0 */ uniform float radius_outter = 550.0; /* Радиус внешний. Должно быть равно ant_band_r1_6 */ +uniform int mode = 0; /* Режим отображения. Приоритет РТО - 0, приоритет РЛС - 1 */ -const float ant_band_count_0 = 2.0; -const float ant_band_count_1 = 2.0; -const float ant_band_count_2 = 2.0; -const float ant_band_count_3 = 2.0; -const float ant_band_count_4 = 2.0; -const float ant_band_count_5 = 2.0; -const float ant_band_count_6 = 2.0; +const int ant_band_count_0 = 2; +const int ant_band_count_1 = 2; +const int ant_band_count_2 = 2; +const int ant_band_count_3 = 2; +const int ant_band_count_4 = 2; +const int ant_band_count_5 = 2; +const int ant_band_count_6 = 2; + +const float ant_band_r0_0[] = {200.0, 480.0}; +const float ant_band_r0_1[] = {250.0, 490.0}; +const float ant_band_r0_2[] = {300.0, 500.0}; +const float ant_band_r0_3[] = {350.0, 510.0}; +const float ant_band_r0_4[] = {400.0, 520.0}; +const float ant_band_r0_5[] = {450.0, 530.0}; +const float ant_band_r0_6[] = {500.0, 540.0}; + +const float ant_band_r1_0[] = {250.0, 490.0}; +const float ant_band_r1_1[] = {300.0, 500.0}; +const float ant_band_r1_2[] = {350.0, 510.0}; +const float ant_band_r1_3[] = {400.0, 520.0}; +const float ant_band_r1_4[] = {450.0, 530.0}; +const float ant_band_r1_5[] = {500.0, 540.0}; +const float ant_band_r1_6[] = {550.0, 550.0}; -const float ant_band_r0_0 = 200.0; -const float ant_band_r0_1 = 250.0; -const float ant_band_r0_2 = 300.0; -const float ant_band_r0_3 = 350.0; -const float ant_band_r0_4 = 400.0; -const float ant_band_r0_5 = 450.0; -const float ant_band_r0_6 = 500.0; -const float ant_band_r1_0 = 250.0; -const float ant_band_r1_1 = 300.0; -const float ant_band_r1_2 = 350.0; -const float ant_band_r1_3 = 400.0; -const float ant_band_r1_4 = 450.0; -const float ant_band_r1_5 = 500.0; -const float ant_band_r1_6 = 550.0; const float d4 = 90.0; const float ds = 1.0; @@ -60,10 +63,10 @@ void sector(inout vec4 c, vec2 uv, vec2 center, float a, float da, float r0, flo } -void antenas(inout vec4 c, vec2 uv, vec2 p0, float cnt, float r0, float r1, vec4 c0, vec4 c1) +void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, vec4 c0, vec4 c1) { float da = 180.0f / float(cnt); - for (int i = int(-cnt); i <= int(cnt); i ++) + for (int i = -cnt; i <= cnt; i ++) { float v = float(i & 1); vec4 col = v * c0 + (1.0f - v) * c1; @@ -113,13 +116,13 @@ void fragment() COLOR = vec4(0, 0, 0, 0.0); //texture(TEXTURE, UV); // Цвет текущей точки // Сетка антенн - antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0, ant_band_r1_0, color1, color0); - antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1, ant_band_r1_1, color0, color1); - antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2, ant_band_r1_2, color1, color0); - antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3, ant_band_r1_3, color0, color1); - antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4, ant_band_r1_4, color1, color0); - antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5, ant_band_r1_5, color0, color1); - antenas(COLOR, uv, pc0, ant_band_count_6, ant_band_r0_6, ant_band_r1_6, color1, color0); + antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0[mode], ant_band_r1_0[mode], color1, color0); + antenas(COLOR, uv, pc0, ant_band_count_1, ant_band_r0_1[mode], ant_band_r1_1[mode], color0, color1); + antenas(COLOR, uv, pc0, ant_band_count_2, ant_band_r0_2[mode], ant_band_r1_2[mode], color1, color0); + antenas(COLOR, uv, pc0, ant_band_count_3, ant_band_r0_3[mode], ant_band_r1_3[mode], color0, color1); + antenas(COLOR, uv, pc0, ant_band_count_4, ant_band_r0_4[mode], ant_band_r1_4[mode], color1, color0); + antenas(COLOR, uv, pc0, ant_band_count_5, ant_band_r0_5[mode], ant_band_r1_5[mode], color0, color1); + antenas(COLOR, uv, pc0, ant_band_count_6, ant_band_r0_6[mode], ant_band_r1_6[mode], color1, color0); } " @@ -131,3 +134,4 @@ shader_parameter/color0 = Color(0.380392, 0.470588, 0.509804, 0.537255) shader_parameter/color1 = Color(0.3315, 0.45645, 0.51, 0.537255) shader_parameter/radius_inner = 200.0 shader_parameter/radius_outter = 550.0 +shader_parameter/mode = 0 diff --git a/table/table.gd b/table/table.gd index 56743d55..1705343e 100644 --- a/table/table.gd +++ b/table/table.gd @@ -25,6 +25,7 @@ const META_EVENT_NAME = 'event_name' ## Имя свойс var header: GridContainer ## Заголовок таблицы var in_focus: = false ## Фокус пользовательского ввода var nodes: = {} ## Все ячейки таблицы и дополнительные элементы +var columns_min_size = [] ## Ширина каждой колонки var ScnNode: PackedScene ## Прототип ячейки таблицы var ScnSelector: PackedScene ## Прототип индикатора выбранного ряда var selector_color_proc: Callable ## Ссылка на процедуру генератора цвета индикатора выбранного ряда @@ -179,7 +180,11 @@ func set_columns_min_size(sizes: Array) -> void: assert((columns == 1) or (columns == sizes.size())) columns = sizes.size() var rows_count: = get_rows_count() - for i_row in rows_count: set_nodes_min_size(i_row, sizes) + columns_min_size.clear() + for sz in sizes: + columns_min_size.append(sz) + for i_row in rows_count: + set_nodes_min_size(i_row, sizes, NODE_KEY_FORMAT) if nodes.has(HEAD_KEY_FORMAT % [0, 0]): set_nodes_min_size(0, sizes, HEAD_KEY_FORMAT) @@ -318,6 +323,7 @@ func add_row(row_types: Array) -> void: assert(columns == row_types.size(), 'ошибка: %s количество колонок установлено ранее - %d, но требуется %d' % [self, columns, row_types.size()]) var i_row: int = get_rows_count() assert(i_row < MAX_INDEX, 'ошибка: слишком много рядов, больше %d' % (MAX_INDEX + 1)) + var allow_set_size = columns_min_size.size() >= row_types.size() for i_col in columns: var node_type = row_types[i_col] var node = node_type.instantiate() @@ -325,6 +331,9 @@ func add_row(row_types: Array) -> void: var node_key: String = NODE_KEY_FORMAT % [i_row, i_col] node.name = node_key add_child(node) + if allow_set_size: + node.custom_minimum_size.x = columns_min_size[i_col] + node.set_deferred('size.x', columns_min_size[i_col]) nodes[node_key] = node var conn = Callable(self, '_on_focus_entered').bind(node) node.connect('focus_entered', conn) @@ -483,6 +492,9 @@ func set_rows_text(rows: Array) -> void: ## [param i_row] - Индекс ряда. func set_nodes_min_size(i_row: int, sizes: Array, key_format: String = NODE_KEY_FORMAT) -> void: + columns_min_size.clear() + for sz in sizes: + columns_min_size.append(sz) for i_col in columns: var key: = get_node_key(key_format, i_col, i_row) var node = nodes[key]