-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed90618
commit 32c19b2
Showing
8 changed files
with
181 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[gd_scene format=3 uid="uid://05awvkbxe17w"] | ||
|
||
[node name="Background" type="Panel"] | ||
custom_minimum_size = Vector2(250, 250) | ||
offset_left = 37.0 | ||
offset_top = 71.0 | ||
offset_right = 562.0 | ||
offset_bottom = 571.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
extends GridContainer | ||
|
||
const TABLE_SIZE := Vector2(1152, 500) | ||
|
||
var table = preload("res://scenes/table/table.tscn") | ||
var background = preload("res://scenes/table/background.tscn") | ||
@onready var lock_button = get_node("../../Lock") | ||
@onready var new_table_button = get_node("../../NewTable") | ||
|
||
func _ready(): | ||
lock_button.pressed.connect(self.lock) | ||
new_table_button.pressed.connect(self._add_new_table) | ||
reload() | ||
|
||
func get_data() -> Array[Dictionary]: | ||
var ret: Array[Dictionary] | ||
for child in get_children(): | ||
ret.append(child.get_child(0).data._to_dictionary()) | ||
return ret | ||
|
||
func from_data(data) -> void: | ||
for child in get_children(): | ||
child.queue_free() | ||
for d in data: | ||
var t = table.instantiate() | ||
t.data = DataFrame._from_dictionary(d) | ||
t.editable = not lock_button.button_pressed | ||
t.render() | ||
var b = background.instantiate() | ||
b.custom_minimum_size = TABLE_SIZE | ||
b.add_child(t) | ||
add_child(b) | ||
|
||
func lock(): | ||
for child in get_children(): | ||
child.get_child(0).editable = not lock_button.button_pressed | ||
child.get_child(0).render() | ||
|
||
func reload(): | ||
lock_button.button_pressed = false | ||
|
||
for child in get_children(): | ||
child.queue_free() | ||
|
||
func _add_new_table(): | ||
var columns = [TranslationServer.translate(&"NEW_GRAMMAR_TABLE") as String] | ||
var data = [ | ||
[""] | ||
] | ||
var t = table.instantiate() | ||
t.data = DataFrame.New(data, columns) | ||
t.editable = not lock_button.button_pressed | ||
t.render() | ||
var b = background.instantiate() | ||
b.custom_minimum_size = TABLE_SIZE | ||
b.add_child(t) | ||
add_child(b) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.