WIP Исправление. Производительность
This commit is contained in:
@@ -97,11 +97,11 @@ func on_checkbutton_pressed(i_row: int):
|
||||
## Вызывается, когда узел впервые попадает в дерево сцены.
|
||||
func _ready() -> void:
|
||||
setting_tab()
|
||||
if not OS.get_cmdline_args().has('++ограниченный'):
|
||||
return
|
||||
$Label2.text = 'Текущий режим доступа: ограниченный'
|
||||
for node in $GridContainer.get_children().filter(func(b): return b is Button):
|
||||
node.disabled = true
|
||||
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:
|
||||
|
||||
@@ -5,6 +5,10 @@ func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func apply_colors():
|
||||
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
|
||||
var style = get_theme_stylebox('normal').duplicate()
|
||||
|
||||
@@ -5,6 +5,10 @@ func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('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()
|
||||
|
||||
@@ -7,6 +7,10 @@ func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', on_setting_changed)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('settings_changed', on_setting_changed)
|
||||
|
||||
|
||||
func on_setting_changed():
|
||||
var cb = $CheckButton
|
||||
checkbutton_material = cb.material
|
||||
|
||||
@@ -7,6 +7,10 @@ func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', on_setting_changed)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func on_setting_changed():
|
||||
var cb = $CheckButton
|
||||
checkbutton_material = cb.material
|
||||
|
||||
@@ -392,6 +392,8 @@ func add_row(row_types: Array) -> void:
|
||||
_assert(node.get('name') is StringName, 'экземпляр не имеет поля \"name\"')
|
||||
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
node.name = node_key
|
||||
if node.has_method('apply_colors'):
|
||||
node.apply_colors()
|
||||
add_child(node)
|
||||
if allow_set_size:
|
||||
node.custom_minimum_size.x = columns_min_size[i_col]
|
||||
@@ -400,7 +402,6 @@ func add_row(row_types: Array) -> void:
|
||||
var conn = Callable(self, '_on_focus_entered').bind(node)
|
||||
node.connect('focus_entered', conn)
|
||||
set_node_meta(i_col, i_row, 'callable_focus_entered', conn)
|
||||
call_deferred("apply_theme")
|
||||
|
||||
|
||||
func _set_size_x_defered(node: Control, val: Vector2):
|
||||
@@ -411,7 +412,6 @@ func _set_size_x_defered(node: Control, val: Vector2):
|
||||
func _on_focus_entered(node):
|
||||
var indexes = get_key_indexes(node.name)
|
||||
emit_signal('row_pressed', indexes[1])
|
||||
ProjectSettings.connect('settings_changed', apply_theme)
|
||||
|
||||
|
||||
##
|
||||
@@ -521,7 +521,6 @@ func rehash():
|
||||
next_index(i_slct)
|
||||
nodes.clear()
|
||||
nodes.merge(nodes_copy)
|
||||
call_deferred('apply_theme')
|
||||
|
||||
|
||||
## Удаляет все строки таблицы
|
||||
@@ -717,9 +716,3 @@ func get_row_rect(i_row: int, rect: Array, key_format: String = NODE_KEY_FORMAT)
|
||||
rect[1] = cell0.position.y + scroll_adj.y
|
||||
rect[2] = (cell1.position.x - cell0.position.x) + cell1.size.x
|
||||
rect[3] = cell0.size.y
|
||||
|
||||
|
||||
func apply_theme():
|
||||
for node in nodes.values():
|
||||
if node is LineEdit and node.has_method('apply_colors'):
|
||||
node.apply_colors()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
extends LineEdit
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
# Вызывается
|
||||
func _enter_tree() -> void: ProjectSettings.connect('settings_changed', apply_colors)
|
||||
func _exit_tree() -> void: ProjectSettings.disconnect('settings_changed', apply_colors)
|
||||
func _ready() -> void: print_debug()
|
||||
|
||||
|
||||
func apply_colors():
|
||||
|
||||
@@ -3,6 +3,10 @@ extends ColorPickerButton
|
||||
|
||||
func _enter_tree() -> void:
|
||||
ProjectSettings.connect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('settings_changed', apply_colors)
|
||||
|
||||
|
||||
func apply_colors():
|
||||
|
||||
Reference in New Issue
Block a user