From 2e5c0de21b0f35531e3d42e63c27df80cf3fad02 Mon Sep 17 00:00:00 2001 From: dam Date: Wed, 1 Dec 2021 02:26:44 +0000 Subject: Convert from native to godot --- export_presets.cfg | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 export_presets.cfg (limited to 'export_presets.cfg') diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..468f32f --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,200 @@ +[preset.0] + +name="android" +platform="Android" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../builds/test.apk" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +custom_template/use_custom_build=false +custom_template/export_format=0 +architectures/armeabi-v7a=true +architectures/arm64-v8a=false +architectures/x86=false +architectures/x86_64=false +keystore/debug="debug.keystore" +keystore/debug_user="debug.user" +keystore/debug_password="debug.password" +keystore/release="" +keystore/release_user="" +keystore/release_password="" +one_click_deploy/clear_previous_install=false +version/code=1 +version/name="1.0" +package/unique_name="com.gudinoff.$genname" +package/name="" +package/signed=true +package/classify_as_game=false +package/retain_data_on_uninstall=false +launcher_icons/main_192x192="" +launcher_icons/adaptive_foreground_432x432="" +launcher_icons/adaptive_background_432x432="" +graphics/32_bits_framebuffer=true +graphics/opengl_debug=false +xr_features/xr_mode=0 +xr_features/hand_tracking=0 +screen/immersive_mode=true +screen/support_small=true +screen/support_normal=true +screen/support_large=true +screen/support_xlarge=true +user_data_backup/allow=false +command_line/extra_args="" +apk_expansion/enable=false +apk_expansion/SALT="" +apk_expansion/public_key="" +permissions/custom_permissions=PoolStringArray( ) +permissions/access_checkin_properties=false +permissions/access_coarse_location=false +permissions/access_fine_location=false +permissions/access_location_extra_commands=false +permissions/access_mock_location=false +permissions/access_network_state=false +permissions/access_surface_flinger=false +permissions/access_wifi_state=false +permissions/account_manager=false +permissions/add_voicemail=false +permissions/authenticate_accounts=false +permissions/battery_stats=false +permissions/bind_accessibility_service=false +permissions/bind_appwidget=false +permissions/bind_device_admin=false +permissions/bind_input_method=false +permissions/bind_nfc_service=false +permissions/bind_notification_listener_service=false +permissions/bind_print_service=false +permissions/bind_remoteviews=false +permissions/bind_text_service=false +permissions/bind_vpn_service=false +permissions/bind_wallpaper=false +permissions/bluetooth=false +permissions/bluetooth_admin=false +permissions/bluetooth_privileged=false +permissions/brick=false +permissions/broadcast_package_removed=false +permissions/broadcast_sms=false +permissions/broadcast_sticky=false +permissions/broadcast_wap_push=false +permissions/call_phone=false +permissions/call_privileged=false +permissions/camera=false +permissions/capture_audio_output=false +permissions/capture_secure_video_output=false +permissions/capture_video_output=false +permissions/change_component_enabled_state=false +permissions/change_configuration=false +permissions/change_network_state=false +permissions/change_wifi_multicast_state=false +permissions/change_wifi_state=false +permissions/clear_app_cache=false +permissions/clear_app_user_data=false +permissions/control_location_updates=false +permissions/delete_cache_files=false +permissions/delete_packages=false +permissions/device_power=false +permissions/diagnostic=false +permissions/disable_keyguard=false +permissions/dump=false +permissions/expand_status_bar=false +permissions/factory_test=false +permissions/flashlight=false +permissions/force_back=false +permissions/get_accounts=false +permissions/get_package_size=false +permissions/get_tasks=false +permissions/get_top_activity_info=false +permissions/global_search=false +permissions/hardware_test=false +permissions/inject_events=false +permissions/install_location_provider=false +permissions/install_packages=false +permissions/install_shortcut=false +permissions/internal_system_window=false +permissions/internet=false +permissions/kill_background_processes=false +permissions/location_hardware=false +permissions/manage_accounts=false +permissions/manage_app_tokens=false +permissions/manage_documents=false +permissions/master_clear=false +permissions/media_content_control=false +permissions/modify_audio_settings=false +permissions/modify_phone_state=false +permissions/mount_format_filesystems=false +permissions/mount_unmount_filesystems=false +permissions/nfc=false +permissions/persistent_activity=false +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_frame_buffer=false +permissions/read_history_bookmarks=false +permissions/read_input_state=false +permissions/read_logs=false +permissions/read_phone_state=false +permissions/read_profile=false +permissions/read_sms=false +permissions/read_social_stream=false +permissions/read_sync_settings=false +permissions/read_sync_stats=false +permissions/read_user_dictionary=false +permissions/reboot=false +permissions/receive_boot_completed=false +permissions/receive_mms=false +permissions/receive_sms=false +permissions/receive_wap_push=false +permissions/record_audio=false +permissions/reorder_tasks=false +permissions/restart_packages=false +permissions/send_respond_via_message=false +permissions/send_sms=false +permissions/set_activity_watcher=false +permissions/set_alarm=false +permissions/set_always_finish=false +permissions/set_animation_scale=false +permissions/set_debug_app=false +permissions/set_orientation=false +permissions/set_pointer_speed=false +permissions/set_preferred_applications=false +permissions/set_process_limit=false +permissions/set_time=false +permissions/set_time_zone=false +permissions/set_wallpaper=false +permissions/set_wallpaper_hints=false +permissions/signal_persistent_processes=false +permissions/status_bar=false +permissions/subscribed_feeds_read=false +permissions/subscribed_feeds_write=false +permissions/system_alert_window=false +permissions/transmit_ir=false +permissions/uninstall_shortcut=false +permissions/update_device_stats=false +permissions/use_credentials=false +permissions/use_sip=false +permissions/vibrate=false +permissions/wake_lock=false +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_gservices=false +permissions/write_history_bookmarks=false +permissions/write_profile=false +permissions/write_secure_settings=false +permissions/write_settings=false +permissions/write_sms=false +permissions/write_social_stream=false +permissions/write_sync_settings=false +permissions/write_user_dictionary=false -- cgit v1.2.3 From 7d515712404db480b6ba6eb45576ecc74988acd3 Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 2 Dec 2021 22:19:02 +0000 Subject: Implement date picker prototype. --- date_picker/date_picker.tscn | 147 +++++++++++++++++++++++++++++++++++++++++++ date_picker/scroll_picker.gd | 118 ++++++++++++++++++++++++++++++++++ export_presets.cfg | 6 +- main.tscn | 66 +++++++++++++------ project.godot | 4 ++ 5 files changed, 319 insertions(+), 22 deletions(-) create mode 100644 date_picker/date_picker.tscn create mode 100644 date_picker/scroll_picker.gd (limited to 'export_presets.cfg') diff --git a/date_picker/date_picker.tscn b/date_picker/date_picker.tscn new file mode 100644 index 0000000..88f98d8 --- /dev/null +++ b/date_picker/date_picker.tscn @@ -0,0 +1,147 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://date_picker/scroll_picker.gd" type="Script" id=1] + +[node name="date_picker" type="HBoxContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="day_scroll" type="Control" parent="."] +margin_left = 5.0 +margin_right = 239.0 +margin_bottom = 1280.0 +rect_min_size = Vector2( 234, 0 ) +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="label" type="Label" parent="day_scroll"] +anchor_right = 1.0 +text = "day" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value_previous" type="Label" parent="day_scroll"] +anchor_right = 1.0 +margin_bottom = 80.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value" type="Label" parent="day_scroll"] +anchor_right = 1.0 +margin_top = 80.0 +margin_bottom = 160.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value_next" type="Label" parent="day_scroll"] +anchor_right = 1.0 +margin_top = 160.0 +margin_bottom = 240.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="month_scroll" type="Control" parent="."] +margin_left = 243.0 +margin_right = 477.0 +margin_bottom = 1280.0 +rect_min_size = Vector2( 234, 0 ) +script = ExtResource( 1 ) + +[node name="label" type="Label" parent="month_scroll"] +anchor_right = 1.0 +text = "month" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value_previous" type="Label" parent="month_scroll"] +anchor_right = 1.0 +margin_bottom = 80.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value" type="Label" parent="month_scroll"] +anchor_right = 1.0 +margin_top = 80.0 +margin_bottom = 160.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value_next" type="Label" parent="month_scroll"] +anchor_right = 1.0 +margin_top = 160.0 +margin_bottom = 240.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="year_scroll" type="Control" parent="."] +margin_left = 481.0 +margin_right = 715.0 +margin_bottom = 1280.0 +rect_min_size = Vector2( 234, 0 ) +script = ExtResource( 1 ) + +[node name="label" type="Label" parent="year_scroll"] +anchor_right = 1.0 +text = "year" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value_previous" type="Label" parent="year_scroll"] +anchor_right = 1.0 +margin_bottom = 80.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value" type="Label" parent="year_scroll"] +anchor_right = 1.0 +margin_top = 80.0 +margin_bottom = 160.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="value_next" type="Label" parent="year_scroll"] +anchor_right = 1.0 +margin_top = 160.0 +margin_bottom = 240.0 +mouse_filter = 1 +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/date_picker/scroll_picker.gd b/date_picker/scroll_picker.gd new file mode 100644 index 0000000..ba70084 --- /dev/null +++ b/date_picker/scroll_picker.gd @@ -0,0 +1,118 @@ +extends Control + +const MAX_POINTERS = 10 + +var pointer: Dictionary +var value: float = 0.0 +var anchor: float = 0.0 +var pointer_id: int = -1 +var start_pos: float = 0.0 +var pos: float = 0.0 + + +func _ready(): + pointer = { + index = -1, + initial_position = Vector2.ZERO, + current_position = Vector2.ZERO, + relative = Vector2.ZERO, + velocity = Vector2.ZERO, + is_active = false, + timestamp = 0 + } + + + +func _process(delta: float): +# $label.text = "%s" % pointer.index + pointer.velocity *= clamp((1.0 - 5.5 * delta), 0.0, 1.0) # pow(1.0-0.995, delta) + if pointer.is_active: + value = anchor + (pointer.current_position.y - pointer.initial_position.y) + elif is_zero_approx(pointer.velocity.y) == false: + value += pointer.velocity.y * delta + if abs(pointer.velocity.y) < 50.0: + var max_value := 10 + var scroll_unit_height := 80 + var normalized_value := -value / scroll_unit_height + var normalized_int_value := round(normalized_value) as int + var logic_value := fposmod(normalized_int_value, max_value) + var fix := ((normalized_int_value as float) - normalized_value) * scroll_unit_height + value -= fix * 5.0 * delta + +# pointer.timestamp = OS.get_ticks_msec() +# ($test as TextureRect).rect_global_position.y = value +# $debug.text = "value: %s\nvelocity: %s\n%s" % [value, pointer.velocity, pointer.relative] + var current_pos = value + var turn_over := 800 + if current_pos >= turn_over || current_pos < 0.0: + value = fposmod(current_pos, turn_over) +# elif current_pos < 0: +# value = 800 - current_pos + + + var max_value := 10 + var scroll_unit_height := 40 + var normalized_value := -value / scroll_unit_height + var normalized_int_value := round(normalized_value) as int + var logic_value := fposmod(normalized_int_value, max_value) + var logic_next_value := fposmod(normalized_int_value + 1, max_value) + var logic_previous_value := fposmod(normalized_int_value - 1, max_value) + + var value_base_position := 140.0 # 180.0 + var value_next_base_position := 180.0 # 260.0 + var value_previous_base_position := 100.0 + + $value.text = "%d" % logic_value + $value_next.text = "%d" % logic_next_value + $value_previous.text = "%d" % logic_previous_value +# $debug.text = "%s" % normalized_value + + ($value as Label).rect_position.y = value_base_position - (normalized_value - normalized_int_value) * scroll_unit_height + ($value_previous as Label).rect_position.y = value_previous_base_position - (normalized_value - normalized_int_value) * scroll_unit_height + ($value_next as Label).rect_position.y = value_next_base_position - (normalized_value - normalized_int_value) * scroll_unit_height + +# ($value as Label).modulate.a = (scroll_unit_height - (normalized_value - normalized_int_value) * scroll_unit_height) / (scroll_unit_height as float) +# $debug.text = "%s ..." % [normalized_int_value - normalized_value] + ($value_next as Label).modulate.a = ((normalized_value - normalized_int_value) + 0.5) + ($value_previous as Label).modulate.a = ((normalized_int_value - normalized_value) + 0.5) +# ($value_previous as Label).modulate.a = ((normalized_value + normalized_int_value) * scroll_unit_height) / (scroll_unit_height as float) +# +#func _input(event: InputEvent): +# $log.text += "> input: %s\n" % event.to_string() +# if event is InputEventScreenTouch && event.pressed == false: +# pointer.index = -1 + +func _gui_input(event: InputEvent): +# get_tree().set_input_as_handled() +# if event is InputEventScreenTouch && event.pressed == false: +# $label.text = "AUTCH" +# $log.text += "> event: %s\n" % event.to_string() + + if event is InputEventScreenTouch: +# if (event is InputEventScreenTouch && pointer.is_active && pointer.index == event.index +# || event is InputEventScreenTouch && pointer.is_active == false): + var touch := event as InputEventScreenTouch + pointer.is_active = event.pressed + pointer.current_position = touch.position + var time := OS.get_ticks_msec() + if pointer.is_active: + pointer.index = touch.index + pointer.initial_position = touch.position + anchor = value + else: + pointer.index = -1 +# elif abs(pointer.timestamp - time) > 50.0: +# pointer.velocity = Vector2.ZERO +# if pointer.is_active == false: +# $output.text += "%10d: touch %d\n" % [abs(pointer.timestamp - time), touch.index] + + if event is InputEventScreenDrag: # && pointer.index == event.index: + var drag := event as InputEventScreenDrag + pointer.current_position = drag.position + pointer.velocity = drag.speed +# $label.text = "%s"%drag.speed + pointer.relative = drag.relative + pointer.timestamp = OS.get_ticks_msec() +# $output.text += "%10d: drag %d\n" % [pointer.timestamp, drag.index] + + diff --git a/export_presets.cfg b/export_presets.cfg index 468f32f..5c563c9 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../builds/test.apk" +export_path="../builds/test_pico_debug.apk" script_export_mode=1 script_encryption_key="" @@ -27,7 +27,7 @@ keystore/debug_password="debug.password" keystore/release="" keystore/release_user="" keystore/release_password="" -one_click_deploy/clear_previous_install=false +one_click_deploy/clear_previous_install=true version/code=1 version/name="1.0" package/unique_name="com.gudinoff.$genname" @@ -42,7 +42,7 @@ graphics/32_bits_framebuffer=true graphics/opengl_debug=false xr_features/xr_mode=0 xr_features/hand_tracking=0 -screen/immersive_mode=true +screen/immersive_mode=false screen/support_small=true screen/support_normal=true screen/support_large=true diff --git a/main.tscn b/main.tscn index 16e73df..c3a8f2b 100644 --- a/main.tscn +++ b/main.tscn @@ -1,107 +1,119 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 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] [node name="main" type="Node"] -[node name="ScrollContainer" type="ScrollContainer" parent="."] +[node name="TabContainer" type="TabContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ScrollContainer" type="ScrollContainer" parent="TabContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 scroll_horizontal_enabled = false __meta__ = { "_edit_use_anchors_": false } -[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/ScrollContainer"] margin_right = 720.0 margin_bottom = 548.0 rect_min_size = Vector2( 720, 0 ) rect_clip_content = true script = ExtResource( 1 ) -[node name="process_number" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="process_number" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_right = 720.0 margin_bottom = 24.0 placeholder_text = "Nº Processo" caret_blink = true -[node name="surgery_number" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="surgery_number" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 28.0 margin_right = 720.0 margin_bottom = 52.0 placeholder_text = "Nº Cirurgia" caret_blink = true -[node name="place" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="place" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 56.0 margin_right = 720.0 margin_bottom = 80.0 placeholder_text = "Local" caret_blink = true -[node name="anesthesia" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="anesthesia" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 84.0 margin_right = 720.0 margin_bottom = 108.0 placeholder_text = "Anesthesics" caret_blink = true -[node name="first_aider" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="first_aider" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 112.0 margin_right = 720.0 margin_bottom = 136.0 placeholder_text = "1º Ajudante" caret_blink = true -[node name="type" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="type" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 140.0 margin_right = 720.0 margin_bottom = 164.0 placeholder_text = "Tipo" caret_blink = true -[node name="sub_type" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="sub_type" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 168.0 margin_right = 720.0 margin_bottom = 192.0 placeholder_text = "Subtipo" caret_blink = true -[node name="sub_sub_type" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="sub_sub_type" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 196.0 margin_right = 720.0 margin_bottom = 220.0 placeholder_text = "Sub-Subtipo" caret_blink = true -[node name="pathology" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="pathology" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 224.0 margin_right = 720.0 margin_bottom = 248.0 placeholder_text = "Patologia" caret_blink = true -[node name="intervention" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="intervention" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 252.0 margin_right = 720.0 margin_bottom = 276.0 placeholder_text = "Intervenção" caret_blink = true -[node name="urgency" type="CheckBox" parent="ScrollContainer/VBoxContainer"] +[node name="urgency" type="CheckBox" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 280.0 margin_right = 720.0 margin_bottom = 304.0 text = "Urgência" -[node name="notes" type="LineEdit" parent="ScrollContainer/VBoxContainer"] +[node name="notes" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 308.0 margin_right = 720.0 margin_bottom = 332.0 placeholder_text = "Notas" caret_blink = true -[node name="output" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"] +[node name="output" type="RichTextLabel" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 336.0 margin_right = 720.0 margin_bottom = 386.0 @@ -110,7 +122,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="timer" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"] +[node name="timer" type="RichTextLabel" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 390.0 margin_right = 720.0 margin_bottom = 440.0 @@ -119,7 +131,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="button" type="Button" parent="ScrollContainer/VBoxContainer"] +[node name="button" type="Button" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 444.0 margin_right = 720.0 margin_bottom = 494.0 @@ -131,7 +143,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="log" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"] +[node name="log" type="RichTextLabel" parent="TabContainer/ScrollContainer/VBoxContainer"] margin_top = 498.0 margin_right = 720.0 margin_bottom = 548.0 @@ -139,3 +151,19 @@ rect_min_size = Vector2( 0, 50 ) __meta__ = { "_edit_use_anchors_": false } + +[node name="ScrollContainer2" type="ScrollContainer" parent="TabContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/ScrollContainer2"] +margin_right = 710.0 + +[node name="date_picker" parent="TabContainer/ScrollContainer2/VBoxContainer" instance=ExtResource( 2 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 710.0 diff --git a/project.godot b/project.godot index 8bc4dca..fa00ba4 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,10 @@ window/size/height=1280 window/energy_saving/keep_screen_on=false window/handheld/orientation="portrait" +[input_devices] + +pointing/emulate_touch_from_mouse=true + [physics] common/enable_pause_aware_picking=true -- cgit v1.2.3 From 229bfb4b0ffaf7940317ffeba96f6537da9cc1df Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 6 Dec 2021 11:28:48 +0000 Subject: Tweak project settings. --- export_presets.cfg | 2 +- project.godot | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'export_presets.cfg') diff --git a/export_presets.cfg b/export_presets.cfg index 5c563c9..da53431 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../builds/test_pico_debug.apk" +export_path="build/debug.apk" script_export_mode=1 script_encryption_key="" diff --git a/project.godot b/project.godot index adc16f7..4c68d91 100644 --- a/project.godot +++ b/project.godot @@ -38,6 +38,8 @@ config/icon="res://icon.png" window/size/width=720 window/size/height=1280 +window/size/test_width=576 +window/size/test_height=1024 window/energy_saving/keep_screen_on=false window/handheld/orientation="portrait" -- 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 'export_presets.cfg') 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 3f29bb41d713240eb7ba831f68981674d4db9eb9 Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 16 Dec 2021 17:04:09 +0000 Subject: Fix issues when creating/editing entries. Fix android icon. --- export_presets.cfg | 6 ++--- icons/icon.png | Bin 19327 -> 42947 bytes icons/icon.xcf | Bin 0 -> 112237 bytes icons/icon_background.png | Bin 0 -> 36824 bytes icons/icon_background.png.import | 35 ++++++++++++++++++++++++++ icons/icon_foreground.png | Bin 0 -> 6327 bytes icons/icon_foreground.png.import | 35 ++++++++++++++++++++++++++ logic/database.gd | 52 ++++++++++++++++++--------------------- logic/stage.gd | 45 +++++++++++++++++++++------------ project.godot | 2 +- 10 files changed, 127 insertions(+), 48 deletions(-) create mode 100644 icons/icon.xcf create mode 100644 icons/icon_background.png create mode 100644 icons/icon_background.png.import create mode 100644 icons/icon_foreground.png create mode 100644 icons/icon_foreground.png.import (limited to 'export_presets.cfg') diff --git a/export_presets.cfg b/export_presets.cfg index ae6c4cf..06377bd 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -35,9 +35,9 @@ package/name="" package/signed=true package/classify_as_game=false package/retain_data_on_uninstall=false -launcher_icons/main_192x192="" -launcher_icons/adaptive_foreground_432x432="" -launcher_icons/adaptive_background_432x432="" +launcher_icons/main_192x192="res://icons/icon.png" +launcher_icons/adaptive_foreground_432x432="res://icons/icon_foreground.png" +launcher_icons/adaptive_background_432x432="res://icons/icon_background.png" graphics/32_bits_framebuffer=true graphics/opengl_debug=false xr_features/xr_mode=0 diff --git a/icons/icon.png b/icons/icon.png index 4b35a32..63760ec 100755 Binary files a/icons/icon.png and b/icons/icon.png differ diff --git a/icons/icon.xcf b/icons/icon.xcf new file mode 100644 index 0000000..abfbec1 Binary files /dev/null and b/icons/icon.xcf differ diff --git a/icons/icon_background.png b/icons/icon_background.png new file mode 100644 index 0000000..6ee62e1 Binary files /dev/null and b/icons/icon_background.png differ diff --git a/icons/icon_background.png.import b/icons/icon_background.png.import new file mode 100644 index 0000000..7b6caab --- /dev/null +++ b/icons/icon_background.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_background.png-7c479113bc74649f6884d5867344a330.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icons/icon_background.png" +dest_files=[ "res://.import/icon_background.png-7c479113bc74649f6884d5867344a330.stex" ] + +[params] + +compress/mode=0 +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=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +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/icon_foreground.png b/icons/icon_foreground.png new file mode 100644 index 0000000..919f2ff Binary files /dev/null and b/icons/icon_foreground.png differ diff --git a/icons/icon_foreground.png.import b/icons/icon_foreground.png.import new file mode 100644 index 0000000..8427899 --- /dev/null +++ b/icons/icon_foreground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon_foreground.png-386f0ed4375c2b690a85127a54f3c7b2.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icons/icon_foreground.png" +dest_files=[ "res://.import/icon_foreground.png-386f0ed4375c2b690a85127a54f3c7b2.stex" ] + +[params] + +compress/mode=0 +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=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +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/logic/database.gd b/logic/database.gd index 1abb984..db449ae 100644 --- a/logic/database.gd +++ b/logic/database.gd @@ -52,38 +52,34 @@ func _ready(): add_button.connect("pressed", self, "add_action") stage.connect("save", self, "save") stage.connect("discard", self, "discard") - refresh_list() + for it in db: + self.add_item(get_entry_view(it)) 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) + if selected_entries_idx.size() == 0: + return + assert(selected_entries_idx.size() == 1, "Multiple selected items not supported.") + var selected_idx = selected_entries_idx[0] + db.remove(selected_idx) + self.remove_item(selected_idx) + store_database() func edit_action(): var selected_entries_idx := self.get_selected_items() - if selected_entries_idx.size() != 1: + if selected_entries_idx.size() == 0: return + assert(selected_entries_idx.size() == 1, "Multiple selected items not supported.") staged_idx = selected_entries_idx[0] self.visible = false stage.visible = true @@ -95,20 +91,17 @@ func add_action(): 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): + database_entry = instance_entry(database_entry) # @DAM Maybe we could not be creating endless dictionaries? 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)) - + store_database() staged_idx = -1 self.visible = true @@ -118,9 +111,9 @@ func discard(): self.visible = true -func load_database(): +func load_database(file_path: String = DATABASE_FILE_PATH): var file := File.new() - file.open(DATABASE_FILE_PATH, File.READ_WRITE) + file.open(file_path, File.READ_WRITE) var headers: PoolStringArray var is_first_line := true # while database_file.eof_reached() == false: @@ -177,9 +170,9 @@ func load_database(): ] -func store_database(): +func store_database(file_path: String = DATABASE_FILE_PATH): var file := File.new() - file.open(DATABASE_FILE_PATH, File.WRITE) + file.open(file_path, File.WRITE) var header := PoolStringArray(ENTRY_PROTOTYPE.keys()) file.store_csv_line(header) var entry := PoolStringArray() @@ -188,14 +181,17 @@ func store_database(): file.close() -func instance_entry(params: Dictionary = {}) -> Dictionary: +static 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.date_year = params.get("date_year", today.year) + new_entry.date_month = params.get("date_month", today.month) + new_entry.date_day = params.get("date_day", today.day) + new_entry.date = params.get("date", get_entry_date(new_entry)) new_entry.anesthetic = params.get("anesthetic", "") new_entry.first_assistant = params.get("first_assistant", "") @@ -210,11 +206,11 @@ func instance_entry(params: Dictionary = {}) -> Dictionary: return new_entry -func get_entry_date(entry: Dictionary) -> String: +static 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): +static 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) diff --git a/logic/stage.gd b/logic/stage.gd index a9f4fee..19018fa 100644 --- a/logic/stage.gd +++ b/logic/stage.gd @@ -54,22 +54,35 @@ func set_stage(entry: Dictionary): 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 + +# var entry: Dictionary = Database.instance_entry({ +# "process_id": process_id.text, +# "surgery_id": surgery_id.text, +# "date_year": date.get_year(), +# "date_month": date.get_month(), +# "date_day": date.get_day(), +# "place": place.text, +# "anesthetic": anesthetic.text, +# "first_assistant": first_assistant.text, +# "type": type.text, +# }) + var entry: Dictionary = { + "process_id": process_id.text, + "surgery_id": surgery_id.text, + "date_year": date.get_year(), + "date_month": date.get_month(), + "date_day": date.get_day(), + "place": place.text, + "anesthetic": anesthetic.text, + "first_assistant": first_assistant.text, + "type": type.text, + "sub_type": sub_type.text, + "sub_sub_type": sub_sub_type.text, + "pathology": pathology.text, + "intervention": intervention.text, + "is_urgency": is_urgency.pressed, + "notes": notes.text, + } return entry diff --git a/project.godot b/project.godot index 41969be..584ffa8 100644 --- a/project.godot +++ b/project.godot @@ -43,7 +43,7 @@ run/main_scene="res://main.tscn" 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 ) +boot_splash/bg_color=Color( 0, 0, 0, 0 ) config/icon="res://icons/icon.png" config/quit_on_go_back=false -- cgit v1.2.3 From c0a3ea7ce588c3def40aae8253f5f88a7cea15ba Mon Sep 17 00:00:00 2001 From: dam Date: Wed, 16 Mar 2022 22:38:31 +0000 Subject: Updated export config and touch_vertical_container nodes names. --- export_presets.cfg | 7 ++++++- logic/database.gd | 2 +- touch_vertical_container/touch_vertical_container.tscn | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'export_presets.cfg') diff --git a/export_presets.cfg b/export_presets.cfg index 06377bd..b515f71 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="build/debug.apk" +export_path="build/surgery_log.apk" script_export_mode=1 script_encryption_key="" @@ -30,11 +30,14 @@ keystore/release_password="" one_click_deploy/clear_previous_install=false version/code=1 version/name="1.0" +version/min_sdk=19 +version/target_sdk=30 package/unique_name="com.gudinoff.$genname" package/name="" package/signed=true package/classify_as_game=false package/retain_data_on_uninstall=false +package/exclude_from_recents=false launcher_icons/main_192x192="res://icons/icon.png" launcher_icons/adaptive_foreground_432x432="res://icons/icon_foreground.png" launcher_icons/adaptive_background_432x432="res://icons/icon_background.png" @@ -42,6 +45,8 @@ graphics/32_bits_framebuffer=true graphics/opengl_debug=false xr_features/xr_mode=0 xr_features/hand_tracking=0 +xr_features/hand_tracking_frequency=0 +xr_features/passthrough=0 screen/immersive_mode=false screen/support_small=true screen/support_normal=true diff --git a/logic/database.gd b/logic/database.gd index 91328c5..c4482f4 100644 --- a/logic/database.gd +++ b/logic/database.gd @@ -43,7 +43,7 @@ func _notification(what: int): # active and above, and send the signal there. if visible == false || has_focus() == false: return - + if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST: if selected_idx >= 0: clear_selection() diff --git a/touch_vertical_container/touch_vertical_container.tscn b/touch_vertical_container/touch_vertical_container.tscn index 5a797d3..bdf9734 100644 --- a/touch_vertical_container/touch_vertical_container.tscn +++ b/touch_vertical_container/touch_vertical_container.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://touch_vertical_container/touch_vertical_container.gd" type="Script" id=1] -[node name="scroll_container" type="ScrollContainer"] +[node name="touch_vertical_container" type="ScrollContainer"] anchor_right = 1.0 anchor_bottom = 1.0 mouse_filter = 2 -- cgit v1.2.3 From 08b6f5a76c530b83acef39ec14f6d3b1e508964c Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 14 Apr 2022 09:09:17 +0000 Subject: Added windows and linux export presets. --- export_presets.cfg | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'export_presets.cfg') diff --git a/export_presets.cfg b/export_presets.cfg index b515f71..62e8bcb 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -203,3 +203,69 @@ permissions/write_sms=false permissions/write_social_stream=false permissions/write_sync_settings=false permissions/write_user_dictionary=false + +[preset.1] + +name="linux" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/surgery_log.x64" +script_export_mode=1 +script_encryption_key="" + +[preset.1.options] + +custom_template/debug="" +custom_template/release="" +binary_format/64_bits=true +binary_format/embed_pck=true +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true + +[preset.2] + +name="windows" +platform="Windows Desktop" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/surgery_log.exe" +script_export_mode=1 +script_encryption_key="" + +[preset.2.options] + +custom_template/debug="" +custom_template/release="" +binary_format/64_bits=true +binary_format/embed_pck=true +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +codesign/enable=false +codesign/identity="" +codesign/password="" +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PoolStringArray( ) +application/icon="res://icons/icon.png" +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" -- cgit v1.2.3