aboutsummaryrefslogtreecommitdiff
path: root/logic/stage.gd
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-02-17 00:30:16 +0000
committerdam <dam@gudinoff>2022-02-17 00:30:16 +0000
commit48a26128f175047528fcc1c96590f1a7bbc281eb (patch)
tree03cebc078fd30f74da8fdce4469055d9b70b3985 /logic/stage.gd
parent00825f2a5664000fa98d36922c0c329b052a724f (diff)
downloadsurgery-log-48a26128f175047528fcc1c96590f1a7bbc281eb.tar.zst
surgery-log-48a26128f175047528fcc1c96590f1a7bbc281eb.zip
Prototype with custom option set control.
Diffstat (limited to 'logic/stage.gd')
-rw-r--r--logic/stage.gd47
1 files changed, 18 insertions, 29 deletions
diff --git a/logic/stage.gd b/logic/stage.gd
index 66d6d6d..3cc5943 100644
--- a/logic/stage.gd
+++ b/logic/stage.gd
@@ -26,14 +26,14 @@ onready var confirm_action := get_node("/root/main/confirm_action") as Confirmat
onready var process_id := get_node("controls/process_id") as LineEdit
onready var surgery_id := get_node("controls/surgery_id") as LineEdit
onready var date := get_node("controls/date_picker") as DatePicker
-onready var place := get_node("controls/place") as LineEdit
-onready var anesthesia := get_node("controls/anesthesia") as LineEdit
-onready var first_assistant := get_node("controls/first_assistant") as LineEdit
-onready var type := get_node("controls/type") as LineEdit
-onready var sub_type := get_node("controls/sub_type") as LineEdit
-onready var sub_sub_type := get_node("controls/sub_sub_type") as LineEdit
-onready var pathology := get_node("controls/pathology") as LineEdit
-onready var intervention := get_node("controls/intervention") as LineEdit
+onready var place := get_node("controls/place") as OptionSet
+onready var anesthesia := get_node("controls/anesthesia") as OptionSet
+onready var first_assistant := get_node("controls/first_assistant") as OptionSet
+onready var type := get_node("controls/type") as OptionSet
+onready var sub_type := get_node("controls/sub_type") as OptionSet
+onready var sub_sub_type := get_node("controls/sub_sub_type") as OptionSet
+onready var pathology := get_node("controls/pathology") as OptionSet
+onready var intervention := get_node("controls/intervention") as OptionSet
onready var is_urgency := get_node("controls/is_urgency") as Button
onready var notes := get_node("controls/notes") as LineEdit
onready var save_button := get_node("controls/save") as Button
@@ -49,8 +49,9 @@ func _ready():
save_button.connect("pressed", self, "save_action")
discard_button.connect("pressed", self, "discard_action")
+ # @DAM Not working because we changed the stage/controls/.. estructure with the new option_sets.
+ # @DAM We could try to do a recursive approach or, build a stack of next items to process.
for it in get_node("controls").get_children():
- it = it as Control
if it is LineEdit:
it.connect("focus_entered", it, "set_cursor_position", [99999999]) # @DAM Use MAX_INT
it.connect("focus_exited", it, "deselect")
@@ -67,7 +68,12 @@ func _ready():
"intervention": intervention
}
for key in option_sets_map:
- var button := option_sets_map[key].get_node("option_set") as Button
+# var button := option_sets_map[key].get_node("option_set") as Button
+# button.connect("pressed", self, "show_option_sets", [key])
+
+# if key != "place": # @DAM DEBUG
+# continue
+ var button := option_sets_map[key].get_node("options") as Button
button.connect("pressed", self, "show_option_sets", [key])
@@ -89,6 +95,7 @@ func get_option_sets(field: String):
return options
+# @DAM WIP I suspect that these should go inside the option_set class...
func show_option_sets(field: String):
var stage_options = get_node("/root/main/popup_list") as Popup
stage_options.connect("item_selected", self, "option_set_selected", [field], CONNECT_ONESHOT)
@@ -96,7 +103,7 @@ func show_option_sets(field: String):
func option_set_selected(index: int, field: String):
- var field_input: LineEdit = self[field]
+ var field_input: LineEdit = self[field].get_node("input")
field_input.text = get_option_sets(field)[index]
field_input.caret_position = field_input.text.length()
@@ -232,21 +239,3 @@ func clear_option_sets(save_changes: bool = false):
store_option_sets()
-func pointer_input_on_click_handler(pointer: PointerInputSensor.PointerInputData):
- .pointer_input_on_click_handler(pointer)
-
- var target: Control = pointer.target.get_parent()
- var button: Button
- if target is Button:
- button = target
- elif target.get_node("option_set") is Button:
- button = target.get_node("option_set")
-
- if button != null && button.get_global_rect().has_point(pointer.current_position):
- if button is CheckBox || button is CheckButton:
- button.pressed = !button.pressed
- button.emit_signal("button_down")
- button.emit_signal("pressed")
- button.emit_signal("button_up")
-
-