Fixes the export/import of GPs in the prof tool. Re-add the model_db file to create new language pack.

This commit is contained in:
Dylan Sarrazyn
2024-12-11 14:16:10 +01:00
parent fbd0c4cb4c
commit 498c6603db
4 changed files with 26 additions and 19 deletions
BIN
View File
Binary file not shown.
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -158,7 +158,7 @@ func _on_language_select_button_item_selected(index: int) -> void:
func _on_line_edit_text_submitted(new_text: String) -> void:
DirAccess.make_dir_recursive_absolute(base_path.path_join(new_text))
var file: = FileAccess.open("res://language_resources/model_database.db", FileAccess.READ)
var file: = FileAccess.open("res://model_database.db", FileAccess.READ)
var dest: = FileAccess.open(base_path.path_join(new_text).path_join("language.db"), FileAccess.WRITE)
dest.store_buffer(file.get_buffer(file.get_length()))
file.close()
@@ -247,13 +247,13 @@ func _language_data_selected(file_path: String) -> void:
func _create_GP_csv() -> void:
var gp_list_file: = FileAccess.open(base_path.path_join(Database.language).path_join("gp_list.csv"), FileAccess.WRITE)
gp_list_file.store_csv_line(["Grapheme", "Phoneme", "Type"])
gp_list_file.store_csv_line(["Grapheme", "Phoneme", "Type", "Exception"])
var query: = "Select * FROM GPs ORDER BY GPs.Grapheme"
Database.db.query(query)
var result: = Database.db.query_result
var types_text: = ["Silent", "Vowel", "Consonant"]
for e in result:
gp_list_file.store_csv_line([e.Grapheme, e.Phoneme, types_text[e.Type]])
gp_list_file.store_csv_line([e.Grapheme, e.Phoneme, types_text[e.Type], e.Exception])
func _create_words_csv() -> void:
+11 -4
View File
@@ -11,6 +11,8 @@ const ConfirmPopup: = preload("res://sources/ui/popup.gd")
@onready var lesson_unlocks: LessonUnlocks = $LessonUnlocks
@onready var delete_popup: ConfirmPopup = %DeletePopup
var last_device_id: = -1
func _ready() -> void:
_refresh_devices_tabs()
OpeningCurtain.open()
@@ -33,6 +35,8 @@ func _refresh_devices_tabs() -> void:
device_tab.student_pressed.connect(_on_student_pressed)
last_device_id = device
func _on_back_button_pressed() -> void:
await OpeningCurtain.close()
@@ -70,7 +74,6 @@ func _on_add_student_button_pressed() -> void:
var current_tab: = devices_tab_container.get_current_tab_control() as DeviceTab
if not current_tab:
return
# TODO Show the popup
# TODO Hides/Disable the button when not online
var res: = await ServerManager.add_student(current_tab.device_id)
@@ -81,6 +84,10 @@ func _on_add_student_button_pressed() -> void:
func _on_add_device_button_pressed() -> void:
pass
#if UserDataManager.add_device():
# _refresh_devices_tabs()
# TODO Show the popup
# TODO Hides/Disable the button when not online
var res: = await ServerManager.add_student(last_device_id + 1)
if res.code == 200:
UserDataManager.update_configuration(res.body)
_refresh_devices_tabs()
devices_tab_container.current_tab = last_device_id