change styles for primary button

This commit is contained in:
Dmitriy Pleshevskiy 2024-01-10 12:45:19 +03:00
parent c255e5aa96
commit 410b1de919
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985
5 changed files with 37 additions and 18 deletions

View file

@ -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)

View file

@ -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"]

View file

@ -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,
}

View file

@ -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"]

View file

@ -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