Merge remote-tracking branch 'sasha80/master' into workflows
# Conflicts: # scripts/prd-ctl-config.gd
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://da7w3vkhadfwe"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://da7w3vkhadfwe"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://damy6n4u215pu" path="res://scenes/button-flat/nine-patch-button.gd" id="1_ui6sg"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_0cn5u"]
|
||||
[ext_resource type="Shader" uid="uid://cdmmsf161l6yw" path="res://shaders/strips.gdshader" id="2_5ngiq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cl8h2vaibabyi" path="res://data/кнопка-квадрат-1.png" id="3_tbv1w"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="1"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hhdyc"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("2_5ngiq")
|
||||
shader_parameter/rotation = 0.0
|
||||
shader_parameter/rotation = 0.785398
|
||||
shader_parameter/color = Vector4(1, 1, 1, 0.1)
|
||||
shader_parameter/width = 3.0
|
||||
shader_parameter/speed = 0.0
|
||||
@@ -56,6 +57,9 @@ offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
theme_override_styles/panel = SubResource("1")
|
||||
script = ExtResource("1_ui6sg")
|
||||
texture_state0 = ExtResource("2_0cn5u")
|
||||
texture_state1 = ExtResource("3_tbv1w")
|
||||
strips_rotation = 45.0
|
||||
|
||||
[node name="recommend" type="ReferenceRect" parent="."]
|
||||
visible = false
|
||||
@@ -72,6 +76,7 @@ texture = SubResource("PlaceholderTexture2D_6nup5")
|
||||
centered = false
|
||||
script = SubResource("GDScript_uyl5d")
|
||||
speed = 0.0
|
||||
strips_rotation = 0.785398
|
||||
|
||||
[node name="state" type="NinePatchRect" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -12,34 +12,34 @@ func is_toggle_mode(): return $button.is_toggle_mode()
|
||||
|
||||
var _pressed: = false
|
||||
|
||||
@export var texture_state0: Texture2D = preload('res://data/кнопка-квадрат-0.png'):
|
||||
@export var texture_state0: Texture2D:
|
||||
set(val):
|
||||
texture_state0 = val
|
||||
$state.set_texture(val)
|
||||
|
||||
|
||||
@export var texture_state1: Texture2D = preload('res://data/кнопка-квадрат-1.png'):
|
||||
@export var texture_state1: Texture2D:
|
||||
set(val):
|
||||
texture_state1 = val
|
||||
if is_inside_tree():
|
||||
$state.set_texture(val)
|
||||
|
||||
|
||||
@export var strips_rotation: float = 0.0:
|
||||
set(val):
|
||||
strips_rotation = val
|
||||
if is_inside_tree():
|
||||
$back.strips_rotation = deg_to_rad(val)
|
||||
|
||||
|
||||
@export var text: String = '':
|
||||
set(val):
|
||||
text = val
|
||||
if is_inside_tree():
|
||||
$button.set_text(val)
|
||||
|
||||
|
||||
@export var btn_tooltip: String = '':
|
||||
set(val):
|
||||
btn_tooltip = val
|
||||
if is_inside_tree():
|
||||
$button.set_tooltip_text(val)
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ var _pressed: = false
|
||||
|
||||
@export var font_size: int = 15:
|
||||
set(val):
|
||||
font_size = val
|
||||
if is_inside_tree():
|
||||
$button.add_theme_font_size_override('theme_override_font_sizes/font_size', val)
|
||||
|
||||
|
||||
@@ -92,12 +94,19 @@ func _enter_tree() -> void:
|
||||
$back.scale = size
|
||||
$back.material.set('shader_parameter/scale', size / Vector2(20.0, 20.0))
|
||||
$button.connect('toggled', _on_button_toggled)
|
||||
ProjectSettings.connect("settings_changed", _on_settings_changed)
|
||||
$button.set_toggle_mode(toggle_mode)
|
||||
$button.add_theme_font_size_override('theme_override_font_sizes/font_size', font_size)
|
||||
pressed = _pressed
|
||||
$button.set_pressed(pressed)
|
||||
$button.set_disabled(disabled)
|
||||
$back.disabled = disabled
|
||||
$state.modulate.a = 0.5 if disabled else 1.0
|
||||
$button.set_tooltip_text(btn_tooltip)
|
||||
$button.set_text(text)
|
||||
|
||||
|
||||
func _on_settings_changed():
|
||||
apply_colors(ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false ))
|
||||
pass
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
@@ -111,19 +120,3 @@ func set_toggle_mode(val: bool):
|
||||
func _on_button_toggled(val: bool):
|
||||
if val: $state.set_texture(texture_state1)
|
||||
else: $state.set_texture(texture_state0)
|
||||
|
||||
|
||||
func apply_colors(is_light: bool):
|
||||
pass
|
||||
#if is_light:
|
||||
#$button.add_theme_color_override("font_color", Color.WHITE)
|
||||
#$button.add_theme_color_override("font_hover_color", Color.WHITE)
|
||||
#$button.add_theme_color_override("font_pressed_color", Color.WHITE)
|
||||
#$button.add_theme_color_override("font_focus_color", Color.BLACK)
|
||||
#$button.add_theme_color_override("font_disabled_color", Color.WHITE)
|
||||
#$button.add_theme_color_override("font_shadow_color", Color.LIGHT_GOLDENROD)
|
||||
#else:
|
||||
#$button.remove_theme_color_override("font_color")
|
||||
#$button.remove_theme_color_override("font_hover_color")
|
||||
#$button.remove_theme_color_override("font_pressed_color")
|
||||
#$button.remove_theme_color_override("font_disabled_color")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://7rvw671tlx2i"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://7rvw671tlx2i"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="1_6swor"]
|
||||
[ext_resource type="Script" uid="uid://14bc8gil81n7" path="res://scenes/frame-ecm-list/scroll-ecm-list.gd" id="2_3x81o"]
|
||||
[ext_resource type="Script" uid="uid://b23n7v1xjdurw" path="res://scenes/frame-ecm-list/frm-ecm-list.gd" id="2_mt58v"]
|
||||
[ext_resource type="Script" uid="uid://c5pq0hbrij34d" path="res://table/table.gd" id="3_4hydx"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat/button-flat.tscn" id="4_7ys3c"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="6_ucntq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cl8h2vaibabyi" path="res://data/кнопка-квадрат-1.png" id="7_x08dr"]
|
||||
|
||||
[node name="frm_ecm_list" type="NinePatchRect"]
|
||||
offset_right = 480.0
|
||||
@@ -55,6 +57,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Включает принудительную помеху"
|
||||
texture_state0 = ExtResource("6_ucntq")
|
||||
texture_state1 = ExtResource("7_x08dr")
|
||||
strips_rotation = 15.0
|
||||
text = "СРН"
|
||||
btn_tooltip = "Включает подавление радионавигации"
|
||||
@@ -66,6 +70,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Включает подавление каналов связи типа JTIDS"
|
||||
texture_state0 = ExtResource("6_ucntq")
|
||||
texture_state1 = ExtResource("7_x08dr")
|
||||
strips_rotation = 15.0
|
||||
text = "JTIDS"
|
||||
btn_tooltip = "Включает подавление радиосвязи типа JTIDS"
|
||||
@@ -76,6 +82,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для принудительного включения группы секторов в режим КУПД"
|
||||
texture_state0 = ExtResource("6_ucntq")
|
||||
texture_state1 = ExtResource("7_x08dr")
|
||||
strips_rotation = 15.0
|
||||
text = "КУПД"
|
||||
btn_tooltip = "Включает подавление каналов управления передачи данных"
|
||||
@@ -86,6 +94,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для принудительного включения группы секторов в режим КУПД"
|
||||
texture_state0 = ExtResource("6_ucntq")
|
||||
texture_state1 = ExtResource("7_x08dr")
|
||||
strips_rotation = 15.0
|
||||
text = "Паника"
|
||||
btn_tooltip = "Включает подавление JTIDS и КУПД"
|
||||
@@ -95,6 +105,8 @@ metadata/rfi_name = "<off>"
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture_state0 = ExtResource("6_ucntq")
|
||||
texture_state1 = ExtResource("7_x08dr")
|
||||
strips_rotation = 15.0
|
||||
text = "Очистить"
|
||||
btn_tooltip = "Выключает все сеансы помех"
|
||||
|
||||
@@ -746,7 +746,7 @@ func _on_threat_update(th) -> void:
|
||||
|
||||
|
||||
func _on_threat_lost(th) -> void:
|
||||
var target = get_parent().get_node(str(th.id))
|
||||
var target = get_parent().get_node_or_null(str(th.id))
|
||||
if target:
|
||||
target.queue_free()
|
||||
|
||||
|
||||
@@ -1,14 +1,42 @@
|
||||
class_name configure extends Panel
|
||||
|
||||
const TableHeader = preload('res://table/header.tscn')
|
||||
const TableToggle = preload('res://table/settings-toggle.tscn')
|
||||
const TableEdit = preload('res://table/ячейка-2.tscn')
|
||||
const TableColorPick = preload('res://table/ячейка-цвет.tscn')
|
||||
@export var TableHeader: PackedScene
|
||||
@export var TableToggle: PackedScene
|
||||
@export var TableEdit: PackedScene
|
||||
@export var TableColorPick: PackedScene
|
||||
|
||||
const ALIGNMENT = [HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
|
||||
const HEADER_ROW = [TableHeader, TableHeader]
|
||||
const HEADER_ROW_TEXT = ['Параметр', 'Значение']
|
||||
const SETTING_TABLE = [
|
||||
const HEADER_ROW_TEXT: = ['Параметр', 'Значение']
|
||||
|
||||
var HEADER_ROW: Array
|
||||
|
||||
## TODO: Придумать как избавиться от индексов
|
||||
## Индексы строк таблицы.
|
||||
const EXTERNAL_CU = 16 ## Внешнее целеуказание
|
||||
const TRASSA = 17 ## Строка - Трасса
|
||||
const SUPPRESS = 18 ## Строка - Подавление
|
||||
const KEYBOARD = 19 ## Строка - Виртуальная клавиатура
|
||||
const HIDE_EMS2 = 20 ## Строка - Скрыть вкладку ЭМС 2
|
||||
const DEBAG_CONTROL = 21 ## Строка - Отладка контроля
|
||||
const COMMIT = 22 ## Строка - Версия УАРЭП
|
||||
const GOS_BTN = 52 ## Разрешить работу по своим целям
|
||||
const COLOR_BTN_ACT = 54 ## Цвет кнопки "Подавление"
|
||||
const COLOR_WHITE = 55 ## Цвет фона схемы
|
||||
const COLOR_BLACK = 56 ## Цвет схемы
|
||||
const COLOR_THEME = 57 ## Цвет темы
|
||||
|
||||
var SETTING_TABLE: Array
|
||||
|
||||
var name_to_line_index: = {} ## Для преобразования названия параметра в номер строки
|
||||
var table_color_instance: Node ## Нода цвета кнопки подавления
|
||||
|
||||
func on_checkbutton_pressed(i_row: int):
|
||||
on_row_pressed(i_row)
|
||||
|
||||
|
||||
func _init_scene_arrays():
|
||||
HEADER_ROW = [TableHeader, TableHeader]
|
||||
SETTING_TABLE = [
|
||||
['Ограниченный режим', TableEdit, TableToggle, 'Ограничть возможности по постановке помех'], # 0
|
||||
['Кнопка «ПД-М4»', TableEdit, TableToggle, 'Разрешить отображение кнопки'], # 1
|
||||
['Кнопка «ПД-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'], # 2
|
||||
@@ -71,48 +99,25 @@ const SETTING_TABLE = [
|
||||
['Время повторной отправки помехи', TableEdit, TableEdit, 'Изменение времени повторной отправки помехи'] ] # 59
|
||||
|
||||
|
||||
## TODO: Придумать как избавиться от индексов
|
||||
## Индексы строк таблицы.
|
||||
const EXTERNAL_CU = 16 ## Внешнее целеуказание
|
||||
const TRASSA = 17 ## Строка - Трасса
|
||||
const SUPPRESS = 18 ## Строка - Подавление
|
||||
const KEYBOARD = 19 ## Строка - Виртуальная клавиатура
|
||||
const HIDE_EMS2 = 20 ## Строка - Скрыть вкладку ЭМС 2
|
||||
const DEBAG_CONTROL = 21 ## Строка - Отладка контроля
|
||||
const COMMIT = 22 ## Строка - Версия УАРЭП
|
||||
const GOS_BTN = 52 ## Разрешить работу по своим целям
|
||||
const COLOR_BTN_ACT = 54 ## Цвет кнопки "Подавление"
|
||||
const COLOR_WHITE = 55 ## Цвет фона схемы
|
||||
const COLOR_BLACK = 56 ## Цвет схемы
|
||||
const COLOR_THEME = 57 ## Цвет темы
|
||||
|
||||
|
||||
var name_to_line_index: = {} ## Для преобразования названия параметра в номер строки
|
||||
var table_color_instance: Node ## Нода цвета кнопки подавления
|
||||
|
||||
func on_checkbutton_pressed(i_row: int):
|
||||
on_row_pressed(i_row)
|
||||
|
||||
|
||||
## Вызывается, когда узел впервые попадает в дерево сцены.
|
||||
func _ready() -> void:
|
||||
setting_tab()
|
||||
if not OS.get_cmdline_args().has('++ограниченный'):
|
||||
return
|
||||
if OS.get_cmdline_args().has('++ограниченный'):
|
||||
$Label2.text = 'Текущий режим доступа: ограниченный'
|
||||
for node in $GridContainer.get_children().filter(func(b): return b is Button):
|
||||
node.disabled = true
|
||||
ProjectSettings.emit_signal('settings_changed')
|
||||
|
||||
|
||||
func on_external_cu_btn_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Внешнее управление', btn.button_pressed)
|
||||
ProjectSettings.set_setting('application/config/%s' % 'Внешнее управление', btn.button_pressed)
|
||||
if btn.button_pressed:
|
||||
signaller.emit_signal('interfer_off_all')
|
||||
_autosave_now()
|
||||
|
||||
|
||||
func on_trassa_btn_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Внешнее указание Трасса', btn.button_pressed)
|
||||
ProjectSettings.set_setting('application/config/%s' % 'Внешнее указание Трасса', btn.button_pressed)
|
||||
_autosave_now()
|
||||
|
||||
|
||||
@@ -180,6 +185,7 @@ func parse_cmd_line_args(settings_data: Dictionary):
|
||||
|
||||
|
||||
func setting_tab():
|
||||
_init_scene_arrays()
|
||||
$heard_table.set_header(HEADER_ROW)
|
||||
$heard_table.set_header_text(HEADER_ROW_TEXT)
|
||||
$heard_table.set_columns_min_size([600, 950])
|
||||
@@ -289,6 +295,7 @@ func on_theme_toggle_pressed(btn: CheckButton) -> void:
|
||||
ProjectSettings.set_setting('application/config/Цвет темы программы', is_light)
|
||||
_autosave_now()
|
||||
|
||||
|
||||
func _update_theme_colors():
|
||||
var color_white = $scroll_set/table.get_node2(1, COLOR_WHITE)
|
||||
var color_black = $scroll_set/table.get_node2(1, COLOR_BLACK)
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bnptm4rlp60dq"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bnptm4rlp60dq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dabpum5iqxc7y" path="res://scenes/настройки/настройки.gd" id="1_60bya"]
|
||||
[ext_resource type="Script" uid="uid://c5pq0hbrij34d" path="res://table/table.gd" id="2_6sx73"]
|
||||
[ext_resource type="PackedScene" uid="uid://ch14g46swx74h" path="res://table/header.tscn" id="2_l8r7w"]
|
||||
[ext_resource type="PackedScene" uid="uid://5rw652cmnybi" path="res://table/settings-toggle.tscn" id="3_6e5sv"]
|
||||
[ext_resource type="PackedScene" uid="uid://dspa16ufrpanp" path="res://table/ячейка-2.tscn" id="4_i0f0r"]
|
||||
[ext_resource type="PackedScene" uid="uid://cug5xjbfdm7x7" path="res://table/ячейка-цвет.tscn" id="5_h2mq4"]
|
||||
|
||||
[node name="Настройки" type="Panel"]
|
||||
script = ExtResource("1_60bya")
|
||||
TableHeader = ExtResource("2_l8r7w")
|
||||
TableToggle = ExtResource("3_6e5sv")
|
||||
TableEdit = ExtResource("4_i0f0r")
|
||||
TableColorPick = ExtResource("5_h2mq4")
|
||||
|
||||
[node name="heard_table" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
|
||||
@@ -698,7 +698,8 @@ func on_th_aoa_update(ths):
|
||||
|
||||
|
||||
func count_threats(ths):
|
||||
$count_all_pad/count_all.text = '%02d' % ths.size() if ths.size() < 100 else 99
|
||||
var c0: int = ths.size() if ths.size() < 100 else 99
|
||||
$count_all_pad/count_all.text = '%02d' % c0
|
||||
var c: int = 0
|
||||
if gos_flag:
|
||||
c = ths.values().filter(func(th: threats.Threat): return th.proto != '').size()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://b276iygic5itk"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://b276iygic5itk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://daudc0s3oox3i" path="res://scenes/работа/работа.gd" id="1_niok4"]
|
||||
[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip/bip.tscn" id="2_br3s6"]
|
||||
@@ -7,8 +7,10 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dymo732qc2doa" path="res://scenes/count-all/count-all-pad.tscn" id="6_e3re7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwti82byphl68" path="res://scenes/count-danger/count-danger-pad.tscn" id="7_2arls"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat/button-flat.tscn" id="8_k0iv2"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="10_bkuib"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1785x8wf1hdg" path="res://data/power-0.png" id="10_cnr1s"]
|
||||
[ext_resource type="PackedScene" uid="uid://ceknxxfu1loo5" path="res://scenes/tilemap/tilemap.tscn" id="10_gtwyg"]
|
||||
[ext_resource type="Texture2D" uid="uid://cl8h2vaibabyi" path="res://data/кнопка-квадрат-1.png" id="11_1yrik"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/diagram/diagram.tscn" id="11_b6su4"]
|
||||
[ext_resource type="Texture2D" uid="uid://csdw3q5dtvu4w" path="res://data/power-1.png" id="11_xp4y6"]
|
||||
[ext_resource type="Texture2D" uid="uid://0sk43ticjaxk" path="res://data/navi-center-0.png" id="12_5ffal"]
|
||||
@@ -96,7 +98,6 @@ text = "Обзорная карта"
|
||||
self_modulate = Color(1, 1, 1, 0.415686)
|
||||
position = Vector2(360, 360)
|
||||
min_zoom_level = 3
|
||||
max_zoom_level_server = 11
|
||||
ship_radius_km = 3.0
|
||||
az = 3.0
|
||||
|
||||
@@ -183,6 +184,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
texture_state0 = ExtResource("10_bkuib")
|
||||
texture_state1 = ExtResource("11_1yrik")
|
||||
strips_rotation = 25.0
|
||||
text = "Строб"
|
||||
metadata/state = 0
|
||||
@@ -192,6 +195,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
texture_state0 = ExtResource("10_bkuib")
|
||||
texture_state1 = ExtResource("11_1yrik")
|
||||
strips_rotation = 25.0
|
||||
text = "Цель"
|
||||
metadata/state = 1
|
||||
@@ -201,6 +206,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
texture_state0 = ExtResource("10_bkuib")
|
||||
texture_state1 = ExtResource("11_1yrik")
|
||||
strips_rotation = 25.0
|
||||
text = "Сектор"
|
||||
pressed = true
|
||||
@@ -355,6 +362,8 @@ offset_bottom = 937.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
texture_state0 = ExtResource("10_bkuib")
|
||||
texture_state1 = ExtResource("11_1yrik")
|
||||
strips_rotation = 25.0
|
||||
text = "Сек. запрета"
|
||||
metadata/state = 0
|
||||
@@ -368,6 +377,8 @@ offset_bottom = 910.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
texture_state0 = ExtResource("10_bkuib")
|
||||
texture_state1 = ExtResource("11_1yrik")
|
||||
strips_rotation = 25.0
|
||||
text = "Сек. работы"
|
||||
metadata/state = 0
|
||||
|
||||
@@ -3,21 +3,33 @@
|
||||
extends PanelContainer
|
||||
|
||||
|
||||
@export var texture_state0: Texture2D = preload('res://data/кнопка-эмс-1.png'):
|
||||
set(val): $state.set_texture(val)
|
||||
@export var texture_state0: Texture2D:
|
||||
set(val):
|
||||
texture_state0 = val
|
||||
if is_inside_tree():
|
||||
$state.set_texture(val)
|
||||
|
||||
|
||||
@export var texture_state1: Texture2D = preload('res://data/кнопка-эмс-0.png'):
|
||||
set(val): $state.set_texture(val)
|
||||
@export var texture_state1: Texture2D:
|
||||
set(val):
|
||||
texture_state1 = val
|
||||
if is_inside_tree():
|
||||
$state.set_texture(val)
|
||||
|
||||
|
||||
@export var text: String = '':
|
||||
set(val): $button.set_text(val)
|
||||
set(val):
|
||||
text = val
|
||||
if is_inside_tree():
|
||||
$button.set_text(val)
|
||||
get: return $button.get_text()
|
||||
|
||||
|
||||
@export var pressed: bool = false:
|
||||
set(val): $button.set_pressed(val)
|
||||
set(val):
|
||||
pressed = val
|
||||
if is_inside_tree():
|
||||
$button.set_pressed(val)
|
||||
get: return $button.is_pressed()
|
||||
|
||||
|
||||
@@ -28,6 +40,14 @@ extends PanelContainer
|
||||
get: return $button.is_toggle_mode()
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
var tst = texture_state1 if $button.pressed else texture_state0
|
||||
$state.set_texture(tst)
|
||||
$button.set_text(text)
|
||||
$button.set_pressed(pressed)
|
||||
$button.set_toggle_mode(toggle_mode)
|
||||
|
||||
|
||||
func set_text (val: String): $button.set_text(val)
|
||||
func set_pressed (val: bool): $button.set_pressed(val)
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://gh3wqymu7cub"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://gh3wqymu7cub"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dhqqyf2pd1scs" path="res://scenes/эмс/кнопка-эмс.gd" id="1_pmsh3"]
|
||||
[ext_resource type="Texture2D" uid="uid://nfpish471rjj" path="res://data/кнопка-эмс-1.png" id="2_0o537"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvxv33noium2h" path="res://data/кнопка-эмс-0.png" id="3_okiyh"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="1"]
|
||||
|
||||
@@ -16,23 +17,19 @@
|
||||
[sub_resource type="StyleBoxEmpty" id="6"]
|
||||
|
||||
[node name="container" type="PanelContainer"]
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
offset_right = 23.0
|
||||
offset_bottom = 19.0
|
||||
theme_override_styles/panel = SubResource("1")
|
||||
script = ExtResource("1_pmsh3")
|
||||
texture_state0 = ExtResource("2_0o537")
|
||||
texture_state1 = ExtResource("3_okiyh")
|
||||
toggle_mode = true
|
||||
|
||||
[node name="state" type="NinePatchRect" parent="."]
|
||||
show_behind_parent = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_0o537")
|
||||
region_rect = Rect2(-1.60803, -1.94625, 31.9305, 25.9868)
|
||||
patch_margin_left = 6
|
||||
patch_margin_top = 5
|
||||
patch_margin_right = 7
|
||||
patch_margin_bottom = 5
|
||||
axis_stretch_horizontal = 2
|
||||
axis_stretch_vertical = 2
|
||||
texture = ExtResource("3_okiyh")
|
||||
region_rect = Rect2(3, 2, 22, 18)
|
||||
|
||||
[node name="button" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
class_name ems extends Panel
|
||||
|
||||
## Предзагрузка ячеек таблиц.
|
||||
const TableHeader = preload('res://table/header.tscn')
|
||||
const TableLabel = preload('res://table/lable.tscn')
|
||||
const CellYemsButton = preload('res://scenes/эмс/кнопка-эмс.tscn')
|
||||
const CellLineEdit = preload('res://table/ячейка-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 CellFront = preload('res://scenes/cell/cell-front.tscn')
|
||||
const CellFrontRear = preload('res://scenes/cell/cell-front-rear.tscn')
|
||||
@export var TableHeader: PackedScene
|
||||
@export var TableLabel: PackedScene
|
||||
@export var CellYemsButton: PackedScene
|
||||
@export var CellLineEdit: PackedScene
|
||||
@export var CellState: PackedScene
|
||||
@export var CellOptBtn: PackedScene
|
||||
@export var CellLEEmpty: PackedScene
|
||||
@export var CellFront: PackedScene
|
||||
@export var CellFrontRear: PackedScene
|
||||
|
||||
## Режимы работы выходов.
|
||||
const OUT_MODE: Array = ['Работа', 'Контроль', '0', '1'] #
|
||||
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]
|
||||
var OUT_SET_ROW: Array
|
||||
var IN_SET_ROW: Array
|
||||
|
||||
var FILES_ROWS_TYPES = [CellLineEdit, CellLineEdit, CellLineEdit ]
|
||||
var FILES_ROWS_TYPES: Array
|
||||
|
||||
var g_boards: Dictionary ## Словарь плат ЭМС.
|
||||
var active_board = null ## Активная плата ЭМС
|
||||
@@ -32,6 +32,9 @@ func _ready() -> void:
|
||||
|
||||
## Инициализация основных элементов экрана ЭМС.
|
||||
func init_boards():
|
||||
OUT_SET_ROW = [CellLineEdit, CellLEEmpty, CellLEEmpty, CellLEEmpty, CellLEEmpty, CellLEEmpty]
|
||||
IN_SET_ROW = [CellLineEdit, CellLEEmpty, CellLEEmpty, CellLEEmpty, CellLEEmpty]
|
||||
FILES_ROWS_TYPES = [CellLineEdit, CellLineEdit, CellLineEdit ]
|
||||
var unit_ems = network.get_unit_instance('уарэп-эмс')
|
||||
|
||||
# Выставление позиций элементов ЭМС на экране
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
[gd_scene load_steps=20 format=3 uid="uid://dab6loryocc73"]
|
||||
[gd_scene load_steps=30 format=3 uid="uid://dab6loryocc73"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://do1s7qg4bmxqy" path="res://scenes/эмс/эмс.gd" id="1_mk57x"]
|
||||
[ext_resource type="PackedScene" uid="uid://ch14g46swx74h" path="res://table/header.tscn" id="2_1fbmy"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat/button-flat.tscn" id="2_eju8r"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwphmxstaxn4v" path="res://table/lable.tscn" id="3_31xk8"]
|
||||
[ext_resource type="Texture2D" uid="uid://csnts8f155sf7" path="res://data/save1.png" id="3_onafb"]
|
||||
[ext_resource type="Texture2D" uid="uid://o8mam0a060d8" path="res://data/load1.png" id="4_afjfs"]
|
||||
[ext_resource type="PackedScene" uid="uid://dspa16ufrpanp" path="res://table/ячейка-2.tscn" id="4_o3av6"]
|
||||
[ext_resource type="PackedScene" uid="uid://by22sta8tt8dn" path="res://scenes/эмс/состояния-эмс.tscn" id="5_owc4r"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdlbqs88bki8x" path="res://data/connect-a.png" id="5_wk8og"]
|
||||
[ext_resource type="Texture2D" uid="uid://u3tnejvpm8it" path="res://data/disconnect-a.png" id="6_1fbmy"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwcol6jg2syof" path="res://scenes/эмс/кнопка-5.tscn" id="6_k0fjr"]
|
||||
[ext_resource type="PackedScene" uid="uid://c480ipkjckkdn" path="res://scenes/эмс/line-edit-empty.tscn" id="7_k0fjr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bccr42bckei41" path="res://scenes/cell/cell-front.tscn" id="8_k30d1"]
|
||||
[ext_resource type="Script" uid="uid://c5pq0hbrij34d" path="res://table/table.gd" id="8_qcl30"]
|
||||
[ext_resource type="PackedScene" uid="uid://b8txs4xi722wt" path="res://scenes/cell/cell-front-rear.tscn" id="9_js36y"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="11_g8xrc"]
|
||||
[ext_resource type="Texture2D" uid="uid://cl8h2vaibabyi" path="res://data/кнопка-квадрат-1.png" id="12_4mue7"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mu34x"]
|
||||
texture = ExtResource("3_onafb")
|
||||
@@ -64,6 +74,15 @@ texture = ExtResource("6_1fbmy")
|
||||
offset_right = 1598.0
|
||||
offset_bottom = 1201.0
|
||||
script = ExtResource("1_mk57x")
|
||||
TableHeader = ExtResource("2_1fbmy")
|
||||
TableLabel = ExtResource("3_31xk8")
|
||||
CellYemsButton = ExtResource("4_o3av6")
|
||||
CellLineEdit = ExtResource("4_o3av6")
|
||||
CellState = ExtResource("5_owc4r")
|
||||
CellOptBtn = ExtResource("6_k0fjr")
|
||||
CellLEEmpty = ExtResource("7_k0fjr")
|
||||
CellFront = ExtResource("8_k30d1")
|
||||
CellFrontRear = ExtResource("9_js36y")
|
||||
|
||||
[node name="lbl_online" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -79,6 +98,8 @@ offset_left = 1446.0
|
||||
offset_top = 55.0
|
||||
offset_right = 1583.0
|
||||
offset_bottom = 85.0
|
||||
texture_state0 = ExtResource("11_g8xrc")
|
||||
texture_state1 = ExtResource("12_4mue7")
|
||||
strips_rotation = 10.0
|
||||
text = "Прочитать"
|
||||
|
||||
@@ -88,6 +109,8 @@ offset_left = 1446.0
|
||||
offset_top = 99.0
|
||||
offset_right = 1583.0
|
||||
offset_bottom = 129.0
|
||||
texture_state0 = ExtResource("11_g8xrc")
|
||||
texture_state1 = ExtResource("12_4mue7")
|
||||
strips_rotation = 10.0
|
||||
text = "Записать"
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ func _ready() -> void:
|
||||
signaller.connect('sector_klaster', Callable(self, 'on_sector_klaster').bind(unit_trassa))
|
||||
|
||||
|
||||
func on_trassa_line_changed(unit_trassa):
|
||||
func on_trassa_line_changed(_unit_trassa):
|
||||
pass
|
||||
|
||||
|
||||
func on_sector_klaster(_data, unit_trassa):
|
||||
func on_sector_klaster(_data, _unit_trassa):
|
||||
pass
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class_name PRDConfigManager
|
||||
extends RefCounted
|
||||
|
||||
## Менеджер конфигурации для системы контроля ПРД
|
||||
## Загружает и управляет настройками из JSON-конфигурации
|
||||
## Менеджер конфигурации для системы контроля ПРД.
|
||||
## Загружает и управляет настройками из JSON-конфигурации.
|
||||
|
||||
#region CONSTANTS
|
||||
const CONFIG_PATH = 'user://config/setting-prd-control.json'
|
||||
@@ -11,18 +11,18 @@ const CONFIG_VERSION = '1.0.0' # Версия конфигурации - уве
|
||||
#endregion
|
||||
|
||||
#region PRIVATE_VARIABLES
|
||||
var _config_data: Dictionary # Все данные конфигурации
|
||||
var _device_constants: Dictionary # Константы устройств
|
||||
var _base_configs: Dictionary # Базовые конфигурации
|
||||
var _device_configs: Dictionary # Конфигурации устройств
|
||||
var _data_indices: Dictionary # Индексы данных
|
||||
var _fs_keys: Dictionary # Ключи ФС (функциональных систем)
|
||||
var _temperature_constants: Dictionary # Константы температуры
|
||||
var _ems_input_bits_config: Dictionary # Конфигурация битов ввода ЭМС
|
||||
var _fs_rules: Array # Правила ФС
|
||||
var _config_data: Dictionary ## Все данные конфигурации
|
||||
var _device_constants: Dictionary ## Константы устройств
|
||||
var _base_configs: Dictionary ## Базовые конфигурации
|
||||
var _device_configs: Dictionary ## Конфигурации устройств
|
||||
var _data_indices: Dictionary ## Индексы данных
|
||||
var _fs_keys: Dictionary ## Ключи ФС (функциональных систем)
|
||||
var _temperature_constants: Dictionary ## Константы температуры
|
||||
var _ems_input_bits_config: Dictionary ## Конфигурация битов ввода ЭМС
|
||||
var _fs_rules: Array ## Правила ФС
|
||||
|
||||
var _is_loaded: bool = false # Флаг успешной загрузки
|
||||
var _current_version: String = '' # Текущая версия загруженной конфигурации
|
||||
var _is_loaded: bool = false ## Флаг успешной загрузки
|
||||
var _current_version: String ## Текущая версия загруженной конфигурации
|
||||
#endregion
|
||||
|
||||
#region INITIALIZATION
|
||||
@@ -215,7 +215,6 @@ func _update_config() -> bool:
|
||||
if FileAccess.file_exists(CONFIG_PATH):
|
||||
var backup_path = CONFIG_PATH + '.backup_v' + _current_version
|
||||
DirAccess.copy_absolute(CONFIG_PATH, backup_path)
|
||||
print('Создана резервная копия: ', backup_path)
|
||||
|
||||
# Копируем актуальную конфигурацию
|
||||
return _copy_default_config()
|
||||
@@ -224,7 +223,7 @@ func _update_config() -> bool:
|
||||
## Копирует дефолтную конфигурацию в user директорию
|
||||
func _copy_default_config() -> bool:
|
||||
if not FileAccess.file_exists(DEFAULT_CONFIG_PATH):
|
||||
push_error('Дефолтный файл конфигурации не найден: ' + DEFAULT_CONFIG_PATH)
|
||||
push_error('Файл конфигурации не найден: ' + DEFAULT_CONFIG_PATH)
|
||||
return false
|
||||
|
||||
var src := FileAccess.open(DEFAULT_CONFIG_PATH, FileAccess.READ)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
extends LineEdit
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('read_only').duplicate()
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
add_theme_color_override('font_color_readonly', Color.BLACK)
|
||||
add_theme_color_override('font_color_placeholder', Color(0, 0, 0, 0.5))
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_color_override('font_color_readonly', Color('#D8731A')) # тёмно-оранжевый
|
||||
add_theme_color_override('font_color_placeholder', Color(1, 1, 1, 0.5))
|
||||
add_theme_stylebox_override('read_only', style)
|
||||
@@ -1 +0,0 @@
|
||||
uid://bky7xlpaj21sj
|
||||
@@ -1,10 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bvbvtgwps54yr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bky7xlpaj21sj" path="res://table/editl.gd" id="1_xd53c"]
|
||||
|
||||
[node name="Editl" type="LineEdit"]
|
||||
offset_right = 59.875
|
||||
offset_bottom = 33.0
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
script = ExtResource("1_xd53c")
|
||||
@@ -1,15 +1,24 @@
|
||||
extends Label
|
||||
|
||||
static var styles: = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
|
||||
func _init() -> void:
|
||||
if init_done:
|
||||
init_done = true
|
||||
var style_light: = get_theme_stylebox('normal')
|
||||
style_light.bg_color = Color.GRAY
|
||||
styles[1] = style_light
|
||||
var style_dark: = style_light.duplicate(true)
|
||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||
styles[0] = style_dark
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
apply_colors()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('normal').duplicate()
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
|
||||
add_theme_stylebox_override('normal', styles[1])
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_stylebox_override('normal', style)
|
||||
add_theme_stylebox_override('normal', styles[0])
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
extends LineEdit
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
static var styles: = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
func _init() -> void:
|
||||
if not init_done:
|
||||
init_done = true
|
||||
var style_light: = get_theme_stylebox('read_only')
|
||||
style_light.bg_color = Color.GRAY
|
||||
styles[1] = style_light
|
||||
var style_dark: = style_light.duplicate(true)
|
||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||
styles[0] = style_dark
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
apply_colors()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('read_only').duplicate()
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
|
||||
add_theme_color_override('font_color_readonly', Color.BLACK)
|
||||
add_theme_color_override('font_color_placeholder', Color(0, 0, 0, 0.5))
|
||||
add_theme_stylebox_override('read_only', styles[1])
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_color_override('font_color_readonly', Color('#D8731A')) # тёмно-оранжевый
|
||||
add_theme_color_override('font_color_placeholder', Color(1, 1, 1, 0.5))
|
||||
add_theme_stylebox_override('read_only', style)
|
||||
add_theme_stylebox_override('read_only', styles[0])
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
extends LineEdit
|
||||
|
||||
static var styles: = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
var checkbutton_material: Material
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
func _init() -> void:
|
||||
if not init_done:
|
||||
init_done = true
|
||||
var style_light: = get_theme_stylebox('read_only')
|
||||
style_light.bg_color = Color.GRAY
|
||||
styles[1] = style_light
|
||||
var style_dark: = style_light.duplicate(true)
|
||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||
styles[0] = style_dark
|
||||
ProjectSettings.connect('settings_changed', on_setting_changed)
|
||||
call_deferred('on_setting_changed')
|
||||
|
||||
|
||||
func on_setting_changed():
|
||||
var cb = $CheckButton
|
||||
checkbutton_material = cb.material
|
||||
checkbutton_material = $CheckButton.material
|
||||
apply_colors()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('read_only').duplicate()
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
|
||||
add_theme_stylebox_override('read_only', styles[1])
|
||||
$CheckButton.material = null
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_stylebox_override('read_only', style)
|
||||
var cb = $CheckButton
|
||||
if is_light:
|
||||
cb.material = null
|
||||
else:
|
||||
cb.material = checkbutton_material
|
||||
add_theme_stylebox_override('read_only', styles[0])
|
||||
$CheckButton.material = checkbutton_material
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
extends LineEdit
|
||||
|
||||
static var styles: = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
var checkbutton_material: Material
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
func _init() -> void:
|
||||
ProjectSettings.connect('settings_changed', on_setting_changed)
|
||||
if not init_done:
|
||||
init_done = true
|
||||
var style_light: = get_theme_stylebox('read_only')
|
||||
style_light.bg_color = Color.GRAY
|
||||
styles[1] = style_light
|
||||
var style_dark: = style_light.duplicate(true)
|
||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||
styles[0] = style_dark
|
||||
|
||||
|
||||
func on_setting_changed():
|
||||
var cb = $CheckButton
|
||||
checkbutton_material = cb.material
|
||||
checkbutton_material = $CheckButton.material
|
||||
apply_colors()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('read_only').duplicate()
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false)
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
add_theme_stylebox_override('read_only', styles[1])
|
||||
$CheckButton.material = null
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_stylebox_override('read_only', style)
|
||||
var cb = $CheckButton
|
||||
if is_light:
|
||||
cb.material = null
|
||||
else:
|
||||
cb.material = checkbutton_material
|
||||
add_theme_stylebox_override('read_only', styles[0])
|
||||
$CheckButton.material = checkbutton_material
|
||||
|
||||
@@ -1,23 +1,39 @@
|
||||
extends LineEdit
|
||||
|
||||
static var styles = [[null, null], [null, null]]
|
||||
static var init_done: = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
|
||||
func _init() -> void:
|
||||
if not init_done:
|
||||
init_done = true
|
||||
var style_0_light = get_theme_stylebox('normal')
|
||||
var style_1_light = get_theme_stylebox('read_only')
|
||||
|
||||
style_0_light.bg_color = Color(0.12, 0.12, 0.12)
|
||||
style_1_light.bg_color = Color(0.12, 0.12, 0.12)
|
||||
styles[1][0] = style_0_light
|
||||
styles[1][1] = style_1_light
|
||||
|
||||
var style_0_dark = style_0_light.duplicate(true)
|
||||
var style_1_dark = style_1_light.duplicate(true)
|
||||
|
||||
style_0_light.bg_color = Color.GRAY
|
||||
style_1_light.bg_color = Color.GRAY
|
||||
styles[0][0] = style_0_dark
|
||||
styles[0][1] = style_1_dark
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
apply_colors()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('normal').duplicate()
|
||||
var style_1 = get_theme_stylebox('read_only').duplicate()
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
style_1.bg_color = Color.GRAY
|
||||
if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
|
||||
add_theme_color_override('font_color', Color.BLACK)
|
||||
add_theme_color_override('font_uneditable_color', Color.BLACK)
|
||||
add_theme_stylebox_override('normal', styles[1][0])
|
||||
add_theme_stylebox_override('read_only', styles[1][1])
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
style_1.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_color_override('font_color', Color(1.0, 0.596, 0.4))
|
||||
add_theme_color_override('font_uneditable_color', Color(1.0, 0.596, 0.4))
|
||||
add_theme_stylebox_override('normal', style)
|
||||
add_theme_stylebox_override('read_only', style_1)
|
||||
add_theme_stylebox_override('normal', styles[0][0])
|
||||
add_theme_stylebox_override('read_only', styles[0][1])
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
extends ColorPickerButton
|
||||
|
||||
static var styles = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
|
||||
func _init() -> void:
|
||||
if not init_done:
|
||||
init_done = true
|
||||
var style_light: = get_theme_stylebox('normal')
|
||||
style_light.bg_color = Color.GRAY
|
||||
styles[1] = style_light
|
||||
var style_dark: = style_light.duplicate(true)
|
||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||
styles[0] = style_dark
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
apply_colors()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('normal').duplicate()
|
||||
if is_light:
|
||||
style.bg_color = Color.GRAY
|
||||
if ProjectSettings.get_setting('application/config/%s' % 'Цвет темы программы', false):
|
||||
add_theme_stylebox_override('normal', styles[1])
|
||||
else:
|
||||
style.bg_color = Color(0.12, 0.12, 0.12)
|
||||
add_theme_stylebox_override('normal', style)
|
||||
add_theme_stylebox_override('normal', styles[0])
|
||||
|
||||
Reference in New Issue
Block a user