change styles for primary button
This commit is contained in:
parent
c255e5aa96
commit
410b1de919
5 changed files with 37 additions and 18 deletions
|
@ -72,8 +72,6 @@ func load_data():
|
||||||
var save_data_file = FileAccess.open("user://energy_table.save", FileAccess.READ)
|
var save_data_file = FileAccess.open("user://energy_table.save", FileAccess.READ)
|
||||||
var file_content = save_data_file.get_as_text()
|
var file_content = save_data_file.get_as_text()
|
||||||
|
|
||||||
print(file_content)
|
|
||||||
|
|
||||||
var json = JSON.new()
|
var json = JSON.new()
|
||||||
var parse_result = json.parse(file_content)
|
var parse_result = json.parse(file_content)
|
||||||
|
|
||||||
|
|
|
@ -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="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"]
|
[node name="EnergyCalculator" type="MarginContainer"]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
@ -38,6 +39,7 @@ layout_mode = 2
|
||||||
|
|
||||||
[node name="AddSectionButton" type="Button" parent="PanelContainer/MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer"]
|
[node name="AddSectionButton" type="Button" parent="PanelContainer/MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme_override_styles/normal = ExtResource("2_gup2y")
|
||||||
text = "Добавить секцию"
|
text = "Добавить секцию"
|
||||||
|
|
||||||
[connection signal="pressed" from="PanelContainer/MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer/AddSectionButton" to="." method="_on_add_section_button_pressed"]
|
[connection signal="pressed" from="PanelContainer/MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer/AddSectionButton" to="." method="_on_add_section_button_pressed"]
|
||||||
|
|
|
@ -59,7 +59,7 @@ func add_row(data_row: Dictionary):
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
table_body = $PanelContainer/MarginContainer/VBoxContainer/TableBody/VBoxContainer
|
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
|
total_energy_label = $PanelContainer/MarginContainer/VBoxContainer/TableSummary/HBoxContainer/TotalEnergyLabel
|
||||||
|
|
||||||
if rows_data != null:
|
if rows_data != null:
|
||||||
|
@ -96,11 +96,11 @@ func _on_table_title_line_edit_text_changed(new_text):
|
||||||
|
|
||||||
|
|
||||||
func get_save_data() -> Dictionary:
|
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 {
|
return {
|
||||||
"title": title,
|
"title": title,
|
||||||
"title_placeholder": title_placeholder,
|
"title_placeholder": title_placeholder,
|
||||||
"rows": rows_data,
|
"rows": rows_json_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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="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"]
|
[node name="EnergyTable" type="MarginContainer"]
|
||||||
anchors_preset = 10
|
anchors_preset = 10
|
||||||
|
@ -21,22 +22,16 @@ theme_override_constants/margin_bottom = 9
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="Header" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_bottom = 9
|
theme_override_constants/margin_bottom = 9
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/MarginContainer"]
|
[node name="TableTitleLineEdit" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="TableTitleLineEdit" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
placeholder_text = "Введите название таблицы"
|
||||||
flat = true
|
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"]
|
[node name="TableHeader" type="PanelContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -87,5 +82,17 @@ layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "0"
|
text = "0"
|
||||||
|
|
||||||
[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/TableTitleLineEdit" to="." method="_on_table_title_line_edit_text_changed"]
|
[node name="Footer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/AddBuildingButton" to="." method="_on_add_building_button_pressed"]
|
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"]
|
||||||
|
|
12
src/styles/primary_button.tres
Normal file
12
src/styles/primary_button.tres
Normal 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
|
Loading…
Reference in a new issue