Clean warnings
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#TODO CLEAN WARNINGS
|
||||
extends Control
|
||||
|
||||
var element_scene: PackedScene = preload("res://sources/language_tool/gp_list_element.tscn")
|
||||
@@ -87,15 +86,15 @@ func _on_grapheme_gui_input(event: InputEvent) -> void:
|
||||
|
||||
|
||||
func _reorder_by(property_name: String) -> void:
|
||||
var child: = elements_container.get_children()
|
||||
var child: Array[Node] = elements_container.get_children()
|
||||
child.sort_custom(sorting_function.bind(property_name))
|
||||
for element in elements_container.get_children():
|
||||
for element: Node in elements_container.get_children():
|
||||
elements_container.remove_child(element)
|
||||
for element in child:
|
||||
for element: Node in child:
|
||||
elements_container.add_child(element)
|
||||
|
||||
|
||||
func sorting_function(a_node, b_node, property_name) -> bool:
|
||||
func sorting_function(a_node: Node, b_node: Node, property_name: String) -> bool:
|
||||
return a_node.get(property_name) < b_node.get(property_name)
|
||||
|
||||
|
||||
@@ -132,13 +131,13 @@ func _on_list_title_import_path_selected(path: String, match_to_file: bool) -> v
|
||||
if line.size() < 4 or line[0] != "Grapheme" or line[1] != "Phoneme" or line[2] != "Type" or line[3] != "Exception":
|
||||
error_label.text = "Column names should be Grapheme, Phoneme, Type, Exception"
|
||||
return
|
||||
var types_text: = ["Silent", "Vowel", "Consonant"]
|
||||
var all_data: = {}
|
||||
var types_text: Array[String] = ["Silent", "Vowel", "Consonant"]
|
||||
var all_data: Dictionary = {}
|
||||
while not file.eof_reached():
|
||||
line = file.get_csv_line()
|
||||
if line.size() < 4:
|
||||
continue
|
||||
var type: = types_text.find(line[2])
|
||||
var type: int = types_text.find(line[2])
|
||||
if type < 0:
|
||||
error_label.text = "Type should be Silent, Vowel or Consonant"
|
||||
Database.db.query_with_bindings("SELECT * FROM GPs WHERE Grapheme = ?
|
||||
@@ -154,9 +153,9 @@ func _on_list_title_import_path_selected(path: String, match_to_file: bool) -> v
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
if match_to_file:
|
||||
var query: = "Select * FROM GPs ORDER BY GPs.Grapheme"
|
||||
var query: String = "Select * FROM GPs ORDER BY GPs.Grapheme"
|
||||
Database.db.query(query)
|
||||
var result: = Database.db.query_result
|
||||
var result: Array[Dictionary] = Database.db.query_result
|
||||
for element: Dictionary in result:
|
||||
if not [element.Grapheme, element.Phoneme, element.Type] in all_data:
|
||||
Database.db.delete_rows("GPs", "ID=%s" % element.ID)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# TODO CLEAN WARNINGS
|
||||
extends MarginContainer
|
||||
class_name LessonContainer
|
||||
|
||||
@@ -38,7 +37,7 @@ func _on_gp_dropped(before: bool, data: Dictionary, gp_label: Control) -> void:
|
||||
gp_container.add_child(new_gp_label)
|
||||
var children: Array[Node] = gp_container.get_children()
|
||||
for index: int in children.size():
|
||||
var child = children[index]
|
||||
var child: Node = children[index]
|
||||
if child == gp_label:
|
||||
if before:
|
||||
gp_container.move_child(new_gp_label, index)
|
||||
@@ -47,13 +46,15 @@ func _on_gp_dropped(before: bool, data: Dictionary, gp_label: Control) -> void:
|
||||
|
||||
|
||||
func _can_drop_in_gp_container(_at_position: Vector2, data: Variant) -> bool:
|
||||
@warning_ignore("unsafe_method_access")
|
||||
return data.has("gp_id")
|
||||
|
||||
|
||||
func _drop_data_in_gp_container(_at_position: Vector2, data: Variant) -> void:
|
||||
@warning_ignore("unsafe_method_access")
|
||||
if not data.has("gp_id"):
|
||||
return
|
||||
var new_gp_label: = gp_label_scene.instantiate()
|
||||
var new_gp_label: LessonGPLabel = gp_label_scene.instantiate()
|
||||
new_gp_label.grapheme = data.grapheme
|
||||
new_gp_label.phoneme = data.phoneme
|
||||
new_gp_label.gp_id = data.gp_id
|
||||
@@ -67,19 +68,22 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _get_drag_data(_at_position: Vector2) -> Variant:
|
||||
set_drag_preview(self.duplicate())
|
||||
set_drag_preview(self.duplicate() as Control)
|
||||
return { number = number }
|
||||
|
||||
|
||||
func _can_drop_data(at_position: Vector2, data: Variant) -> bool:
|
||||
@warning_ignore("unsafe_method_access")
|
||||
return (data.has("number") and number != data.number) or _can_drop_in_gp_container(at_position, data)
|
||||
|
||||
|
||||
func _drop_data(at_position: Vector2, data: Variant) -> void:
|
||||
@warning_ignore("unsafe_method_access")
|
||||
if not (data.has("number") or data.has("gp_id")):
|
||||
return
|
||||
@warning_ignore("unsafe_method_access")
|
||||
if data.has("number"):
|
||||
var before: = at_position.y < size.y
|
||||
var before: bool = at_position.y < size.y
|
||||
lesson_dropped.emit(before, number, data.number)
|
||||
else:
|
||||
_drop_data_in_gp_container(at_position, data)
|
||||
@@ -87,6 +91,6 @@ func _drop_data(at_position: Vector2, data: Variant) -> void:
|
||||
|
||||
func get_gp_ids() -> Array[int]:
|
||||
var res: Array[int] = []
|
||||
for gp in gp_container.get_children():
|
||||
for gp: LessonGPLabel in gp_container.get_children():
|
||||
res.append(gp.gp_id)
|
||||
return res
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#TODO CLEAN WARNINGS
|
||||
extends Control
|
||||
|
||||
@onready var lessons_container: VBoxContainer = $%LessonsContainer
|
||||
@@ -51,10 +50,12 @@ func _on_plus_button_pressed() -> void:
|
||||
|
||||
|
||||
func _can_drop_in_gp_container(_at_position: Vector2, data: Variant) -> bool:
|
||||
@warning_ignore("unsafe_method_access")
|
||||
return data.has("gp_id")
|
||||
|
||||
|
||||
func _drop_data_in_gp_container(_at_position: Vector2, data: Variant) -> void:
|
||||
@warning_ignore("unsafe_method_access")
|
||||
if not data.has("gp_id"):
|
||||
return
|
||||
var new_gp_label: LessonGPLabel = gp_label_scene.instantiate()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#TODO CLEAN WARNINGS
|
||||
extends "res://sources/language_tool/word_list.gd"
|
||||
|
||||
var not_found_list: String = ""
|
||||
@@ -8,6 +7,7 @@ var not_found_list: String = ""
|
||||
|
||||
func create_sub_elements_list() -> void:
|
||||
super()
|
||||
@warning_ignore("unsafe_property_access")
|
||||
new_gp.sub_elements_list = sub_elements_list.duplicate()
|
||||
sub_elements_list.clear()
|
||||
Database.db.query("Select Words.ID as ID, Words.Word as Word, group_concat(GPs.Phoneme, '') as Phonemes
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#TODO CLEAN WARNINGS
|
||||
extends Control
|
||||
|
||||
@export var gradient: Gradient
|
||||
|
||||
@@ -187,7 +187,7 @@ func _reorder_by(property_name: String) -> void:
|
||||
elements_container.add_child(child)
|
||||
|
||||
|
||||
func sorting_function(a_node, b_node, property_name) -> bool:
|
||||
func sorting_function(a_node: Node, b_node: Node, property_name: String) -> bool:
|
||||
return a_node.get(property_name) < b_node.get(property_name)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user