aboutsummaryrefslogtreecommitdiff
path: root/logic
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-04-05 05:33:23 +0000
committerdam <dam@gudinoff>2022-04-05 05:33:23 +0000
commit2e70e18f24a14f74c00850bfc88071d23ec66da9 (patch)
treef7df659d2e9620ab26c4f4baa987d94c4d7691bb /logic
parentee6d791f2b022d0c70616a490c78ba3a1f9c28f4 (diff)
downloadsurgery-log-2e70e18f24a14f74c00850bfc88071d23ec66da9.tar.zst
surgery-log-2e70e18f24a14f74c00850bfc88071d23ec66da9.zip
WIP creating theme and improving UI/UX.
Diffstat (limited to 'logic')
-rw-r--r--logic/database.gd14
-rw-r--r--logic/stage.gd5
2 files changed, 10 insertions, 9 deletions
diff --git a/logic/database.gd b/logic/database.gd
index ea27ef2..262a18a 100644
--- a/logic/database.gd
+++ b/logic/database.gd
@@ -44,18 +44,18 @@ func get_entry_view(database_entry: Dictionary) -> String:
func item_selected(index: int):
selected_idx = index
- fade_action_buttons(1.0)
+ set_buttons_active(true)
func clear_selection():
selected_idx = -1
unselect_all()
- fade_action_buttons(0.25)
+ set_buttons_active(false)
-func fade_action_buttons(target_alpha: float):
- get_node("actions/delete").modulate.a = target_alpha
- get_node("actions/edit").modulate.a = target_alpha
+func set_buttons_active(active: bool):
+ (get_node("actions/delete") as Button).disabled = !active
+ (get_node("actions/edit") as Button).disabled = !active
func delete_action():
@@ -83,14 +83,14 @@ func edit_action():
self.visible = false
stage.visible = true
var staged := (db[staged_idx] as Dictionary).duplicate(true)
- stage.set_stage(staged)
+ stage.set_stage(staged, "Entry #%d" % (staged_idx+1))
func add_action():
self.visible = false
stage.visible = true
var staged := DatabaseEntry.instance_entry()
- stage.set_stage(staged)
+ stage.set_stage(staged, "New entry")
func save_stage(entry: Dictionary):
diff --git a/logic/stage.gd b/logic/stage.gd
index 104e888..e2248fa 100644
--- a/logic/stage.gd
+++ b/logic/stage.gd
@@ -23,7 +23,7 @@ const OPTION_SETS_TREE_STRUCTURE := {
var staged_entry_hash: int
var option_sets: Dictionary
-
+onready var title := get_node("controls/title") as Label
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
@@ -124,7 +124,8 @@ func discard_action_confirmed():
emit_signal("discard")
-func set_stage(entry: Dictionary):
+func set_stage(entry: Dictionary, title: String):
+ self.title.text = title
staged_entry_hash = entry.hash()
process_id.text = entry.process_id
surgery_id.text = entry.surgery_id