Compare commits

..

2 commits

Author SHA1 Message Date
Fabien Freling 9420d4d1b4 add new entry pop-up 2024-01-31 14:02:53 +01:00
Fabien Freling 60351f8199 add db path candidates 2024-01-31 14:02:23 +01:00
5 changed files with 103 additions and 2 deletions

56
godot/NewEntry.tscn Normal file
View file

@ -0,0 +1,56 @@
[gd_scene format=3 uid="uid://dutnsmmhm8px6"]
[node name="PopupPanel" type="PopupPanel"]
size = Vector2i(100, 389)
visible = true
[node name="GridContainer" type="GridContainer" parent="."]
offset_left = 4.0
offset_top = 4.0
offset_right = 96.0
offset_bottom = 385.0
columns = 3
[node name="0" type="Button" parent="GridContainer"]
layout_mode = 2
text = "0"
[node name="1" type="Button" parent="GridContainer"]
layout_mode = 2
text = "1"
[node name="2" type="Button" parent="GridContainer"]
layout_mode = 2
text = "2"
[node name="3" type="Button" parent="GridContainer"]
layout_mode = 2
text = "3"
[node name="4" type="Button" parent="GridContainer"]
layout_mode = 2
text = "4"
[node name="5" type="Button" parent="GridContainer"]
layout_mode = 2
text = "5"
[node name="6" type="Button" parent="GridContainer"]
layout_mode = 2
text = "6"
[node name="7" type="Button" parent="GridContainer"]
layout_mode = 2
text = "7"
[node name="8" type="Button" parent="GridContainer"]
layout_mode = 2
text = "8"
[node name="9" type="Button" parent="GridContainer"]
layout_mode = 2
text = "9"
[node name="dot" type="Button" parent="GridContainer"]
layout_mode = 2
text = "."

View file

@ -21,7 +21,16 @@ func _ready():
var err = config.load(config_path)
if err == OK:
var db_path = config.get_value("general", "db_path")
load_db(db_path)
var db_success = load_db(db_path)
if not db_success:
# HACK: File picker on Android is broken
const possible_cfg_paths = ["/foo/bar/logue.cfg"]
for possible_path in possible_cfg_paths:
if FileAccess.file_exists(possible_path):
db_success = load_db(possible_path)
if db_success:
break
func switch_state(new: State):
var old = current_state

9
godot/loaded.gd Normal file
View file

@ -0,0 +1,9 @@
extends VBoxContainer
func _on_button_2_pressed():
var p = ResourceLoader.load("res://NewEntry.tscn")
var pop_up: PopupPanel = p.instantiate()
add_child(pop_up)
#pop_up.transient = true
#pop_up.exclusive = true
pop_up.show()

View file

@ -1,4 +1,6 @@
[gd_scene format=3 uid="uid://h1sdn3cjclqi"]
[gd_scene load_steps=2 format=3 uid="uid://h1sdn3cjclqi"]
[ext_resource type="Script" path="res://loaded.gd" id="1_ntmjw"]
[node name="VBoxContainer" type="VBoxContainer"]
anchors_preset = 15
@ -6,6 +8,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ntmjw")
[node name="Label" type="Label" parent="."]
layout_mode = 2
@ -30,3 +33,26 @@ text = "another one"
layout_mode = 2
size_flags_horizontal = 10
theme_override_font_sizes/font_size = 1
[node name="PanelContainer2" type="PanelContainer" parent="."]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer2"]
layout_mode = 2
alignment = 1
[node name="TextureButton" type="TextureButton" parent="PanelContainer2/HBoxContainer"]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
[node name="Label" type="Label" parent="PanelContainer2/HBoxContainer"]
layout_mode = 2
text = "Foobar"
[node name="Button2" type="Button" parent="PanelContainer2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 10
text = "+ NEW"
[connection signal="pressed" from="PanelContainer2/HBoxContainer/Button2" to="." method="_on_button_2_pressed"]

View file

@ -23,6 +23,7 @@ Global="*res://global.gd"
window/size/viewport_width=600
window/size/viewport_height=900
window/stretch/mode="canvas_items"
window/handheld/orientation=1
[editor_plugins]