aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordam <dam@gudinoff>2021-12-16 01:17:34 +0000
committerdam <dam@gudinoff>2021-12-16 01:17:34 +0000
commit9724fb73abf9fd3760a4f3f3ac941a119708c97b (patch)
tree1892493f0e922a3c0b99c049a7039771d739dea7
parentecd75887d99d887aabe828f4511d9fd3e1c41428 (diff)
downloadsurgery-log-9724fb73abf9fd3760a4f3f3ac941a119708c97b.tar.zst
surgery-log-9724fb73abf9fd3760a4f3f3ac941a119708c97b.zip
First prototype with working database and staging area.
Fix incorrect warp in date picker. Disable physics engine.
-rw-r--r--date_picker/date_picker.gd1
-rw-r--r--date_picker/date_picker.tscn1
-rw-r--r--date_picker/value_picker.gd2
-rwxr-xr-xicon.pngbin118840 -> 0 bytes
-rw-r--r--icons/add.pngbin0 -> 3030 bytes
-rw-r--r--icons/add.png.import38
-rw-r--r--icons/delete.pngbin0 -> 4410 bytes
-rw-r--r--icons/delete.png.import38
-rwxr-xr-xicons/edit.pngbin0 -> 5449 bytes
-rw-r--r--icons/edit.png.import38
-rwxr-xr-xicons/icon.pngbin0 -> 19327 bytes
-rw-r--r--icons/icon.png.import (renamed from icon.png.import)6
-rw-r--r--logic/database.gd226
-rw-r--r--logic/stage.gd88
-rw-r--r--main.gd8
-rw-r--r--main.tscn190
-rw-r--r--project.godot17
-rw-r--r--readme.md11
18 files changed, 570 insertions, 94 deletions
diff --git a/date_picker/date_picker.gd b/date_picker/date_picker.gd
index 6298156..fb9cca2 100644
--- a/date_picker/date_picker.gd
+++ b/date_picker/date_picker.gd
@@ -1,5 +1,4 @@
extends Control
-
class_name DatePicker
const days_per_month: Dictionary = {
diff --git a/date_picker/date_picker.tscn b/date_picker/date_picker.tscn
index 6506c31..21573dc 100644
--- a/date_picker/date_picker.tscn
+++ b/date_picker/date_picker.tscn
@@ -19,6 +19,7 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
+min_value = 1
max_value = 9999
[node name="previous" type="Label" parent="year"]
diff --git a/date_picker/value_picker.gd b/date_picker/value_picker.gd
index d25a143..5e77294 100644
--- a/date_picker/value_picker.gd
+++ b/date_picker/value_picker.gd
@@ -120,7 +120,7 @@ func input_focus_entered():
func input_focus_exited():
if input.text.is_valid_integer():
- value = wrapi(int(input.text), min_value, max_value)
+ value = wrapi(int(input.text), min_value, max_value + 1)
input.visible = false
diff --git a/icon.png b/icon.png
deleted file mode 100755
index e4d20ec..0000000
--- a/icon.png
+++ /dev/null
Binary files differ
diff --git a/icons/add.png b/icons/add.png
new file mode 100644
index 0000000..074a6c1
--- /dev/null
+++ b/icons/add.png
Binary files differ
diff --git a/icons/add.png.import b/icons/add.png.import
new file mode 100644
index 0000000..f726327
--- /dev/null
+++ b/icons/add.png.import
@@ -0,0 +1,38 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path.s3tc="res://.import/add.png-21abb41ff0da259ea2ccbb4becce111a.s3tc.stex"
+path.etc2="res://.import/add.png-21abb41ff0da259ea2ccbb4becce111a.etc2.stex"
+path.etc="res://.import/add.png-21abb41ff0da259ea2ccbb4becce111a.etc.stex"
+metadata={
+"imported_formats": [ "s3tc", "etc2", "etc" ],
+"vram_texture": true
+}
+
+[deps]
+
+source_file="res://icons/add.png"
+dest_files=[ "res://.import/add.png-21abb41ff0da259ea2ccbb4becce111a.s3tc.stex", "res://.import/add.png-21abb41ff0da259ea2ccbb4becce111a.etc2.stex", "res://.import/add.png-21abb41ff0da259ea2ccbb4becce111a.etc.stex" ]
+
+[params]
+
+compress/mode=2
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=true
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=false
+process/premult_alpha=true
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/icons/delete.png b/icons/delete.png
new file mode 100644
index 0000000..2b1f562
--- /dev/null
+++ b/icons/delete.png
Binary files differ
diff --git a/icons/delete.png.import b/icons/delete.png.import
new file mode 100644
index 0000000..eaad4c1
--- /dev/null
+++ b/icons/delete.png.import
@@ -0,0 +1,38 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path.s3tc="res://.import/delete.png-48500a9e66ed6e102e89aa5542feee73.s3tc.stex"
+path.etc2="res://.import/delete.png-48500a9e66ed6e102e89aa5542feee73.etc2.stex"
+path.etc="res://.import/delete.png-48500a9e66ed6e102e89aa5542feee73.etc.stex"
+metadata={
+"imported_formats": [ "s3tc", "etc2", "etc" ],
+"vram_texture": true
+}
+
+[deps]
+
+source_file="res://icons/delete.png"
+dest_files=[ "res://.import/delete.png-48500a9e66ed6e102e89aa5542feee73.s3tc.stex", "res://.import/delete.png-48500a9e66ed6e102e89aa5542feee73.etc2.stex", "res://.import/delete.png-48500a9e66ed6e102e89aa5542feee73.etc.stex" ]
+
+[params]
+
+compress/mode=2
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=true
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=false
+process/premult_alpha=true
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/icons/edit.png b/icons/edit.png
new file mode 100755
index 0000000..01fb607
--- /dev/null
+++ b/icons/edit.png
Binary files differ
diff --git a/icons/edit.png.import b/icons/edit.png.import
new file mode 100644
index 0000000..baee812
--- /dev/null
+++ b/icons/edit.png.import
@@ -0,0 +1,38 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path.s3tc="res://.import/edit.png-d9148ff44b5b1c8f3b0a53a3c3c7c1c0.s3tc.stex"
+path.etc2="res://.import/edit.png-d9148ff44b5b1c8f3b0a53a3c3c7c1c0.etc2.stex"
+path.etc="res://.import/edit.png-d9148ff44b5b1c8f3b0a53a3c3c7c1c0.etc.stex"
+metadata={
+"imported_formats": [ "s3tc", "etc2", "etc" ],
+"vram_texture": true
+}
+
+[deps]
+
+source_file="res://icons/edit.png"
+dest_files=[ "res://.import/edit.png-d9148ff44b5b1c8f3b0a53a3c3c7c1c0.s3tc.stex", "res://.import/edit.png-d9148ff44b5b1c8f3b0a53a3c3c7c1c0.etc2.stex", "res://.import/edit.png-d9148ff44b5b1c8f3b0a53a3c3c7c1c0.etc.stex" ]
+
+[params]
+
+compress/mode=2
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=true
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=false
+process/premult_alpha=true
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=false
+svg/scale=1.0
diff --git a/icons/icon.png b/icons/icon.png
new file mode 100755
index 0000000..4b35a32
--- /dev/null
+++ b/icons/icon.png
Binary files differ
diff --git a/icon.png.import b/icons/icon.png.import
index a4c02e6..bc6c6d2 100644
--- a/icon.png.import
+++ b/icons/icon.png.import
@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
-path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
+path="res://.import/icon.png-66e56a551f174bdc993eb27d415a6710.stex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://icon.png"
-dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
+source_file="res://icons/icon.png"
+dest_files=[ "res://.import/icon.png-66e56a551f174bdc993eb27d415a6710.stex" ]
[params]
diff --git a/logic/database.gd b/logic/database.gd
new file mode 100644
index 0000000..1abb984
--- /dev/null
+++ b/logic/database.gd
@@ -0,0 +1,226 @@
+extends ItemList
+class_name Database
+
+const DATABASE_FILE_PATH: String = "user://database.csv"
+const DATE_SEPARATOR: String = "-"
+const DATE_FORMAT: String = "%04d-%02d-%02d"
+const ENTRY_PROTOTYPE: Dictionary = {
+ "process_id": "",
+ "surgery_id": "",
+ "place": "",
+ "date": "",
+ "date_year": 0,
+ "date_month": 0,
+ "date_day": 0,
+ "anesthetic": "",
+ "first_assistant": "",
+ "type": "",
+ "sub_type": "",
+ "sub_sub_type": "",
+ "pathology": "",
+ "intervention": "",
+ "is_urgency": false,
+ "notes": "",
+}
+
+var db: Array
+var staged_idx: int
+
+onready var delete_button: Button = get_node("actions/delete")
+onready var edit_button: Button = get_node("actions/edit")
+onready var add_button: Button = get_node("actions/add")
+
+onready var stage: Stage = get_node("/root/main/stage")
+
+
+func _init():
+ staged_idx = -1
+ load_database()
+ store_database() # @DAM Only for testing.
+
+
+# @DAM WIP
+#func _notification(what: int):
+# if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
+# clear_selection()
+
+
+func _ready():
+ self.connect("nothing_selected", self, "clear_selection")
+ delete_button.connect("pressed", self, "delete_action")
+ edit_button.connect("pressed", self, "edit_action")
+ add_button.connect("pressed", self, "add_action")
+ stage.connect("save", self, "save")
+ stage.connect("discard", self, "discard")
+ refresh_list()
+
+
+func get_entry_view(database_entry: Dictionary) -> String:
+ return "%6s | %6s | %s" % [database_entry.process_id, database_entry.surgery_id, get_entry_date(database_entry)]
+
+
+func refresh_list():
+ self.clear()
+ for it in db:
+ self.add_item(get_entry_view(it))
+
+
+func clear_selection():
+ unselect_all()
+
+
+func delete_action():
+ # @DAM Could do some performance improvements
+ var selected_entries_idx := self.get_selected_items()
+ var sorted_idx := Array(selected_entries_idx)
+ sorted_idx.sort()
+ sorted_idx.invert()
+ for idx in sorted_idx:
+ db.remove(idx)
+ self.remove_item(idx)
+
+
+func edit_action():
+ var selected_entries_idx := self.get_selected_items()
+ if selected_entries_idx.size() != 1:
+ return
+ staged_idx = selected_entries_idx[0]
+ self.visible = false
+ stage.visible = true
+ stage.set_stage(db[staged_idx])
+
+
+func add_action():
+ self.visible = false
+ stage.visible = true
+ var staged := instance_entry()
+ stage.set_stage(staged)
+ # @DAM This signal is connected but, if we select "DISCARD" it stays connectd.
+ # Maybe I should always keep the connection and use two different buttons on sage screen.
+ stage.connect("save", self, "save_new", [], CONNECT_ONESHOT)
+
+
+func save(database_entry: Dictionary):
+ if staged_idx >= 0:
+ db[staged_idx] = database_entry
+ set_item_text(staged_idx, get_entry_view(database_entry))
+# items[staged_idx] = get_entry_view(database_entry)
+ else:
+ db.append(database_entry)
+ add_item(get_entry_view(database_entry))
+
+ staged_idx = -1
+ self.visible = true
+
+
+func discard():
+ staged_idx = -1
+ self.visible = true
+
+
+func load_database():
+ var file := File.new()
+ file.open(DATABASE_FILE_PATH, File.READ_WRITE)
+ var headers: PoolStringArray
+ var is_first_line := true
+# while database_file.eof_reached() == false:
+ while file.get_position() < file.get_len():
+ var csv_entry := file.get_csv_line()
+ if is_first_line:
+ is_first_line = false
+ headers = csv_entry
+ continue
+ var entry = ENTRY_PROTOTYPE.duplicate(true)
+ for idx in headers.size():
+ var field_name := headers[idx]
+ var field_value := csv_entry[idx]
+ match field_name:
+ "date_year", "date_month", "date_day":
+ entry[field_name] = int(field_value)
+ "is_urgency":
+ entry[field_name] = true if field_value.strip_edges().to_lower() == "true" else false
+ _:
+ entry[field_name] = field_value
+ db.append(entry)
+ return
+ db = [
+ instance_entry({
+ "process_id": "000001",
+ "surgery_id": "100000",
+ "place": "central",
+ "date": "2020-01-31",
+ }),
+ instance_entry({
+ "process_id": "000002",
+ "surgery_id": "200000",
+ "place": "central",
+ "date": "2020-02-31",
+ }),
+ instance_entry({
+ "process_id": "000003",
+ "surgery_id": "300000",
+ "place": "central",
+ "date": "2020-03-31",
+ }),
+ instance_entry({
+ "process_id": "000004",
+ "surgery_id": "400000",
+ "place": "central",
+ "date": "2020-04-31",
+ }),
+ instance_entry({
+ "process_id": "000012",
+ "surgery_id": "210000",
+ "place": "central",
+ "date": "2020-12-31",
+ }),
+ ]
+
+
+func store_database():
+ var file := File.new()
+ file.open(DATABASE_FILE_PATH, File.WRITE)
+ var header := PoolStringArray(ENTRY_PROTOTYPE.keys())
+ file.store_csv_line(header)
+ var entry := PoolStringArray()
+ for it in db:
+ file.store_csv_line(it.values())
+ file.close()
+
+
+func instance_entry(params: Dictionary = {}) -> Dictionary:
+ var new_entry := ENTRY_PROTOTYPE.duplicate(true)
+ new_entry.process_id = params.get("process_id", "")
+ new_entry.surgery_id = params.get("surgery_id", "")
+ new_entry.place = params.get("place", "")
+
+ var today = OS.get_date()
+ set_entry_date(new_entry, params.get("date", DATE_FORMAT % [today.year, today.month, today.day]))
+
+ new_entry.anesthetic = params.get("anesthetic", "")
+ new_entry.first_assistant = params.get("first_assistant", "")
+ new_entry.type = params.get("type", "")
+ new_entry.sub_type = params.get("sub_type", "")
+ new_entry.sub_sub_type = params.get("sub_sub_type", "")
+ new_entry.pathology = params.get("pathology", "")
+ new_entry.intervention = params.get("intervention", "")
+ new_entry.is_urgency = params.get("is_urgency", false)
+ new_entry.notes = params.get("notes", "")
+
+ return new_entry
+
+
+func get_entry_date(entry: Dictionary) -> String:
+ return DATE_FORMAT % [entry.date_year, entry.date_month, entry.date_day]
+
+
+func set_entry_date(entry: Dictionary, date: String):
+ date = date.strip_edges().replace(" ", DATE_SEPARATOR).replace("/", DATE_SEPARATOR).replace("\\", DATE_SEPARATOR)
+ var year_month_idx := date.find(DATE_SEPARATOR)
+ var month_day_idx := date.find(DATE_SEPARATOR, year_month_idx + 1)
+ entry.date = date
+ entry.date_year = int(date.substr(0, year_month_idx))
+ entry.date_month = int(date.substr(year_month_idx + 1, month_day_idx - year_month_idx - 1))
+ entry.date_day = int(date.substr(month_day_idx + 1))
+
+
diff --git a/logic/stage.gd b/logic/stage.gd
new file mode 100644
index 0000000..a9f4fee
--- /dev/null
+++ b/logic/stage.gd
@@ -0,0 +1,88 @@
+extends Control
+class_name Stage
+
+signal save # (database_entry: Dictionary)
+signal 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")
+
+
+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
+ entry.process_id = process_id.text
+ entry.surgery_id = surgery_id.text
+ entry.date_year = date.get_year()
+ entry.date_month = date.get_month()
+ entry.date_day = date.get_day()
+ entry.place = place.text
+ entry.anesthetic = anesthetic.text
+ entry.first_assistant = first_assistant.text
+ entry.type = type.text
+ entry.sub_type = sub_type.text
+ entry.sub_sub_type = sub_sub_type.text
+ entry.pathology = pathology.text
+ entry.intervention = intervention.text
+ entry.is_urgency = is_urgency.pressed
+ entry.notes = notes.text
+ return entry
+
+
+func _notification(what: int):
+ if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
+ discard_action()
+
+
+func _unhandled_input(event):
+ get_node("/root/main/debug").text += "%s\n" % event.to_string()
+
+
+func _unhandled_key_input(event):
+ get_node("/root/main/debug").text += "%s\n" % event.to_string()
+
+
diff --git a/main.gd b/main.gd
index 803c2d4..d242bda 100644
--- a/main.gd
+++ b/main.gd
@@ -1,6 +1,7 @@
extends Control
var timeout: float
+
onready var controls_sensible_to_keyboard: Array = [
self,
get_node("/root/main/about"),
@@ -10,8 +11,13 @@ onready var controls_sensible_to_keyboard: Array = [
]
+func _init():
+ Physics2DServer.set_active(false)
+ PhysicsServer.set_active(false)
+
+
+
func _process(delta: float):
-
var keyboard_height: int = OS.get_virtual_keyboard_height()
for it in controls_sensible_to_keyboard:
it.margin_bottom = -keyboard_height
diff --git a/main.tscn b/main.tscn
index 83ee8d3..53f083a 100644
--- a/main.tscn
+++ b/main.tscn
@@ -1,9 +1,14 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=10 format=2]
[ext_resource path="res://main.gd" type="Script" id=1]
[ext_resource path="res://date_picker/date_picker.tscn" type="PackedScene" id=2]
[ext_resource path="res://theme_white.tres" type="Theme" id=3]
[ext_resource path="res://menu/menu.gd" type="Script" id=4]
+[ext_resource path="res://logic/database.gd" type="Script" id=5]
+[ext_resource path="res://icons/edit.png" type="Texture" id=6]
+[ext_resource path="res://icons/add.png" type="Texture" id=7]
+[ext_resource path="res://icons/delete.png" type="Texture" id=8]
+[ext_resource path="res://logic/stage.gd" type="Script" id=9]
[node name="main" type="Control"]
anchor_right = 1.0
@@ -14,192 +19,211 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="body" type="TabContainer" parent="."]
+[node name="database" type="ItemList" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
-tab_align = 0
+margin_top = 60.0
+script = ExtResource( 5 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="actions" type="VBoxContainer" parent="database"]
+anchor_left = 1.0
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = -140.0
+margin_top = -410.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="delete" type="Button" parent="database/actions"]
+margin_right = 140.0
+margin_bottom = 134.0
+focus_mode = 0
+enabled_focus_mode = 0
+icon = ExtResource( 8 )
+flat = true
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="edit" type="Button" parent="database/actions"]
+margin_top = 138.0
+margin_right = 140.0
+margin_bottom = 272.0
+focus_mode = 0
+enabled_focus_mode = 0
+icon = ExtResource( 6 )
+flat = true
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="add" type="Button" parent="database/actions"]
+margin_top = 276.0
+margin_right = 140.0
+margin_bottom = 410.0
+focus_mode = 0
+enabled_focus_mode = 0
+icon = ExtResource( 7 )
+flat = true
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="record" type="ScrollContainer" parent="body"]
+[node name="stage" type="ScrollContainer" parent="."]
+visible = false
anchor_right = 1.0
anchor_bottom = 1.0
-margin_left = 4.0
margin_top = 60.0
-margin_right = -4.0
-margin_bottom = -4.0
scroll_horizontal_enabled = false
+script = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="VBoxContainer" type="VBoxContainer" parent="body/record"]
-margin_right = 1072.0
-margin_bottom = 1856.0
-rect_clip_content = true
+[node name="controls" type="VBoxContainer" parent="stage"]
+margin_right = 1080.0
+margin_bottom = 1860.0
size_flags_horizontal = 3
size_flags_vertical = 3
+__meta__ = {
+"_edit_use_anchors_": false
+}
-[node name="process_number" type="LineEdit" parent="body/record/VBoxContainer"]
-margin_right = 1072.0
+[node name="process_id" type="LineEdit" parent="stage/controls"]
+margin_right = 1080.0
margin_bottom = 52.0
placeholder_text = "Nº Processo"
caret_blink = true
caret_blink_speed = 0.5
-[node name="surgery_number" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="surgery_id" type="LineEdit" parent="stage/controls"]
margin_top = 56.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 108.0
placeholder_text = "Nº Cirurgia"
caret_blink = true
caret_blink_speed = 0.5
-[node name="date_picker" parent="body/record/VBoxContainer" instance=ExtResource( 2 )]
+[node name="date_picker" parent="stage/controls" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 112.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 312.0
rect_min_size = Vector2( 400, 200 )
-[node name="place" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="place" type="LineEdit" parent="stage/controls"]
margin_top = 316.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 368.0
placeholder_text = "Local"
caret_blink = true
caret_blink_speed = 0.5
-[node name="anesthesia" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="anesthetic" type="LineEdit" parent="stage/controls"]
margin_top = 372.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 424.0
placeholder_text = "Anesthesics"
caret_blink = true
caret_blink_speed = 0.5
-[node name="first_aider" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="first_assistant" type="LineEdit" parent="stage/controls"]
margin_top = 428.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 480.0
placeholder_text = "1º Ajudante"
caret_blink = true
caret_blink_speed = 0.5
-[node name="type" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="type" type="LineEdit" parent="stage/controls"]
margin_top = 484.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 536.0
placeholder_text = "Tipo"
caret_blink = true
caret_blink_speed = 0.5
-[node name="sub_type" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="sub_type" type="LineEdit" parent="stage/controls"]
margin_top = 540.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 592.0
placeholder_text = "Subtipo"
caret_blink = true
caret_blink_speed = 0.5
-[node name="sub_sub_type" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="sub_sub_type" type="LineEdit" parent="stage/controls"]
margin_top = 596.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 648.0
placeholder_text = "Sub-Subtipo"
caret_blink = true
caret_blink_speed = 0.5
-[node name="pathology" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="pathology" type="LineEdit" parent="stage/controls"]
margin_top = 652.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 704.0
placeholder_text = "Patologia"
caret_blink = true
caret_blink_speed = 0.5
-[node name="intervention" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="intervention" type="LineEdit" parent="stage/controls"]
margin_top = 708.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 760.0
placeholder_text = "Intervenção"
caret_blink = true
caret_blink_speed = 0.5
-[node name="urgency" type="CheckBox" parent="body/record/VBoxContainer"]
+[node name="is_urgency" type="CheckBox" parent="stage/controls"]
margin_top = 764.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 814.0
text = "Urgência"
-[node name="notes" type="LineEdit" parent="body/record/VBoxContainer"]
+[node name="notes" type="LineEdit" parent="stage/controls"]
margin_top = 818.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 870.0
placeholder_text = "Notas"
caret_blink = true
caret_blink_speed = 0.5
-[node name="output" type="RichTextLabel" parent="body/record/VBoxContainer"]
+[node name="save" type="Button" parent="stage/controls"]
margin_top = 874.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 924.0
+grow_horizontal = 2
+grow_vertical = 2
rect_min_size = Vector2( 0, 50 )
+text = "save"
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="timer" type="RichTextLabel" parent="body/record/VBoxContainer"]
+[node name="discard" type="Button" parent="stage/controls"]
margin_top = 928.0
-margin_right = 1072.0
+margin_right = 1080.0
margin_bottom = 978.0
-rect_min_size = Vector2( 0, 50 )
-__meta__ = {
-"_edit_use_anchors_": false
-}
-
-[node name="button" type="Button" parent="body/record/VBoxContainer"]
-margin_top = 982.0
-margin_right = 1072.0
-margin_bottom = 1032.0
grow_horizontal = 2
grow_vertical = 2
rect_min_size = Vector2( 0, 50 )
-text = "PRESS ME"
+text = "discard"
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="log" type="RichTextLabel" parent="body/record/VBoxContainer"]
-margin_top = 1036.0
-margin_right = 1072.0
-margin_bottom = 1086.0
-rect_min_size = Vector2( 0, 50 )
-__meta__ = {
-"_edit_use_anchors_": false
-}
-
-[node name="list" type="ScrollContainer" parent="body"]
-visible = false
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_left = 4.0
-margin_top = 30.0
-margin_right = -4.0
-margin_bottom = -4.0
-scroll_horizontal_enabled = false
-
-[node name="ItemList" type="ItemList" parent="body/list"]
-visible = false
-
[node name="menu" type="MenuButton" parent="."]
-anchor_left = 1.0
anchor_right = 1.0
-margin_left = -32.0
-margin_bottom = 26.0
+margin_bottom = 48.0
text = "≡"
+align = 2
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
@@ -221,7 +245,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
-window_title = ""
+window_title = "delete filters"
dialog_text = "Are you sure you want to delete all filters?"
dialog_autowrap = true
__meta__ = {
@@ -233,7 +257,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
-window_title = ""
+window_title = "Open a File"
mode = 0
access = 2
filters = PoolStringArray( "*.csv" )
@@ -249,7 +273,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
-window_title = ""
+window_title = "export filters"
access = 2
filters = PoolStringArray( "*.csv" )
show_hidden_files = true
@@ -260,11 +284,11 @@ __meta__ = {
}
[node name="debug" type="Label" parent="."]
-anchor_left = 1.0
+visible = false
anchor_right = 1.0
-margin_left = -571.0
-margin_top = 220.0
-margin_bottom = 829.0
+anchor_bottom = 1.0
+margin_top = 60.0
+valign = 2
__meta__ = {
"_edit_use_anchors_": false
}
diff --git a/project.godot b/project.godot
index 6657a50..41969be 100644
--- a/project.godot
+++ b/project.godot
@@ -9,18 +9,30 @@
config_version=4
_global_script_classes=[ {
+"base": "ItemList",
+"class": "Database",
+"language": "GDScript",
+"path": "res://logic/database.gd"
+}, {
"base": "Control",
"class": "DatePicker",
"language": "GDScript",
"path": "res://date_picker/date_picker.gd"
}, {
"base": "Control",
+"class": "Stage",
+"language": "GDScript",
+"path": "res://logic/stage.gd"
+}, {
+"base": "Control",
"class": "ValuePicker",
"language": "GDScript",
"path": "res://date_picker/value_picker.gd"
} ]
_global_script_class_icons={
+"Database": "",
"DatePicker": "",
+"Stage": "",
"ValuePicker": ""
}
@@ -28,11 +40,12 @@ _global_script_class_icons={
config/name="Surgery Log"
run/main_scene="res://main.tscn"
-boot_splash/image="res://icon.png"
+boot_splash/image="res://icons/icon.png"
boot_splash/fullsize=false
boot_splash/use_filter=false
boot_splash/bg_color=Color( 0, 0, 0, 1 )
-config/icon="res://icon.png"
+config/icon="res://icons/icon.png"
+config/quit_on_go_back=false
[display]
diff --git a/readme.md b/readme.md
index 8dae6e0..c2d73b0 100644
--- a/readme.md
+++ b/readme.md
@@ -1,9 +1,16 @@
Surgery Log
===========
+# Notes
+- Location of `user://`: `~/.local/share/godot/app_userdata/`.
+
# ToDo
- [x] Datepicker: On click (without drag) reset velocity to 0; show and focus 'input' to allow introducing value.
-- [ ] Input form fields is a column of input items; each input item has (from left to right) a 'LineEdit' and a 'Button'; pressing the button shows a list with possible entries for that field, and selecting an entry will copy that entry text to the 'LineEdit'; if the 'LineEdit' has text, it's 'Clear Button Enabled' is set and the 'Button' should become smaller (to allow more text to be visible.
+- [x] Selecting last (year?)/month/day and de-selecting it, moves value to next;
+- [x] Solve how entries are shared across db_screen and stage_screen;
+- [x] Remove db_entry;
+- [x] Rename db script/node to database;
+- [ ] Input form fields is a column of input items; each input item has (from left to right) a 'LineEdit' and a 'Button'; pressing the button shows a list with possible entries for that field, and selecting an entry will coyp that entry text to the 'LineEdit'; if the 'LineEdit' has text, it's 'Clear Button Enabled' is set and the 'Button' should become smaller (to allow more text to be visible.
- [ ] Share DB:
- share db via html email with db inserted in encoded downliadable field;
- Use this to send email: https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-shell-open
@@ -15,5 +22,3 @@ Surgery Log
- [ ] Create two themes:
- [ ] theme_light
- [ ] theme_dark
-
-