@@ -8,9 +8,9 @@ const TMP_DIR := "/data/local/tmp"
88const STORAGE_ROOT := "/storage/emulated/0"
99const PULL_PUSH_TEMP = TMP_DIR + "/godot-device-explorer-plugin"
1010
11- @onready var tree : Tree = $ Tree
12- @onready var devices_btn : OptionButton = $ HBoxContainer/ OptionButton
13- @onready var menu_button : MenuButton = $ HBoxContainer/ MenuButton
11+ var tree : Tree
12+ var devices_btn : OptionButton
13+ var menu_button : MenuButton
1414
1515var current_device := ""
1616var show_all := false
@@ -31,22 +31,31 @@ func _ready() -> void:
3131
3232
3333func _setup_ui () -> void :
34- tree .hide_root = true
35- tree .allow_rmb_select = true
36- tree .item_collapsed .connect (_on_item_collapsed )
37- tree .item_mouse_selected .connect (_on_item_mouse_selected )
34+ var hbox := HBoxContainer .new ()
35+ add_child (hbox )
3836
37+ devices_btn = OptionButton .new ()
38+ devices_btn .size_flags_horizontal = Control .SIZE_EXPAND_FILL
3939 devices_btn .custom_minimum_size = Vector2 (32 , 32 )
40- devices_btn .selected = - 1
4140 devices_btn .pressed .connect (_load_devices )
4241 devices_btn .item_selected .connect (_on_device_selected )
42+ hbox .add_child (devices_btn )
4343
44+ menu_button = MenuButton .new ()
4445 menu_button .icon = get_theme_icon ("GuiTabMenuHl" , "EditorIcons" )
4546 var popup := menu_button .get_popup ()
46- popup .clear ()
4747 popup .add_check_item ("Show Full Filesystem" , 0 )
4848 popup .set_item_checked (0 , show_all )
4949 popup .id_pressed .connect (_on_menu_item_pressed )
50+ hbox .add_child (menu_button )
51+
52+ tree = Tree .new ()
53+ tree .size_flags_vertical = Control .SIZE_EXPAND_FILL
54+ tree .hide_root = true
55+ tree .allow_rmb_select = true
56+ tree .item_collapsed .connect (_on_item_collapsed )
57+ tree .item_mouse_selected .connect (_on_item_mouse_selected )
58+ add_child (tree )
5059
5160
5261func _on_item_mouse_selected (pos : Vector2 , mouse_button_index : int ) -> void :
0 commit comments