38 lines
772 B
GDScript
38 lines
772 B
GDScript
extends HBoxContainer
|
|
class_name DownloadDir # just in case :P
|
|
|
|
|
|
func get_data() -> Dictionary:
|
|
return {$Name.text:$Location.text}
|
|
|
|
|
|
func set_data(dir_name:String,dir:String):
|
|
$Name.text = dir_name
|
|
$Location.text = dir
|
|
_on_Location_text_changed(dir)
|
|
|
|
|
|
func _on_FileDialog_dir_selected(dir:String):
|
|
if dir == "":
|
|
return
|
|
$Location.text = dir
|
|
if $Name.text.empty():
|
|
$Name.text = dir.get_file()
|
|
|
|
|
|
func _on_Browse_pressed():
|
|
#$Browse/FileDialog.popup_centered()
|
|
$Browse/NativeDialogFolder.initial_path = $Location.text
|
|
$Browse/NativeDialogFolder.show()
|
|
|
|
|
|
func _on_Location_text_changed(new_text):
|
|
$Browse/FileDialog.current_dir = new_text
|
|
|
|
|
|
func _on_Delete_pressed():
|
|
queue_free()
|
|
|
|
|
|
func is_empty() -> bool:
|
|
return $Name.text.empty() or $Location.text.empty()
|