-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFileMonitorDisplay.gd
More file actions
57 lines (35 loc) · 1.17 KB
/
FileMonitorDisplay.gd
File metadata and controls
57 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
extends PanelContainer
@onready var _toggl_btn := $VBox/HBox/toggl
@onready var _labels := $VBox/Labels
@onready var _mutebtn := $VBox/mutebtn
@onready var _hide_nodes_list := [_labels, $VBox/HBox/add, _mutebtn]
var EFNode := EasyFiles
@export var file_dialog_path : NodePath
var file_dialog
func _ready():
file_dialog = get_node(file_dialog_path)
if file_dialog is FileDialog:
file_dialog.connect("file_selected", Callable(self, "add_file"))
call_deferred("_on_toggl_toggled", false)
func refresh_list():
var files := EFNode.get_monitored_files()
_labels.text = ""
for path in files:
_labels.text += (path + "\n")
_labels.text = _labels.text.trim_suffix("\n")
func add_file(path:String):
var err = EFNode.add_file_monitor(path)
refresh_list()
return err
func _on_toggl_toggled(button_pressed):
_toggl_btn.text = ["open monitor", "close monitor"][int(button_pressed)]
for node in _hide_nodes_list:
node.visible = button_pressed
func _on_add_pressed():
if is_instance_valid(file_dialog):
var pop_size := get_window().size
pop_size.x *= 0.8
pop_size.y *= 0.8
file_dialog.popup_centered(pop_size)
func is_muted():
return _mutebtn.button_pressed