1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
extends ScrollContainer
class_name Stage
signal save # (database_entry: Dictionary)
signal discard # ()
#onready var process_id: LineEdit = get_node("touch_scroll/controls/process_id")
#onready var surgery_id: LineEdit = get_node("touch_scroll/controls/surgery_id")
#onready var date: DatePicker = get_node("touch_scroll/controls/date_picker")
#onready var place: LineEdit = get_node("touch_scroll/controls/place")
#onready var anesthetic: LineEdit = get_node("touch_scroll/controls/anesthetic")
#onready var first_assistant: LineEdit = get_node("touch_scroll/controls/first_assistant")
#onready var type: LineEdit = get_node("touch_scroll/controls/type")
#onready var sub_type: LineEdit = get_node("touch_scroll/controls/sub_type")
#onready var sub_sub_type: LineEdit = get_node("touch_scroll/controls/sub_sub_type")
#onready var pathology: LineEdit = get_node("touch_scroll/controls/pathology")
#onready var intervention: LineEdit = get_node("touch_scroll/controls/intervention")
#onready var is_urgency: Button = get_node("touch_scroll/controls/is_urgency")
#onready var notes: LineEdit = get_node("touch_scroll/controls/notes")
#onready var save_button: Button = get_node("touch_scroll/controls/save")
#onready var discard_button: Button = get_node("touch_scroll/controls/discard")
onready var process_id: LineEdit = get_node("controls/process_id")
onready var surgery_id: LineEdit = get_node("controls/surgery_id")
onready var date: DatePicker = get_node("controls/date_picker")
onready var place: LineEdit = get_node("controls/place")
onready var anesthetic: LineEdit = get_node("controls/anesthetic")
onready var first_assistant: LineEdit = get_node("controls/first_assistant")
onready var type: LineEdit = get_node("controls/type")
onready var sub_type: LineEdit = get_node("controls/sub_type")
onready var sub_sub_type: LineEdit = get_node("controls/sub_sub_type")
onready var pathology: LineEdit = get_node("controls/pathology")
onready var intervention: LineEdit = get_node("controls/intervention")
onready var is_urgency: Button = get_node("controls/is_urgency")
onready var notes: LineEdit = get_node("controls/notes")
onready var save_button: Button = get_node("controls/save")
onready var discard_button: Button = get_node("controls/discard")
func _ready():
save_button.connect("pressed", self, "save_action")
discard_button.connect("pressed", self, "discard_action")
for it in get_node("controls").get_children():
# print("%s" % it.name)
match it.name:
"date_picker", "save", "discard":
print("- %s" % it.name)
_:
# "first_assistant":
print("+ %s" % it.name)
var touch_scroll = TouchScroll.new()
touch_scroll.name = "touch_scroll"
touch_scroll.click_target_path = "../"
touch_scroll.scroll_target_path = "../../../"
touch_scroll.scroll_bar_get_method = "get_v_scrollbar"
touch_scroll.mouse_default_cursor_shape = Control.CURSOR_IBEAM
(it as Control).add_child(touch_scroll)
touch_scroll.anchor_right = 1.0
touch_scroll.anchor_bottom = 1.0
func save_action():
self.visible = false
emit_signal("save", get_stage())
func discard_action():
self.visible = false
emit_signal("discard")
func set_stage(entry: Dictionary):
process_id.text = entry.process_id
surgery_id.text = entry.surgery_id
date.set_date(entry.date_year, entry.date_month, entry.date_day)
place.text = entry.place
anesthetic.text = entry.anesthetic
first_assistant.text = entry.first_assistant
type.text = entry.type
sub_type.text = entry.sub_type
sub_sub_type.text = entry.sub_sub_type
pathology.text = entry.pathology
intervention.text = entry.intervention
is_urgency.pressed = entry.is_urgency
notes.text = entry.notes
self.scroll_vertical = 0 # @DAM TODO
func get_stage() -> Dictionary:
# var entry: Dictionary = Database.instance_entry({
# "process_id": process_id.text,
# "surgery_id": surgery_id.text,
# "date_year": date.get_year(),
# "date_month": date.get_month(),
# "date_day": date.get_day(),
# "place": place.text,
# "anesthetic": anesthetic.text,
# "first_assistant": first_assistant.text,
# "type": type.text,
# })
# @DAM Simplify all this... avoid creating multiple entries/dictionaries.
var entry: Dictionary = {
"process_id": process_id.text,
"surgery_id": surgery_id.text,
"date_year": date.get_year(),
"date_month": date.get_month(),
"date_day": date.get_day(),
"place": place.text,
"anesthetic": anesthetic.text,
"first_assistant": first_assistant.text,
"type": type.text,
"sub_type": sub_type.text,
"sub_sub_type": sub_sub_type.text,
"pathology": pathology.text,
"intervention": intervention.text,
"is_urgency": is_urgency.pressed,
"notes": notes.text,
}
return entry
# @DAM Testing. Needs all children controllers to have Mouse > Filter : Pass.
#func _gui_input(event):
# accept_event()
# if event is InputEventScreenDrag:
# self.scroll_vertical -= event.relative.y
# return
func _notification(what: int):
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
discard_action()
|