Доработка. Теперь цветовая схема инициализируется при создании элемента
This commit is contained in:
@@ -15,10 +15,8 @@ func _init() -> void:
|
|||||||
var style_dark: = style_light.duplicate(true)
|
var style_dark: = style_light.duplicate(true)
|
||||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||||
styles[0] = style_dark
|
styles[0] = style_dark
|
||||||
|
ProjectSettings.connect('settings_changed', on_setting_changed)
|
||||||
|
call_deferred('on_setting_changed')
|
||||||
func _exit_tree() -> void:
|
|
||||||
ProjectSettings.disconnect('settings_changed', on_setting_changed)
|
|
||||||
|
|
||||||
|
|
||||||
func on_setting_changed():
|
func on_setting_changed():
|
||||||
|
|||||||
@@ -392,8 +392,6 @@ func add_row(row_types: Array) -> void:
|
|||||||
_assert(node.get('name') is StringName, 'экземпляр не имеет поля \"name\"')
|
_assert(node.get('name') is StringName, 'экземпляр не имеет поля \"name\"')
|
||||||
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||||
node.name = node_key
|
node.name = node_key
|
||||||
if node.has_method('apply_colors'):
|
|
||||||
node.apply_colors()
|
|
||||||
add_child(node)
|
add_child(node)
|
||||||
if allow_set_size:
|
if allow_set_size:
|
||||||
node.custom_minimum_size.x = columns_min_size[i_col]
|
node.custom_minimum_size.x = columns_min_size[i_col]
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ static var init_done: = false
|
|||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
ProjectSettings.connect('settings_changed', apply_colors)
|
|
||||||
if not init_done:
|
if not init_done:
|
||||||
init_done = true
|
init_done = true
|
||||||
var style_0_light = get_theme_stylebox('normal')
|
var style_0_light = get_theme_stylebox('normal')
|
||||||
@@ -23,6 +22,8 @@ func _init() -> void:
|
|||||||
style_1_light.bg_color = Color.GRAY
|
style_1_light.bg_color = Color.GRAY
|
||||||
styles[0][0] = style_0_dark
|
styles[0][0] = style_0_dark
|
||||||
styles[0][1] = style_1_dark
|
styles[0][1] = style_1_dark
|
||||||
|
ProjectSettings.connect('settings_changed', apply_colors)
|
||||||
|
apply_colors()
|
||||||
|
|
||||||
|
|
||||||
func apply_colors():
|
func apply_colors():
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ static var init_done: = false
|
|||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
ProjectSettings.connect('settings_changed', apply_colors)
|
|
||||||
if not init_done:
|
if not init_done:
|
||||||
init_done = true
|
init_done = true
|
||||||
var style_light: = get_theme_stylebox('normal')
|
var style_light: = get_theme_stylebox('normal')
|
||||||
@@ -14,6 +13,8 @@ func _init() -> void:
|
|||||||
var style_dark: = style_light.duplicate(true)
|
var style_dark: = style_light.duplicate(true)
|
||||||
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
style_dark.bg_color = Color(0.12, 0.12, 0.12)
|
||||||
styles[0] = style_dark
|
styles[0] = style_dark
|
||||||
|
ProjectSettings.connect('settings_changed', apply_colors)
|
||||||
|
apply_colors()
|
||||||
|
|
||||||
|
|
||||||
func apply_colors():
|
func apply_colors():
|
||||||
|
|||||||
Reference in New Issue
Block a user