aboutsummaryrefslogtreecommitdiff
path: root/menu
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-03-31 16:05:54 +0000
committerdam <dam@gudinoff>2022-03-31 16:05:54 +0000
commit9b619b8c5f117e53b121c2d868b024c7c7d08f4c (patch)
tree0dde86709240834ba3acb078b605af1b76a8cb18 /menu
parent6089eeb29382598d69c6b77be88d8ca4b1a3adf5 (diff)
downloadsurgery-log-9b619b8c5f117e53b121c2d868b024c7c7d08f4c.tar.zst
surgery-log-9b619b8c5f117e53b121c2d868b024c7c7d08f4c.zip
Fixed signals on popup and modal_dialog to make those usable.
Diffstat (limited to 'menu')
-rw-r--r--menu/menu.gd33
1 files changed, 17 insertions, 16 deletions
diff --git a/menu/menu.gd b/menu/menu.gd
index c963270..021c005 100644
--- a/menu/menu.gd
+++ b/menu/menu.gd
@@ -12,8 +12,9 @@ const menu_items: Array = [
const license_font_b612: String = "res://licenses/font_b612.txt"
const license_godot: String = "res://licenses/godot.txt"
-onready var popup := get_popup() as PopupMenu
-onready var confirm_action := get_node("/root/main/confirm_action") as ConfirmationDialog
+onready var menu := get_popup() as PopupMenu
+onready var popup := get_node("/root/main/popup") as ModalPopup
+onready var dialog := get_node("/root/main/dialog") as Dialog
onready var file_picker := get_node("/root/main/file_picker") as FileDialog
onready var database := get_node("/root/main/database") as Database
onready var stage := get_node("/root/main/stage") as Stage
@@ -21,8 +22,8 @@ onready var stage := get_node("/root/main/stage") as Stage
func _ready():
for idx in range(menu_items.size()):
- popup.add_item(menu_items[idx].label, idx)
- popup.connect("id_pressed", self, "id_pressed")
+ menu.add_item(menu_items[idx].label, idx)
+ menu.connect("id_pressed", self, "id_pressed")
func id_pressed(id: int):
@@ -34,7 +35,7 @@ func import_option_sets_action():
file_picker.current_dir = OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS)
file_picker.filters = ["*.json", "*.csv"]
file_picker.current_file = ""
- file_picker.connect("file_selected", self, "import_option_sets_action_confirmed", [], CONNECT_ONESHOT)
+ file_picker.connect("file_selected", self, "import_option_sets_action_confirmed")
file_picker.show_modal(true)
file_picker.invalidate()
@@ -68,9 +69,9 @@ func export_option_sets_action():
func clear_option_sets_action():
- confirm_action.dialog_text = "Do you want to delete all option sets?"
- confirm_action.connect("confirmed", stage, "clear_option_sets", [], CONNECT_ONESHOT)
- confirm_action.show_modal(true)
+ dialog.setup("Do you want to delete all option sets?", "Yes, delete.", "No")
+ dialog.connect("accepted", stage, "clear_option_sets")
+ popup.open_popup("Clear option sets?", dialog)
func export_data_action():
@@ -84,20 +85,20 @@ func export_data_action():
func clear_data_action():
- confirm_action.dialog_text = "Do you want to delete all entries from the database?"
- confirm_action.connect("confirmed", database, "clear_database", [], CONNECT_ONESHOT)
- confirm_action.show_modal(true)
+ dialog.setup("Do you want to delete all entries from the database?", "Yes, delete.", "No")
+ dialog.connect("accepted", database, "clear_database")
+ popup.open_popup("Clear database?", dialog)
func about_action():
- confirm_action.dialog_text = "Surgery Log\nversion 2022-02-27"
- confirm_action.show_modal(true)
+ dialog.setup("Surgery Log\nversion 0.1", "", "")
+ popup.open_popup("About", dialog)
# @DAM Hide this debug method before release.
func test_fake_db_action():
- confirm_action.dialog_text = "Do you want to delete all entries from the database and replace by fake entries?"
- confirm_action.connect("confirmed", database, "fake_database", [], CONNECT_ONESHOT)
- confirm_action.show_modal(true)
+ dialog.setup("Do you want to delete all entries from the database and replace by fake entries?", "Yes, replace.", "No")
+ dialog.connect("accepted", database, "fake_database")
+ popup.open_popup("Fake DB?", dialog)