Рефактор. Уменьшить количество файлов
This commit is contained in:
@@ -1,6 +1,34 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c1i4rwaajq7d5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c71233c2tqc2u" path="res://table/node.gd" id="1_oh3pj"]
|
||||
[sub_resource type="GDScript" id="GDScript_eegm3"]
|
||||
script/source = "extends LineEdit
|
||||
|
||||
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():
|
||||
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:
|
||||
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', styles[0])
|
||||
"
|
||||
|
||||
[node name="Label" type="LineEdit"]
|
||||
offset_right = 121.0
|
||||
@@ -10,4 +38,4 @@ editable = false
|
||||
context_menu_enabled = false
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.1
|
||||
script = ExtResource("1_oh3pj")
|
||||
script = SubResource("GDScript_eegm3")
|
||||
|
||||
Reference in New Issue
Block a user