From 7d9370011834f736d17ebf167701735185f2453a Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 6 Dec 2021 01:39:16 +0000 Subject: Adjust UI to match mockups (WIP). --- fonts/font_regular.tres | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 fonts/font_regular.tres (limited to 'fonts/font_regular.tres') diff --git a/fonts/font_regular.tres b/fonts/font_regular.tres new file mode 100644 index 0000000..714269f --- /dev/null +++ b/fonts/font_regular.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +use_filter = true +font_data = ExtResource( 1 ) -- cgit v1.2.3 From 2c1085cf56e8fa1baf3c764752828e7f04391d7e Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 6 Dec 2021 18:42:53 +0000 Subject: Add file dialogs for import/export filters. Height adjusted to virtual keyboard. --- export_presets.cfg | 6 +- fonts/font_regular.tres | 1 + licenses/font_b612.txt | 93 ------------------------- licenses/godot.txt | 20 ------ licenses/licenses.gd | 23 ------- main.gd | 45 ++++++------ main.tscn | 179 +++++++++++++++++++++++++++++++++--------------- menu/font_b612.txt | 93 +++++++++++++++++++++++++ menu/godot.txt | 20 ++++++ menu/menu.gd | 112 ++++++++++++++++++++++++++++++ project.godot | 4 +- readme.md | 8 +++ 12 files changed, 383 insertions(+), 221 deletions(-) delete mode 100644 licenses/font_b612.txt delete mode 100644 licenses/godot.txt delete mode 100644 licenses/licenses.gd create mode 100644 menu/font_b612.txt create mode 100644 menu/godot.txt create mode 100644 menu/menu.gd (limited to 'fonts/font_regular.tres') diff --git a/export_presets.cfg b/export_presets.cfg index da53431..ae6c4cf 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -27,7 +27,7 @@ keystore/debug_password="debug.password" keystore/release="" keystore/release_user="" keystore/release_password="" -one_click_deploy/clear_previous_install=true +one_click_deploy/clear_previous_install=false version/code=1 version/name="1.0" package/unique_name="com.gudinoff.$genname" @@ -137,7 +137,7 @@ permissions/process_outgoing_calls=false permissions/read_calendar=false permissions/read_call_log=false permissions/read_contacts=false -permissions/read_external_storage=false +permissions/read_external_storage=true permissions/read_frame_buffer=false permissions/read_history_bookmarks=false permissions/read_input_state=false @@ -188,7 +188,7 @@ permissions/write_apn_settings=false permissions/write_calendar=false permissions/write_call_log=false permissions/write_contacts=false -permissions/write_external_storage=false +permissions/write_external_storage=true permissions/write_gservices=false permissions/write_history_bookmarks=false permissions/write_profile=false diff --git a/fonts/font_regular.tres b/fonts/font_regular.tres index 714269f..095114d 100644 --- a/fonts/font_regular.tres +++ b/fonts/font_regular.tres @@ -3,5 +3,6 @@ [ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] [resource] +size = 34 use_filter = true font_data = ExtResource( 1 ) diff --git a/licenses/font_b612.txt b/licenses/font_b612.txt deleted file mode 100644 index 2826948..0000000 --- a/licenses/font_b612.txt +++ /dev/null @@ -1,93 +0,0 @@ -Copyright 2012 The B612 Project Authors (https://github.com/polarsys/b612) - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/licenses/godot.txt b/licenses/godot.txt deleted file mode 100644 index bee83fb..0000000 --- a/licenses/godot.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. -Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/licenses/licenses.gd b/licenses/licenses.gd deleted file mode 100644 index 87a8d47..0000000 --- a/licenses/licenses.gd +++ /dev/null @@ -1,23 +0,0 @@ -extends Node - -const font_b612: String = "res://licenses/font_b612.txt" -const godot: String = "res://licenses/godot.txt" - -# @DAM For now, it just keeping track of licenses and storing a sample code of how to read the files. - -func _ready(): -# load_file(file) - pass - -func load_file(file: String): - var f = File.new() - f.open(file, File.READ) - var index = 1 - while not f.eof_reached(): # iterate through all lines until the end of file is reached - var line = f.get_line() - line += " " - print(line + str(index)) - - index += 1 - f.close() - return diff --git a/main.gd b/main.gd index f6c1f88..803c2d4 100644 --- a/main.gd +++ b/main.gd @@ -1,38 +1,37 @@ extends Control - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" -var _timeout: float - -# Called when the node enters the scene tree for the first time. -func _ready(): - $output.text = "Hello!" - $button.connect("pressed", self, "_pressed") +var timeout: float +onready var controls_sensible_to_keyboard: Array = [ + self, + get_node("/root/main/about"), + get_node("/root/main/delete_filters"), + get_node("/root/main/import_filters"), + get_node("/root/main/export_filters"), +] func _process(delta: float): - $output.text = "%s" % Engine.get_frames_per_second() - $timer.text = "%s" % _timeout - if _timeout > 0.0: - _timeout -= delta + + var keyboard_height: int = OS.get_virtual_keyboard_height() + for it in controls_sensible_to_keyboard: + it.margin_bottom = -keyboard_height + + # @DAM Debug information. +# $debug.text = "%s" % Engine.get_frames_per_second() +# $debug.text = "%s" % timeout + if timeout > 0.0: + timeout -= delta else: Engine.target_fps = 10.0 -func _pressed(): - $log.text += "PRESSED\n" - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - func _input(event): Engine.target_fps = 0 - _timeout = 5.0 + timeout = 3.5 func _unhandled_input(event): Engine.target_fps = 0 - _timeout = 5.0 + timeout = 3.5 + + diff --git a/main.tscn b/main.tscn index adec227..83ee8d3 100644 --- a/main.tscn +++ b/main.tscn @@ -1,13 +1,15 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 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] [node name="main" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 theme = ExtResource( 3 ) +script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } @@ -24,7 +26,7 @@ __meta__ = { anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 4.0 -margin_top = 30.0 +margin_top = 60.0 margin_right = -4.0 margin_bottom = -4.0 scroll_horizontal_enabled = false @@ -33,24 +35,23 @@ __meta__ = { } [node name="VBoxContainer" type="VBoxContainer" parent="body/record"] -margin_right = 712.0 -margin_bottom = 1246.0 +margin_right = 1072.0 +margin_bottom = 1856.0 rect_clip_content = true size_flags_horizontal = 3 size_flags_vertical = 3 -script = ExtResource( 1 ) [node name="process_number" type="LineEdit" parent="body/record/VBoxContainer"] -margin_right = 712.0 -margin_bottom = 30.0 +margin_right = 1072.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"] -margin_top = 34.0 -margin_right = 712.0 -margin_bottom = 64.0 +margin_top = 56.0 +margin_right = 1072.0 +margin_bottom = 108.0 placeholder_text = "Nº Cirurgia" caret_blink = true caret_blink_speed = 0.5 @@ -58,111 +59,111 @@ caret_blink_speed = 0.5 [node name="date_picker" parent="body/record/VBoxContainer" instance=ExtResource( 2 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 68.0 -margin_right = 712.0 -margin_bottom = 268.0 +margin_top = 112.0 +margin_right = 1072.0 +margin_bottom = 312.0 rect_min_size = Vector2( 400, 200 ) [node name="place" type="LineEdit" parent="body/record/VBoxContainer"] -margin_top = 272.0 -margin_right = 712.0 -margin_bottom = 302.0 +margin_top = 316.0 +margin_right = 1072.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"] -margin_top = 306.0 -margin_right = 712.0 -margin_bottom = 336.0 +margin_top = 372.0 +margin_right = 1072.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"] -margin_top = 340.0 -margin_right = 712.0 -margin_bottom = 370.0 +margin_top = 428.0 +margin_right = 1072.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"] -margin_top = 374.0 -margin_right = 712.0 -margin_bottom = 404.0 +margin_top = 484.0 +margin_right = 1072.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"] -margin_top = 408.0 -margin_right = 712.0 -margin_bottom = 438.0 +margin_top = 540.0 +margin_right = 1072.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"] -margin_top = 442.0 -margin_right = 712.0 -margin_bottom = 472.0 +margin_top = 596.0 +margin_right = 1072.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"] -margin_top = 476.0 -margin_right = 712.0 -margin_bottom = 506.0 +margin_top = 652.0 +margin_right = 1072.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"] -margin_top = 510.0 -margin_right = 712.0 -margin_bottom = 540.0 +margin_top = 708.0 +margin_right = 1072.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"] -margin_top = 544.0 -margin_right = 712.0 -margin_bottom = 572.0 +margin_top = 764.0 +margin_right = 1072.0 +margin_bottom = 814.0 text = "Urgência" [node name="notes" type="LineEdit" parent="body/record/VBoxContainer"] -margin_top = 576.0 -margin_right = 712.0 -margin_bottom = 606.0 +margin_top = 818.0 +margin_right = 1072.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"] -margin_top = 610.0 -margin_right = 712.0 -margin_bottom = 660.0 +margin_top = 874.0 +margin_right = 1072.0 +margin_bottom = 924.0 rect_min_size = Vector2( 0, 50 ) __meta__ = { "_edit_use_anchors_": false } [node name="timer" type="RichTextLabel" parent="body/record/VBoxContainer"] -margin_top = 664.0 -margin_right = 712.0 -margin_bottom = 714.0 +margin_top = 928.0 +margin_right = 1072.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 = 718.0 -margin_right = 712.0 -margin_bottom = 768.0 +margin_top = 982.0 +margin_right = 1072.0 +margin_bottom = 1032.0 grow_horizontal = 2 grow_vertical = 2 rect_min_size = Vector2( 0, 50 ) @@ -172,9 +173,9 @@ __meta__ = { } [node name="log" type="RichTextLabel" parent="body/record/VBoxContainer"] -margin_top = 772.0 -margin_right = 712.0 -margin_bottom = 822.0 +margin_top = 1036.0 +margin_right = 1072.0 +margin_bottom = 1086.0 rect_min_size = Vector2( 0, 50 ) __meta__ = { "_edit_use_anchors_": false @@ -198,8 +199,72 @@ anchor_left = 1.0 anchor_right = 1.0 margin_left = -32.0 margin_bottom = 26.0 -text = "#" -items = [ "Importar filtros", null, 0, false, false, 0, 0, null, "", false, "Exportar filtros", null, 0, false, false, 1, 0, null, "", false, "Apagar filtros", null, 0, false, false, 2, 0, null, "", false, "Sobre", null, 0, false, false, 3, 0, null, "", false ] +text = "≡" +script = ExtResource( 4 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="about" type="AcceptDialog" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +window_title = "" +dialog_autowrap = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="delete_filters" type="ConfirmationDialog" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +window_title = "" +dialog_text = "Are you sure you want to delete all filters?" +dialog_autowrap = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="import_filters" type="FileDialog" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +window_title = "" +mode = 0 +access = 2 +filters = PoolStringArray( "*.csv" ) +show_hidden_files = true +current_dir = "" +current_path = "" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="export_filters" type="FileDialog" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +window_title = "" +access = 2 +filters = PoolStringArray( "*.csv" ) +show_hidden_files = true +current_dir = "" +current_path = "" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="debug" type="Label" parent="."] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -571.0 +margin_top = 220.0 +margin_bottom = 829.0 __meta__ = { "_edit_use_anchors_": false } diff --git a/menu/font_b612.txt b/menu/font_b612.txt new file mode 100644 index 0000000..2826948 --- /dev/null +++ b/menu/font_b612.txt @@ -0,0 +1,93 @@ +Copyright 2012 The B612 Project Authors (https://github.com/polarsys/b612) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/menu/godot.txt b/menu/godot.txt new file mode 100644 index 0000000..bee83fb --- /dev/null +++ b/menu/godot.txt @@ -0,0 +1,20 @@ +Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. +Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/menu/menu.gd b/menu/menu.gd new file mode 100644 index 0000000..55c74fa --- /dev/null +++ b/menu/menu.gd @@ -0,0 +1,112 @@ +extends MenuButton + +const menu_items: Array = [ + { label = "IMPORT FILTERS", action = "_menu_import_filters_action" }, + { label = "EXPORT FILTERS", action = "_menu_export_filters_action" }, + { label = "CLEAR FILTERS", action = "_menu_clear_filters_action" }, + { label = "ABOUT", action = "_menu_about_action" }, +] +const license_font_b612: String = "res://licenses/font_b612.txt" +const license_godot: String = "res://licenses/godot.txt" + +onready var popup: PopupMenu = get_popup() +onready var debug: Label = get_node("/root/main/debug") as Label + +func _ready(): + + for idx in range(menu_items.size()): + popup.add_item(menu_items[idx].label, idx) + popup.connect("id_pressed", self, "id_pressed") + +# load_file(file) + + + +func id_pressed(id: int): + debug.text += "'%d':'%s'" % [id, menu_items[id].action] + self.call_deferred(menu_items[id].action) + debug.text += "!\n" + + +var csv_file: Array +var has_permissions := false +func _menu_import_filters_action(): + +# printerr("pressed: %s" % get_stack()[0]); + debug.text += "> import: " + + if OS.get_name() == "Android": + while not has_permissions: + var permissions := Array(OS.get_granted_permissions()) + if not permissions.has("android.permission.READ_EXTERNAL_STORAGE") \ + or not permissions.has("android.permission.WRITE_EXTERNAL_STORAGE"): + OS.request_permissions() + # await get_tree().create_timer(1).timeout + yield(get_tree().create_timer(1), "timeout") # - for Godot 3 branch + else: + has_permissions = true + + + + var file_dialog := get_node("/root/main/import_filters") as FileDialog + file_dialog.current_dir = OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS) + file_dialog.connect("file_selected", self, "file_selected", [], CONNECT_ONESHOT) + file_dialog.show_modal(true) + file_dialog.invalidate() +# printerr("download: '%s'" % OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS)) + +func file_selected(path: String): + debug.text += "'%s'\n" % path + + var file = File.new() + file.open(path, File.READ) + while file.eof_reached() == false: + var line = file.get_line() + csv_file.append(line) + printerr("%s" % line) + file.close() + +func _menu_export_filters_action(): + debug.text += "> export: \n" +# printerr("pressed: %s" % get_stack()[0]); + var file_dialog := get_node("/root/main/export_filters") as FileDialog + file_dialog.current_dir = OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS) + file_dialog.connect("file_selected", self, "file_selected_export", [], CONNECT_ONESHOT) + file_dialog.show_modal(true) + file_dialog.invalidate() + +func file_selected_export(path: String): + debug.text += "'%s'\n" % path + var file = File.new() + file.open(path, File.WRITE) + for ln in csv_file: + file.store_line(ln) + file.close() + + +func _menu_clear_filters_action(): + debug.text += "> clear\n" +# printerr("pressed: %s" % get_stack()[0]); + (get_node("/root/main/delete_filters") as ConfirmationDialog).show_modal(true) + + +func _menu_about_action(): +# printerr("pressed: %s" % get_stack()[0]); + debug.text += "> about\n" + (get_node("/root/main/about") as AcceptDialog).show_modal() + + +#func load_file(file: String): +# var f = File.new() +# f.open(file, File.READ) +# var index = 1 +# while not f.eof_reached(): # iterate through all lines until the end of file is reached +# var line = f.get_line() +# line += " " +# print(line + str(index)) +# +# index += 1 +# f.close() +# return + + diff --git a/project.godot b/project.godot index 4c68d91..6657a50 100644 --- a/project.godot +++ b/project.godot @@ -36,8 +36,8 @@ config/icon="res://icon.png" [display] -window/size/width=720 -window/size/height=1280 +window/size/width=1080 +window/size/height=1920 window/size/test_width=576 window/size/test_height=1024 window/energy_saving/keep_screen_on=false diff --git a/readme.md b/readme.md index deaf374..8dae6e0 100644 --- a/readme.md +++ b/readme.md @@ -7,5 +7,13 @@ Surgery Log - [ ] 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 +- [ ] File dialogs should be dismissed when back button is pressed (instead of closing the app); +- [ ] Translations: + - https://docs.godotengine.org/en/stable/getting_started/workflow/assets/importing_translations.html + - https://docs.godotengine.org/en/stable/tutorials/i18n/internationalizing_games.html#introduction +- [ ] Set tabs titles dynamically: https://docs.godotengine.org/en/stable/classes/class_tabcontainer.html?highlight=tabcontainer#class-tabcontainer-method-set-tab-title +- [ ] Create two themes: + - [ ] theme_light + - [ ] theme_dark -- cgit v1.2.3 From 5b863fdc25848817ef11f0c1a33ef45a4160aa2c Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 27 Dec 2021 03:31:03 +0000 Subject: Allow to scroll database screen without selecting item on touch-down. --- fonts/font_regular.tres | 2 +- logic/database.gd | 95 ++++++---------------------------- logic/stage.gd | 8 --- main.tscn | 12 ++++- test_input.gd | 42 +++++++++++++++ test_input.tscn | 58 +++++++++++++++++++++ touch_scroll.gd | 134 ++++++++++++++++++++++++++++-------------------- 7 files changed, 207 insertions(+), 144 deletions(-) create mode 100644 test_input.gd create mode 100644 test_input.tscn (limited to 'fonts/font_regular.tres') diff --git a/fonts/font_regular.tres b/fonts/font_regular.tres index 095114d..01b4567 100644 --- a/fonts/font_regular.tres +++ b/fonts/font_regular.tres @@ -3,6 +3,6 @@ [ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] [resource] -size = 34 +size = 32 use_filter = true font_data = ExtResource( 1 ) diff --git a/logic/database.gd b/logic/database.gd index 5f91c12..ea02324 100644 --- a/logic/database.gd +++ b/logic/database.gd @@ -54,6 +54,9 @@ func _ready(): func _notification(what: int): + if visible == false: + return + if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST: if selected_idx >= 0: clear_selection() @@ -61,22 +64,6 @@ func _notification(what: int): get_tree().quit() -# @DAM Testing -#var last_event -#var bypass: bool = false -#func _gui_input(event: InputEvent): -# if bypass == false: -# if event is InputEventScreenTouch && event.is_pressed(): -# accept_event() -# last_event = event -# elif event is InputEventScreenTouch && event.is_pressed() == false: -# bypass = true -# get_tree().input_event(event) -# bypass = false -# else: -# var x = 3 - - 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)] @@ -102,6 +89,7 @@ func delete_action(): db.remove(selected_idx) self.remove_item(selected_idx) + selected_idx = -1 store_database() @@ -122,15 +110,25 @@ func add_action(): stage.set_stage(staged) +func scroll_down(): + get_v_scroll().value = get_v_scroll().max_value + + func save(database_entry: Dictionary): database_entry = instance_entry(database_entry) # @DAM Maybe we could not be creating endless dictionaries? + var next_selected_idx: int if staged_idx >= 0: db[staged_idx] = database_entry - set_item_text(staged_idx, get_entry_view(database_entry)) + next_selected_idx = staged_idx else: db.append(database_entry) add_item(get_entry_view(database_entry)) + call_deferred("scroll_down") + next_selected_idx = db.size() - 1 + store_database() + select(next_selected_idx) + item_selected(next_selected_idx) # Calling "select" does not trigger the "item_selected" signal. staged_idx = -1 self.visible = true @@ -254,7 +252,7 @@ static func set_entry_date(entry: Dictionary, date: String): func fake_database(): db.resize(0) - for idx in range(50): + for idx in range(500): var date_year = 1 + int(float(idx) / 365.0) var date_month = idx % 12 var date_day = idx % 365 @@ -264,64 +262,3 @@ func fake_database(): "date": "%04d-%02d-%02d" % [date_year, date_month, date_day] })) - - - - - - -# @DAM Testing. -export(float) var drag_threshold = 5 - -onready var touch_enabled = OS.has_touchscreen_ui_hint() -onready var v_scroll = get_v_scroll() - -var dragging = false -var pressed = false -var last_event -# must be _input, as _gui_input has bugs, with no touch.pressed = false events -# see: https://github.com/godotengine/godot/issues/16761 -func _gui_input(event): - - if event is InputEventScreenDrag: - self.v_scroll.value -= event.relative.y - - return - if not visible: - return - - if not touch_enabled: - return - - if event is InputEventScreenDrag: - accept_event() - if event.speed == Vector2(): - # we're on a device and speed is broken - # see: https://github.com/godotengine/godot/issues/3623 - event.speed = event.relative - if abs(event.speed.y) >= drag_threshold: - # scroll the list - dragging = true - v_scroll.value -= event.relative.y - return - - if event is InputEventScreenTouch: - if event.index == 0: - accept_event() - if dragging && event.pressed == false: - # prints("end drag") - dragging = false - pressed = false - else: - if event.pressed && pressed == false: - # prints("touch start") - pressed = true - accept_event() - # TODO: prevent select highlight - elif !event.pressed && pressed == true: - # prints("touch end and accept") - pressed = false - var ev = InputEventAction.new() - ev.action = "ui_accept" - ev.pressed = true - Input.parse_input_event(ev) diff --git a/logic/stage.gd b/logic/stage.gd index 207b451..ac5e9aa 100644 --- a/logic/stage.gd +++ b/logic/stage.gd @@ -100,11 +100,3 @@ func _notification(what: int): 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.tscn b/main.tscn index 4096c59..b584c88 100644 --- a/main.tscn +++ b/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 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] @@ -9,6 +9,7 @@ [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] +[ext_resource path="res://touch_scroll.gd" type="Script" id=10] [node name="main" type="Control"] anchor_right = 1.0 @@ -28,6 +29,15 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="touch_scroll" type="Control" parent="database"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -8.0 +script = ExtResource( 10 ) +__meta__ = { +"_edit_use_anchors_": false +} + [node name="actions" type="VBoxContainer" parent="database"] anchor_left = 1.0 anchor_top = 1.0 diff --git a/test_input.gd b/test_input.gd new file mode 100644 index 0000000..bae409d --- /dev/null +++ b/test_input.gd @@ -0,0 +1,42 @@ +extends ColorRect + +onready var debug: RichTextLabel = get_node("/root/main/debug") + + +func _gui_input(event): +# if name == "a": +# accept_event() +# if name == "b" : #&& (event is InputEventScreenTouch): +# if name == "b": +# get_tree().set_input_as_handled() +# accept_event() +# if name == "b" && event is InputEventScreenTouch && event.is_pressed() == false: +# simulate_click() +# call_deferred("simulate_click") + + if event is InputEventScreenTouch || event is InputEventMouseButton: + debug.text += "%s> %-24s\t:\t%s\n" % [name, event.get_class(), event.is_pressed()] + else: + debug.text += "%s> %s\n" % [name, event.get_class()] + + +func simulate_click(): + var event_touch = InputEventScreenTouch.new() + event_touch.index = 0 + event_touch.position = self.get_global_mouse_position() + + var event_mouse = InputEventMouseButton.new() + event_mouse.button_index = BUTTON_LEFT + event_mouse.button_mask = BUTTON_MASK_LEFT + event_mouse.position = self.get_global_mouse_position() + + self.mouse_filter = Control.MOUSE_FILTER_IGNORE + event_mouse.pressed = true + event_touch.pressed = true +# Input.parse_input_event(event_mouse) + Input.parse_input_event(event_touch) + event_mouse.pressed = false + event_touch.pressed = false +# Input.parse_input_event(event_mouse) + Input.parse_input_event(event_touch) + self.mouse_filter = Control.MOUSE_FILTER_STOP diff --git a/test_input.tscn b/test_input.tscn new file mode 100644 index 0000000..4b507fe --- /dev/null +++ b/test_input.tscn @@ -0,0 +1,58 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://test_input.gd" type="Script" id=1] +[ext_resource path="res://fonts/font_regular.tres" type="DynamicFont" id=2] + +[node name="main" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="debug" type="RichTextLabel" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +custom_fonts/normal_font = ExtResource( 2 ) +scroll_following = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="a" type="ColorRect" parent="."] +anchor_right = 0.66 +anchor_bottom = 0.66 +color = Color( 1, 0, 0, 0.196078 ) +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="b" type="ColorRect" parent="a"] +anchor_left = 0.5 +anchor_right = 1.502 +anchor_bottom = 1.0 +mouse_filter = 1 +color = Color( 0, 1, 0, 0.196078 ) +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="c" type="ColorRect" parent="."] +anchor_top = 0.333 +anchor_right = 0.666 +anchor_bottom = 1.0 +color = Color( 0, 0, 1, 0.196078 ) +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="d" type="ColorRect" parent="c"] +anchor_left = 0.5 +anchor_right = 1.502 +anchor_bottom = 1.0 +color = Color( 1, 1, 1, 0.196078 ) +script = ExtResource( 1 ) diff --git a/touch_scroll.gd b/touch_scroll.gd index ea92087..f2aeca7 100644 --- a/touch_scroll.gd +++ b/touch_scroll.gd @@ -1,66 +1,90 @@ extends Control +const VELOCITY_DECAYING_FACTOR: float = 5.5 +const DRAG_THRESHOLD_CM: float = 0.250 -func _gui_input(event: InputEvent): -#func _input(event: InputEvent): -# return - if event is InputEventScreenDrag: - self.v_scroll.value -= event.relative.y -# accept_event() +var pointer: Dictionary +var anchor: float +var offset: float +var screen_dpcm: float + +onready var target: Control = get_parent() +onready var target_scroll: VScrollBar = get_parent().get_v_scroll() + + +func _ready(): + pointer = { + index = -1, + initial_position = Vector2.ZERO, + current_position = Vector2.ZERO, + velocity = Vector2.ZERO, + was_dragged = false, + is_active = false, + } + screen_dpcm = float(OS.get_screen_dpi()) / 2.54 -#func _gui_input(event): -# accept_event() -# get_tree().set_input_as_handled() -# if event is InputEventScreenDrag: -# get_parent().v_scroll.value -= event.relative.y +func _process(delta: float): + if pointer.is_active: + var dragged_distance: float = - (pointer.current_position.y - pointer.initial_position.y) + offset = anchor + dragged_distance + self.target_scroll.value = offset + elif pointer.velocity.length() > 0.5: + pointer.velocity *= clamp((1.0 - VELOCITY_DECAYING_FACTOR * delta), 0.0, 1.0) + offset -= pointer.velocity.y * delta + self.target_scroll.value = offset -export(float) var drag_threshold = 5 -onready var touch_enabled = OS.has_touchscreen_ui_hint() -onready var v_scroll = get_parent().get_v_scroll() -var dragging = false -var pressed = false -var last_event -# must be _input, as _gui_input has bugs, with no touch.pressed = false events -# see: https://github.com/godotengine/godot/issues/16761 -func _input_disabled(event): -#func _gui_input(event): +func _gui_input(event: InputEvent): + + # @DAM A bug on GODOT-3.X makes events from non-mouse-emulated pointers (index > 0) unreliable. + if event is InputEventScreenTouch || event is InputEventScreenDrag: + if event.index != 0: + return + + if event is InputEventScreenTouch && (pointer.is_active == false || pointer.index == event.index): + var touch := event as InputEventScreenTouch + pointer.is_active = event.pressed + pointer.current_position = touch.position + if pointer.is_active: + pointer.index = touch.index + pointer.initial_position = touch.position + anchor = self.target_scroll.value + else: + if pointer.was_dragged == false: # Click detected. + simulate_gui_click() + pointer.index = -1 + pointer.was_dragged = false - if not visible: - return + if event is InputEventScreenDrag && event.index == pointer.index: + var drag := event as InputEventScreenDrag + pointer.current_position = drag.position + pointer.velocity = drag.speed + if pointer.current_position.distance_to(pointer.initial_position) / screen_dpcm > DRAG_THRESHOLD_CM: + pointer.was_dragged = true - if not touch_enabled: - return - if event is InputEventScreenDrag: - accept_event() - if event.speed == Vector2(): - # we're on a device and speed is broken - # see: https://github.com/godotengine/godot/issues/3623 - event.speed = event.relative - if abs(event.speed.y) >= drag_threshold: - # scroll the list - dragging = true - v_scroll.value -= event.relative.y - return +func simulate_gui_click(): + + var position := self.get_global_mouse_position() - target.rect_global_position + + var event_touch := InputEventScreenTouch.new() + event_touch.index = 0 + event_touch.position = position + + var event_mouse := InputEventMouseButton.new() + event_mouse.button_index = BUTTON_LEFT + event_mouse.button_mask = BUTTON_MASK_LEFT + event_mouse.position = position + + event_mouse.pressed = true + event_touch.pressed = true + target._gui_input(event_mouse) + target._gui_input(event_touch) + + event_mouse.pressed = false + event_touch.pressed = false + target._gui_input(event_mouse) + target._gui_input(event_touch) + - if event is InputEventScreenTouch: - if event.index == 0: - accept_event() - if dragging && event.pressed == false: - # prints("end drag") - dragging = false - pressed = false - else: - if event.pressed && pressed == false: - # prints("touch start") - pressed = true - # TODO: prevent select highlight - elif !event.pressed && pressed == true: - # prints("touch end and accept") - pressed = false - var ev = InputEventAction.new() - ev.action = "ui_accept" - ev.pressed = true - Input.parse_input_event(ev) -- cgit v1.2.3 From 8bcba716764ba2ebee433fad816f922e44f892bd Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 14 Feb 2022 00:46:40 +0000 Subject: Improve popup appearance. --- fonts/font_regular.tres | 2 +- logic/popup_list.gd | 5 ++++- main.tscn | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'fonts/font_regular.tres') diff --git a/fonts/font_regular.tres b/fonts/font_regular.tres index 01b4567..d42e75b 100644 --- a/fonts/font_regular.tres +++ b/fonts/font_regular.tres @@ -3,6 +3,6 @@ [ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] [resource] -size = 32 +size = 42 use_filter = true font_data = ExtResource( 1 ) diff --git a/logic/popup_list.gd b/logic/popup_list.gd index 1dd156c..43bf2a1 100644 --- a/logic/popup_list.gd +++ b/logic/popup_list.gd @@ -2,7 +2,8 @@ extends Popup signal item_selected -onready var item_list := get_node("list") as TouchItemList +onready var item_list := get_node("list") as TouchItemList +onready var blur := get_node("blur") as ColorRect func _ready(): @@ -15,6 +16,8 @@ func popup_options(options: Array): for it in options: item_list.add_item(it) self.popup_centered_ratio(0.9) + blur.rect_global_position = Vector2.ZERO + blur.rect_size = get_viewport_rect().size func selected(index: int): diff --git a/main.tscn b/main.tscn index 1169994..a378319 100644 --- a/main.tscn +++ b/main.tscn @@ -317,6 +317,12 @@ anchor_bottom = 1.0 popup_exclusive = true script = ExtResource( 10 ) +[node name="blur" type="ColorRect" parent="popup_list"] +show_behind_parent = true +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.75 ) + [node name="list" parent="popup_list" instance=ExtResource( 11 )] margin_top = 0.0 -- cgit v1.2.3 From a34abdedf2feebcd17e402d9ed650a7cd17cbfe9 Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 28 Mar 2022 16:03:15 +0000 Subject: Changed from mono to regular font. Database screen kept the mono font. Updated to do list. --- fonts/B612-Regular.ttf | Bin 0 -> 153192 bytes fonts/B612Mono-Bold.ttf | Bin 135908 -> 0 bytes fonts/B612Mono-BoldItalic.ttf | Bin 121736 -> 0 bytes fonts/B612Mono-Italic.ttf | Bin 118892 -> 0 bytes fonts/font_icons.tres | 2 +- fonts/font_mono_regular.tres | 8 ++++++++ fonts/font_regular.tres | 2 +- main.tscn | 24 ++++++++---------------- readme.md | 10 +++++++++- 9 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 fonts/B612-Regular.ttf delete mode 100644 fonts/B612Mono-Bold.ttf delete mode 100644 fonts/B612Mono-BoldItalic.ttf delete mode 100644 fonts/B612Mono-Italic.ttf create mode 100644 fonts/font_mono_regular.tres (limited to 'fonts/font_regular.tres') diff --git a/fonts/B612-Regular.ttf b/fonts/B612-Regular.ttf new file mode 100644 index 0000000..0574897 Binary files /dev/null and b/fonts/B612-Regular.ttf differ diff --git a/fonts/B612Mono-Bold.ttf b/fonts/B612Mono-Bold.ttf deleted file mode 100644 index 5e7df80..0000000 Binary files a/fonts/B612Mono-Bold.ttf and /dev/null differ diff --git a/fonts/B612Mono-BoldItalic.ttf b/fonts/B612Mono-BoldItalic.ttf deleted file mode 100644 index 8a6cd6c..0000000 Binary files a/fonts/B612Mono-BoldItalic.ttf and /dev/null differ diff --git a/fonts/B612Mono-Italic.ttf b/fonts/B612Mono-Italic.ttf deleted file mode 100644 index 84bbffc..0000000 Binary files a/fonts/B612Mono-Italic.ttf and /dev/null differ diff --git a/fonts/font_icons.tres b/fonts/font_icons.tres index 77ff369..90f92cf 100644 --- a/fonts/font_icons.tres +++ b/fonts/font_icons.tres @@ -1,6 +1,6 @@ [gd_resource type="DynamicFont" load_steps=2 format=2] -[ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://fonts/B612-Regular.ttf" type="DynamicFontData" id=1] [resource] size = 128 diff --git a/fonts/font_mono_regular.tres b/fonts/font_mono_regular.tres new file mode 100644 index 0000000..d42e75b --- /dev/null +++ b/fonts/font_mono_regular.tres @@ -0,0 +1,8 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 42 +use_filter = true +font_data = ExtResource( 1 ) diff --git a/fonts/font_regular.tres b/fonts/font_regular.tres index d42e75b..718443e 100644 --- a/fonts/font_regular.tres +++ b/fonts/font_regular.tres @@ -1,6 +1,6 @@ [gd_resource type="DynamicFont" load_steps=2 format=2] -[ext_resource path="res://fonts/B612Mono-Regular.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://fonts/B612-Regular.ttf" type="DynamicFontData" id=1] [resource] size = 42 diff --git a/main.tscn b/main.tscn index 8e750d4..0b3d4a0 100644 --- a/main.tscn +++ b/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=14 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] @@ -12,6 +12,7 @@ [ext_resource path="res://logic/popup.gd" type="Script" id=10] [ext_resource path="res://touch_item_list/touch_item_list.tscn" type="PackedScene" id=11] [ext_resource path="res://touch_vertical_container/touch_vertical_container.tscn" type="PackedScene" id=12] +[ext_resource path="res://fonts/font_mono_regular.tres" type="DynamicFont" id=13] [node name="main" type="Control"] anchor_right = 1.0 @@ -20,6 +21,7 @@ theme = ExtResource( 3 ) script = ExtResource( 1 ) [node name="database" parent="." instance=ExtResource( 11 )] +custom_fonts/font = ExtResource( 13 ) script = ExtResource( 5 ) [node name="menu" type="MenuButton" parent="database"] @@ -48,7 +50,7 @@ __meta__ = { } [node name="delete" type="Button" parent="database/actions"] -margin_right = 95.0 +margin_right = 102.0 margin_bottom = 162.0 focus_mode = 0 custom_fonts/font = ExtResource( 6 ) @@ -61,7 +63,7 @@ __meta__ = { [node name="edit" type="Button" parent="database/actions"] margin_top = 166.0 -margin_right = 95.0 +margin_right = 102.0 margin_bottom = 328.0 focus_mode = 0 custom_fonts/font = ExtResource( 6 ) @@ -74,7 +76,7 @@ __meta__ = { [node name="add" type="Button" parent="database/actions"] margin_top = 332.0 -margin_right = 95.0 +margin_right = 102.0 margin_bottom = 494.0 focus_mode = 0 custom_fonts/font = ExtResource( 6 ) @@ -224,7 +226,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 size_flags_horizontal = 3 size_flags_vertical = 3 -window_title = "PICK FILE" +window_title = "" mode_overrides_title = false access = 2 filters = PoolStringArray( "*.*" ) @@ -240,7 +242,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 size_flags_horizontal = 3 size_flags_vertical = 3 -window_title = "CONFIRM ACTION" +window_title = "" dialog_text = "Do you confirm this action?" dialog_autowrap = true @@ -262,14 +264,4 @@ visible = false rect_clip_content = true script = ExtResource( 8 ) -[node name="debug" type="Label" parent="."] -visible = false -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_top = 60.0 -valign = 2 -__meta__ = { -"_edit_use_anchors_": false -} - [editable path="stage"] diff --git a/readme.md b/readme.md index 4db4993..942dbde 100644 --- a/readme.md +++ b/readme.md @@ -48,7 +48,15 @@ Surgery Log - [x] Tweak 'POINTER_VELOCITY_DECAYING_FACTOR' and 'POINTER_VELOCITY_BOOST_FACTOR' on database and stage screens; - [x] Allow to parse option sets from database file; - [x] Check if import_option_sets, store_option_sets, store_database require the parameter save_changes; this requires changes on databse, stage and menu scripts; -- [ ] Fix option sets GUI element to provide word-wrap, otherwise long texts will be hidden; +- [x] Maybe replace fonts with non-mono version; +- [x] Fix option sets GUI element to provide word-wrap, otherwise long texts will be hidden; +- [ ] Maybe include different font with better icons; +- [ ] After save and load, entries opened on stage always detect changes (even when no change occurs); +- [ ] Check google icons as alternatives; +- [ ] Make all buttons with same style; +- [ ] Option set list should show title; +- [ ] Option set list should have close button: maybe use the "hide" signal to better control when the "option_set_list" and "popup" close; This way, the popup may have it's own button to close it? And maybe even a title? +- [ ] Make confirm dialog look better; - [ ] Fix back button: - on stage screen should show pop-up asking it changes are to be discarded; - on file-pickers screen should close them; -- cgit v1.2.3 From c48a25f810436abf149225020279220dac3b78ec Mon Sep 17 00:00:00 2001 From: dam Date: Tue, 5 Apr 2022 06:18:39 +0000 Subject: Improved is_urgency button layout and visual. Changed font size. --- fonts/font_regular.tres | 2 +- main.tscn | 68 ++++++++++++++++++++++++------------------------- themes/dark.tres | 36 +++++++++++++------------- 3 files changed, 54 insertions(+), 52 deletions(-) (limited to 'fonts/font_regular.tres') diff --git a/fonts/font_regular.tres b/fonts/font_regular.tres index 718443e..1090222 100644 --- a/fonts/font_regular.tres +++ b/fonts/font_regular.tres @@ -3,6 +3,6 @@ [ext_resource path="res://fonts/B612-Regular.ttf" type="DynamicFontData" id=1] [resource] -size = 42 +size = 32 use_filter = true font_data = ExtResource( 1 ) diff --git a/main.tscn b/main.tscn index 157f171..bbb3a13 100644 --- a/main.tscn +++ b/main.tscn @@ -74,9 +74,9 @@ __meta__ = { } [node name="edit" type="Button" parent="database/actions"] -margin_top = 90.0 +margin_top = 96.0 margin_right = 73.0 -margin_bottom = 176.0 +margin_bottom = 182.0 focus_mode = 0 custom_fonts/font = ExtResource( 6 ) custom_styles/normal = SubResource( 1 ) @@ -88,9 +88,9 @@ __meta__ = { } [node name="add" type="Button" parent="database/actions"] -margin_top = 180.0 +margin_top = 192.0 margin_right = 73.0 -margin_bottom = 266.0 +margin_bottom = 278.0 focus_mode = 0 custom_fonts/font = ExtResource( 6 ) custom_styles/normal = SubResource( 1 ) @@ -111,18 +111,18 @@ margin_bottom = 52.0 align = 1 [node name="process_id" type="LineEdit" parent="stage/controls" index="1"] -margin_top = 56.0 +margin_top = 62.0 margin_right = 1080.0 -margin_bottom = 118.0 +margin_bottom = 124.0 max_length = 32 placeholder_text = "Process #" caret_blink = true caret_blink_speed = 0.5 [node name="surgery_id" type="LineEdit" parent="stage/controls" index="2"] -margin_top = 122.0 +margin_top = 134.0 margin_right = 1080.0 -margin_bottom = 184.0 +margin_bottom = 196.0 max_length = 32 placeholder_text = "Surgery #" caret_blink = true @@ -132,103 +132,103 @@ caret_blink_speed = 0.5 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 340.0 -margin_top = 188.0 +margin_top = 206.0 margin_right = 740.0 -margin_bottom = 388.0 +margin_bottom = 406.0 rect_min_size = Vector2( 400, 200 ) size_flags_horizontal = 4 [node name="place" parent="stage/controls" index="4" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 392.0 +margin_top = 416.0 margin_right = 1080.0 -margin_bottom = 454.0 +margin_bottom = 478.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Place" [node name="anesthesia" parent="stage/controls" index="5" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 458.0 +margin_top = 488.0 margin_right = 1080.0 -margin_bottom = 520.0 +margin_bottom = 550.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Anesthesia" [node name="first_assistant" parent="stage/controls" index="6" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 524.0 +margin_top = 560.0 margin_right = 1080.0 -margin_bottom = 586.0 +margin_bottom = 622.0 rect_min_size = Vector2( 0, 62 ) placeholder = "First assistant" [node name="type" parent="stage/controls" index="7" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 590.0 +margin_top = 632.0 margin_right = 1080.0 -margin_bottom = 652.0 +margin_bottom = 694.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Type" [node name="sub_type" parent="stage/controls" index="8" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 656.0 +margin_top = 704.0 margin_right = 1080.0 -margin_bottom = 718.0 +margin_bottom = 766.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Sub-type" [node name="sub_sub_type" parent="stage/controls" index="9" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 722.0 +margin_top = 776.0 margin_right = 1080.0 -margin_bottom = 784.0 +margin_bottom = 838.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Sub-sub-type" [node name="pathology" parent="stage/controls" index="10" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 788.0 +margin_top = 848.0 margin_right = 1080.0 -margin_bottom = 850.0 +margin_bottom = 910.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Pathology" [node name="intervention" parent="stage/controls" index="11" instance=ExtResource( 7 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 854.0 +margin_top = 920.0 margin_right = 1080.0 -margin_bottom = 916.0 +margin_bottom = 982.0 rect_min_size = Vector2( 0, 62 ) placeholder = "Intervention" -[node name="is_urgency" type="CheckBox" parent="stage/controls" index="12"] -margin_top = 920.0 +[node name="is_urgency" type="CheckButton" parent="stage/controls" index="12"] +margin_top = 992.0 margin_right = 1080.0 -margin_bottom = 972.0 -text = "Urgência" +margin_bottom = 1044.0 +text = "Is urgency" [node name="notes" type="LineEdit" parent="stage/controls" index="13"] -margin_top = 976.0 +margin_top = 1054.0 margin_right = 1080.0 -margin_bottom = 1038.0 +margin_bottom = 1116.0 max_length = 4096 placeholder_text = "Notes" caret_blink = true caret_blink_speed = 0.5 [node name="buttons" type="Control" parent="stage/controls" index="14"] -margin_top = 1042.0 +margin_top = 1126.0 margin_right = 1080.0 -margin_bottom = 1042.0 +margin_bottom = 1126.0 [node name="discard" type="Button" parent="stage/controls/buttons"] anchor_right = 0.5 diff --git a/themes/dark.tres b/themes/dark.tres index 717b9c2..b556b88 100644 --- a/themes/dark.tres +++ b/themes/dark.tres @@ -1,28 +1,33 @@ -[gd_resource type="Theme" load_steps=9 format=2] +[gd_resource type="Theme" load_steps=10 format=2] [ext_resource path="res://fonts/font_regular.tres" type="DynamicFont" id=1] [ext_resource path="res://fonts/font_mono_regular.tres" type="DynamicFont" id=2] -[sub_resource type="StyleBoxFlat" id=2] -bg_color = Color( 0.11, 0.11, 0.11, 1 ) +[sub_resource type="StyleBoxEmpty" id=10] +content_margin_left = 10.0 +content_margin_right = 10.0 + +[sub_resource type="StyleBoxFlat" id=11] +content_margin_left = 10.0 +content_margin_right = 10.0 +bg_color = Color( 0.22, 0.35, 0.5, 0.5 ) corner_radius_top_left = 8 corner_radius_top_right = 8 corner_radius_bottom_right = 8 corner_radius_bottom_left = 8 -[sub_resource type="StyleBoxFlat" id=8] -bg_color = Color( 0.109804, 0.109804, 0.109804, 1 ) -border_width_left = 3 -border_width_top = 3 -border_width_right = 3 -border_width_bottom = 3 -border_color = Color( 0.223529, 0.352941, 0.501961, 1 ) +[sub_resource type="StyleBoxFlat" id=2] +content_margin_left = 10.0 +content_margin_right = 10.0 +bg_color = Color( 0.11, 0.11, 0.11, 1 ) corner_radius_top_left = 8 corner_radius_top_right = 8 corner_radius_bottom_right = 8 corner_radius_bottom_left = 8 [sub_resource type="StyleBoxFlat" id=4] +content_margin_left = 10.0 +content_margin_right = 10.0 bg_color = Color( 0.223529, 0.352941, 0.501961, 1 ) corner_radius_top_left = 8 corner_radius_top_right = 8 @@ -34,8 +39,6 @@ corner_radius_bottom_left = 8 [sub_resource type="StyleBoxFlat" id=9] content_margin_left = 10.0 content_margin_right = 10.0 -content_margin_top = 5.0 -content_margin_bottom = 5.0 bg_color = Color( 0, 0, 0, 0 ) draw_center = false border_width_bottom = 3 @@ -44,8 +47,6 @@ border_color = Color( 0.223529, 0.352941, 0.501961, 1 ) [sub_resource type="StyleBoxFlat" id=7] content_margin_left = 10.0 content_margin_right = 10.0 -content_margin_top = 5.0 -content_margin_bottom = 5.0 bg_color = Color( 0, 0, 0, 0 ) draw_center = false border_width_bottom = 3 @@ -53,9 +54,9 @@ border_color = Color( 0.33, 0.33, 0.33, 1 ) [resource] default_font = ExtResource( 1 ) -Button/styles/disabled = null -Button/styles/focus = SubResource( 2 ) -Button/styles/hover = SubResource( 8 ) +Button/styles/disabled = SubResource( 10 ) +Button/styles/focus = SubResource( 10 ) +Button/styles/hover = SubResource( 11 ) Button/styles/normal = SubResource( 2 ) Button/styles/pressed = SubResource( 4 ) ItemList/fonts/font = ExtResource( 2 ) @@ -63,3 +64,4 @@ ItemList/styles/bg = SubResource( 5 ) LineEdit/styles/focus = SubResource( 9 ) LineEdit/styles/normal = SubResource( 7 ) LineEdit/styles/read_only = null +VBoxContainer/constants/separation = 10 -- cgit v1.2.3