Merge pull request #26 from Calinou/improve-library-filter

Improve filtering in the library
This commit is contained in:
Rodz Labs 2019-10-19 01:34:45 +02:00 committed by GitHub
commit 94213e7a1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View File

@ -4,6 +4,7 @@ extends VBoxContainer
var libraries = []
onready var tree : Tree = $Tree
onready var filter_line_edit : LineEdit = $HBoxContainer/Filter
func _ready():
tree.set_column_expand(0, true)
@ -15,6 +16,10 @@ func _ready():
add_library("user://library/user.json")
update_tree()
func _unhandled_input(event : InputEvent) -> void:
if event is InputEventKey and event.pressed and event.command and event.scancode == KEY_F:
filter_line_edit.grab_focus()
func get_selected_item_name():
var tree_item : TreeItem = tree.get_selected()
var rv = ""

View File

@ -7,22 +7,13 @@
margin_right = 352.0
margin_bottom = 423.0
script = ExtResource( 1 )
[node name="Tree" type="Tree" parent="."]
margin_right = 352.0
margin_bottom = 395.0
rect_min_size = Vector2( 100, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
hide_root = true
select_mode = 1
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_top = 399.0
margin_right = 352.0
margin_bottom = 423.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="FilterLabel" type="Label" parent="HBoxContainer"]
@ -36,4 +27,16 @@ margin_left = 41.0
margin_right = 352.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="Tree" type="Tree" parent="."]
margin_top = 28.0
margin_right = 352.0
margin_bottom = 423.0
rect_min_size = Vector2( 100, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
hide_root = true
select_mode = 1
script = ExtResource( 2 )
[connection signal="text_changed" from="HBoxContainer/Filter" to="." method="_on_Filter_text_changed"]