Регрессия. Производительность. Обращение к полю Control.bg_color занимает очень много времени
This commit is contained in:
@@ -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,19 +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)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('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,23 +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)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('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,10 +1,20 @@
|
||||
extends LineEdit
|
||||
|
||||
static var styles = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
var checkbutton_material: Material
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', on_setting_changed)
|
||||
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
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
@@ -12,21 +22,14 @@ func _exit_tree() -> void:
|
||||
|
||||
|
||||
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,10 +1,21 @@
|
||||
extends LineEdit
|
||||
|
||||
static var styles = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
var checkbutton_material: Material
|
||||
|
||||
|
||||
func _ready() -> 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():
|
||||
@@ -13,15 +24,10 @@ func on_setting_changed():
|
||||
|
||||
|
||||
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,38 @@
|
||||
extends LineEdit
|
||||
|
||||
static var styles = [[null, null], [null, null]]
|
||||
static var init_done: = false
|
||||
|
||||
func _enter_tree() -> void: ProjectSettings.connect('settings_changed', apply_colors)
|
||||
func _exit_tree() -> void: ProjectSettings.disconnect('settings_changed', apply_colors)
|
||||
|
||||
func _init() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
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
|
||||
|
||||
|
||||
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,19 +1,23 @@
|
||||
extends ColorPickerButton
|
||||
|
||||
static var styles = [null, null]
|
||||
static var init_done: = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
|
||||
func _init() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('settings_changed', apply_colors)
|
||||
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
|
||||
|
||||
|
||||
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