diff --git a/src/modules/building/energy_calculator/energy_calculator.gd b/src/modules/building/energy_calculator/energy_calculator.gd index 36f75fb..f4773b6 100644 --- a/src/modules/building/energy_calculator/energy_calculator.gd +++ b/src/modules/building/energy_calculator/energy_calculator.gd @@ -72,8 +72,6 @@ func load_data(): var save_data_file = FileAccess.open("user://energy_table.save", FileAccess.READ) var file_content = save_data_file.get_as_text() - print(file_content) - var json = JSON.new() var parse_result = json.parse(file_content) diff --git a/src/modules/building/energy_calculator/energy_calculator.tscn b/src/modules/building/energy_calculator/energy_calculator.tscn index da0556c..e545d6f 100644 --- a/src/modules/building/energy_calculator/energy_calculator.tscn +++ b/src/modules/building/energy_calculator/energy_calculator.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://l06mevybbnrs"] +[gd_scene load_steps=3 format=3 uid="uid://l06mevybbnrs"] [ext_resource type="Script" path="res://src/modules/building/energy_calculator/energy_calculator.gd" id="1_0vw5l"] +[ext_resource type="StyleBox" uid="uid://cao1u20a4ql0s" path="res://src/styles/primary_button.tres" id="2_gup2y"] [node name="EnergyCalculator" type="MarginContainer"] anchors_preset = 15 @@ -38,6 +39,7 @@ layout_mode = 2 [node name="AddSectionButton" type="Button" parent="PanelContainer/MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer"] layout_mode = 2 +theme_override_styles/normal = ExtResource("2_gup2y") text = "Добавить секцию" [connection signal="pressed" from="PanelContainer/MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer/AddSectionButton" to="." method="_on_add_section_button_pressed"] diff --git a/src/modules/building/energy_calculator/energy_table.gd b/src/modules/building/energy_calculator/energy_table.gd index 64b0646..9c75979 100644 --- a/src/modules/building/energy_calculator/energy_table.gd +++ b/src/modules/building/energy_calculator/energy_table.gd @@ -59,7 +59,7 @@ func add_row(data_row: Dictionary): func _enter_tree(): table_body = $PanelContainer/MarginContainer/VBoxContainer/TableBody/VBoxContainer - table_title_line_edit = $PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/TableTitleLineEdit + table_title_line_edit = $PanelContainer/MarginContainer/VBoxContainer/Header/TableTitleLineEdit total_energy_label = $PanelContainer/MarginContainer/VBoxContainer/TableSummary/HBoxContainer/TotalEnergyLabel if rows_data != null: @@ -96,11 +96,11 @@ func _on_table_title_line_edit_text_changed(new_text): func get_save_data() -> Dictionary: - var rows_data = table_rows.map(func get_row(row): return row.get_save_data()) + var rows_json_data = table_rows.map(func get_row(row): return row.get_save_data()) return { "title": title, "title_placeholder": title_placeholder, - "rows": rows_data, + "rows": rows_json_data, } diff --git a/src/modules/building/energy_calculator/energy_table.tscn b/src/modules/building/energy_calculator/energy_table.tscn index 7be9c60..8271faa 100644 --- a/src/modules/building/energy_calculator/energy_table.tscn +++ b/src/modules/building/energy_calculator/energy_table.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://cbegq3jfbfb6t"] +[gd_scene load_steps=3 format=3 uid="uid://cbegq3jfbfb6t"] [ext_resource type="Script" path="res://src/modules/building/energy_calculator/energy_table.gd" id="1_vq16x"] +[ext_resource type="StyleBox" uid="uid://cao1u20a4ql0s" path="res://src/styles/primary_button.tres" id="2_f4c4g"] [node name="EnergyTable" type="MarginContainer"] anchors_preset = 10 @@ -21,22 +22,16 @@ theme_override_constants/margin_bottom = 9 [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] layout_mode = 2 -[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer"] +[node name="Header" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer"] layout_mode = 2 theme_override_constants/margin_bottom = 9 -[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/MarginContainer"] -layout_mode = 2 - -[node name="TableTitleLineEdit" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"] +[node name="TableTitleLineEdit" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/Header"] layout_mode = 2 size_flags_horizontal = 3 +placeholder_text = "Введите название таблицы" flat = true -[node name="AddBuildingButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"] -layout_mode = 2 -text = "Добавить здание" - [node name="TableHeader" type="PanelContainer" parent="PanelContainer/MarginContainer/VBoxContainer"] layout_mode = 2 @@ -87,5 +82,17 @@ layout_mode = 2 size_flags_horizontal = 3 text = "0" -[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/TableTitleLineEdit" to="." method="_on_table_title_line_edit_text_changed"] -[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/AddBuildingButton" to="." method="_on_add_building_button_pressed"] +[node name="Footer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/margin_top = 9 + +[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Footer"] +layout_mode = 2 + +[node name="AddBuildingButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/Footer/HBoxContainer"] +layout_mode = 2 +theme_override_styles/normal = ExtResource("2_f4c4g") +text = "Добавить здание" + +[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/Header/TableTitleLineEdit" to="." method="_on_table_title_line_edit_text_changed"] +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/Footer/HBoxContainer/AddBuildingButton" to="." method="_on_add_building_button_pressed"] diff --git a/src/styles/primary_button.tres b/src/styles/primary_button.tres new file mode 100644 index 0000000..461267d --- /dev/null +++ b/src/styles/primary_button.tres @@ -0,0 +1,12 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://cao1u20a4ql0s"] + +[resource] +content_margin_left = 9.0 +content_margin_top = 3.0 +content_margin_right = 9.0 +content_margin_bottom = 3.0 +bg_color = Color(0.133333, 0.262745, 0.564706, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3