2019-10-29 22:10:08 +01:00
|
|
|
extends HBoxContainer
|
|
|
|
|
|
|
|
func set_label(l : String) -> void:
|
|
|
|
$Name.set_text(l)
|
|
|
|
|
2019-12-22 23:27:02 +01:00
|
|
|
func set_type(t : String) -> void:
|
2020-01-28 22:40:03 +01:00
|
|
|
$Type.selected = mm_io_types.type_names.find(t)
|
2019-12-22 23:27:02 +01:00
|
|
|
|
2019-10-29 22:10:08 +01:00
|
|
|
func update_up_down_button() -> void:
|
|
|
|
var parent = get_parent()
|
|
|
|
if parent == null:
|
|
|
|
return
|
|
|
|
$Up.disabled = (get_index() == 0)
|
|
|
|
$Down.disabled = (get_index() == get_parent().get_child_count()-2)
|
|
|
|
|
2019-11-06 23:49:26 +01:00
|
|
|
func _on_Name_label_changed(new_label) -> void:
|
2019-10-29 22:10:08 +01:00
|
|
|
get_parent().generator.set_port_name(get_index(), new_label)
|
|
|
|
|
2019-12-22 23:27:02 +01:00
|
|
|
func _on_Type_item_selected(ID) -> void:
|
2020-01-28 22:40:03 +01:00
|
|
|
get_parent().generator.set_port_type(get_index(), mm_io_types.type_names[ID])
|
2019-12-22 23:27:02 +01:00
|
|
|
|
2019-11-06 23:49:26 +01:00
|
|
|
func _on_Delete_pressed() -> void:
|
2019-10-29 22:10:08 +01:00
|
|
|
get_parent().generator.delete_port(get_index())
|
|
|
|
|
2019-11-06 23:49:26 +01:00
|
|
|
func _on_Up_pressed() -> void:
|
2019-10-29 22:10:08 +01:00
|
|
|
get_parent().generator.swap_ports(get_index(), get_index()-1)
|
|
|
|
|
2019-11-06 23:49:26 +01:00
|
|
|
func _on_Down_pressed() -> void:
|
2019-10-29 22:10:08 +01:00
|
|
|
get_parent().generator.swap_ports(get_index(), get_index()+1)
|