Merge remote-tracking branch 'MaD_CaT/master'
# Conflicts: # scenes/frm_threats.gd # scenes/tab_switch.gd # scenes/ЭМС.gd # scenes/работа.gd # scenes/работа.tscn # scripts/repnetwork.gd # scripts/threats.gd # scripts/yems_devs.gd # table/table.gd
This commit is contained in:
@@ -41,13 +41,13 @@ func _assert_meta(i_col: int, i_row: int, pname: String, node): assert(node.has_
|
||||
|
||||
|
||||
func pin_header(scrl: ScrollContainer, prnt: Control):
|
||||
scrl.remove_child(header)
|
||||
prnt.add_child(header)
|
||||
# TODO: Это значение следует получить из темы
|
||||
var v_separation: = 3.0
|
||||
header.position = scrl.position - Vector2(0, header.size.y + v_separation)
|
||||
scroll = scrl
|
||||
scroll_adj = scrl.position
|
||||
scrl.remove_child(header)
|
||||
prnt.add_child(header)
|
||||
# TODO: Это значение следует получить из темы
|
||||
var v_separation: = 3.0
|
||||
header.position = scrl.position - Vector2(0, header.size.y + v_separation)
|
||||
scroll = scrl
|
||||
scroll_adj = scrl.position
|
||||
|
||||
|
||||
func selector_up():
|
||||
@@ -278,30 +278,30 @@ func set_node_user_data(i_col: int, i_row: int, user_data: Object) -> void:
|
||||
|
||||
|
||||
func add_row(row_types: Array) -> void:
|
||||
assert(row_types.size() < MAX_INDEX, 'ошибка: слишком много колонок, больше %d' % (MAX_INDEX + 1))
|
||||
if columns == 1:
|
||||
set_columns(row_types.size())
|
||||
else:
|
||||
assert(columns == row_types.size(), 'ошибка: %s количество колонок установлено ранее - %d, но требуется %d' % [self, columns, row_types.size()])
|
||||
var i_row: int = get_rows_count()
|
||||
assert(i_row < MAX_INDEX, 'ошибка: слишком много рядов, больше %d' % (MAX_INDEX + 1))
|
||||
for i_col in columns:
|
||||
var node = row_types[i_col].instantiate()
|
||||
var head = nodes[HEAD_KEY_FORMAT % [0, i_col]]
|
||||
node.custom_minimum_size.x = head.custom_minimum_size.x
|
||||
node.size.x = head.size.x
|
||||
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
node.name = node_key
|
||||
add_child(node)
|
||||
nodes[node_key] = node
|
||||
var conn = Callable(self, '_on_focus_entered').bind(node)
|
||||
assert(row_types.size() < MAX_INDEX, 'ошибка: слишком много колонок, больше %d' % (MAX_INDEX + 1))
|
||||
if columns == 1:
|
||||
set_columns(row_types.size())
|
||||
else:
|
||||
assert(columns == row_types.size(), 'ошибка: %s количество колонок установлено ранее - %d, но требуется %d' % [self, columns, row_types.size()])
|
||||
var i_row: int = get_rows_count()
|
||||
assert(i_row < MAX_INDEX, 'ошибка: слишком много рядов, больше %d' % (MAX_INDEX + 1))
|
||||
for i_col in columns:
|
||||
var node = row_types[i_col].instantiate()
|
||||
var head = nodes[HEAD_KEY_FORMAT % [0, i_col]]
|
||||
node.custom_minimum_size.x = head.custom_minimum_size.x
|
||||
node.set_deferred('size.x', head.size.x)
|
||||
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
|
||||
node.name = node_key
|
||||
add_child(node)
|
||||
nodes[node_key] = node
|
||||
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)
|
||||
|
||||
|
||||
func _on_focus_entered(node):
|
||||
var indexes = get_key_indexes(node.name)
|
||||
emit_signal('row_pressed', indexes[1])
|
||||
var indexes = get_key_indexes(node.name)
|
||||
emit_signal('row_pressed', indexes[1])
|
||||
|
||||
|
||||
func set_header(header_types: Array):
|
||||
@@ -353,7 +353,7 @@ func remove_row(i_row: int):
|
||||
if nodes.has(sel_key):
|
||||
var selector = nodes[sel_key]
|
||||
var prnt = selector.get_parent()
|
||||
prnt.remove_child(selector)
|
||||
prnt.remove_child(selector)
|
||||
selector.queue_free()
|
||||
nodes.erase(sel_key)
|
||||
|
||||
@@ -372,8 +372,8 @@ func remove_row(i_row: int):
|
||||
|
||||
if nodes.has(conn_key):
|
||||
conn = nodes[conn_key]
|
||||
node.disconnect('pressed', conn)
|
||||
nodes.erase(conn_key)
|
||||
node.disconnect('pressed', conn)
|
||||
nodes.erase(conn_key)
|
||||
|
||||
remove_child(node)
|
||||
nodes.erase(node_key)
|
||||
@@ -398,9 +398,9 @@ func swap_nodes(nodes_copy, node_key_format, i0, i1) -> void:
|
||||
func rehash():
|
||||
""" Переназначает ключи в соответствии с размерами таблицы.
|
||||
После вызова swaps содержит массив пар [<прежний ключ>, <текущий ключ>] """
|
||||
var i_node: = [Vector2i()]
|
||||
var i_hdr: = [Vector2i()]
|
||||
var i_slct: = [Vector2i()]
|
||||
var i_node: = [Vector2i()]
|
||||
var i_hdr: = [Vector2i()]
|
||||
var i_slct: = [Vector2i()]
|
||||
var i_conn: = [Vector2i()]
|
||||
var i_data: = [Vector2i()]
|
||||
var nodes_copy = {}
|
||||
@@ -409,21 +409,21 @@ func rehash():
|
||||
var i0 = Vector2(iv[0], iv[1])
|
||||
if HEAD_PREFIX in key:
|
||||
swap_nodes(nodes_copy, HEAD_KEY_FORMAT, i0, i_hdr[0])
|
||||
next_index(i_hdr)
|
||||
next_index(i_hdr)
|
||||
elif NODE_PREFIX in key:
|
||||
swap_nodes(nodes_copy, NODE_KEY_FORMAT, i0, i_node[0])
|
||||
next_index(i_node)
|
||||
elif SLCT_PREFIX in key:
|
||||
swap_nodes(nodes_copy, ROW_SELECTOR_KEY_FORMAT, i0, i_slct[0])
|
||||
next_index(i_slct)
|
||||
swap_nodes(nodes_copy, ROW_SELECTOR_KEY_FORMAT, i0, i_slct[0])
|
||||
next_index(i_slct)
|
||||
elif CONN_PREFIX in key:
|
||||
swap_nodes(nodes_copy, CONNECTED_KEY_FORMAT, i0, i_conn[0])
|
||||
next_index(i_conn)
|
||||
elif DATA_PREFIX in key:
|
||||
swap_nodes(nodes_copy, DATA_KEY_FORMAT, i0, i_data[0])
|
||||
next_index(i_data)
|
||||
nodes.clear()
|
||||
nodes.merge(nodes_copy)
|
||||
nodes.clear()
|
||||
nodes.merge(nodes_copy)
|
||||
|
||||
|
||||
func clear_rows() -> void:
|
||||
|
||||
Reference in New Issue
Block a user