New File Popup (no function)

This commit is contained in:
bleeptrack 2020-11-10 18:34:51 +01:00
parent 563f6ba835
commit 39e62eb8cf
3 changed files with 11 additions and 1 deletions

View File

@ -24,6 +24,7 @@ func _ready():
update()
_set_mode(mode)
_set_title(title)
$PopupMenu.add_item("New file", 1)
func _input(event):
if event.is_action_pressed("save"):
@ -176,6 +177,11 @@ func _set_title(new_title):
title = new_title
if title_label:
title_label.text = new_title
func _gui_input(event):
if event is InputEventMouseButton and event.is_pressed() and event.button_index == BUTTON_RIGHT:
$PopupMenu.set_position(get_global_mouse_position())
$PopupMenu.popup()
func very_best_sort(a,b):
if a[0] == "." and b[0] != ".":

View File

@ -125,5 +125,9 @@ text = "x"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PopupMenu" type="PopupMenu" parent="."]
margin_right = 20.0
margin_bottom = 20.0
[connection signal="pressed" from="Panel/TextEdit/SaveButton" to="." method="save"]
[connection signal="pressed" from="Panel/TextEdit/CloseButton" to="." method="close"]

View File

@ -15,7 +15,7 @@ onready var status_icon = $VBoxContainer/Control/TextureRect/StatusIcon
func _ready():
_set_label(label)
_set_status(status)
$PopupMenu.add_item("Delete File", 0)
$PopupMenu.add_item("Delete file", 0)
func _set_label(new_label):
label = new_label