1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Made themes be like languages in Preferences

Also changed palette grid container columns from 8 to 5
This commit is contained in:
OverloadedOrama 2019-12-27 02:12:26 +02:00
parent de2f9b68be
commit a3fcfc4597
4 changed files with 81 additions and 21 deletions

View file

@ -1369,7 +1369,6 @@ texture_normal = ExtResource( 42 )
texture_hover = ExtResource( 43 )
[node name="ScrollPalette" type="ScrollContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/PaletteVBoxContainer"]
editor/display_folded = true
margin_top = 36.0
margin_right = 224.0
margin_bottom = 152.0
@ -1384,7 +1383,7 @@ size_flags_horizontal = 3
margin_left = 112.0
margin_right = 112.0
size_flags_horizontal = 3
columns = 8
columns = 5
script = ExtResource( 44 )
[node name="HSeparator2" type="HSeparator" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"]
@ -1801,7 +1800,6 @@ items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cu
selected = 0
[node name="PreferencesDialog" parent="." instance=ExtResource( 61 )]
visible = false
[node name="OutlineDialog" type="ConfirmationDialog" parent="."]
editor/display_folded = true

View file

@ -19,6 +19,7 @@ margin_top = 8.0
margin_right = -8.0
margin_bottom = -36.0
size_flags_horizontal = 3
custom_constants/autohide = 0
[node name="Tree" type="Tree" parent="HSplitContainer"]
margin_right = 88.0
@ -43,16 +44,17 @@ size_flags_horizontal = 3
margin_right = 205.0
margin_bottom = 282.0
[node name="LanguageOptions" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
[node name="Language Options" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_right = 205.0
margin_bottom = 28.0
rect_min_size = Vector2( 0, 28 )
text = "Language Options:"
[node name="SystemLanguage" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
[node name="System Language" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
pressed = true
text = "System Language"
@ -60,12 +62,14 @@ text = "System Language"
margin_top = 60.0
margin_right = 205.0
margin_bottom = 84.0
mouse_default_cursor_shape = 2
text = "Deutsch [de]"
[node name="Greek" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 88.0
margin_right = 205.0
margin_bottom = 112.0
mouse_default_cursor_shape = 2
custom_fonts/font = ExtResource( 2 )
text = "Ελληνικά [el]"
@ -73,50 +77,91 @@ text = "Ελληνικά [el]"
margin_top = 116.0
margin_right = 205.0
margin_bottom = 140.0
mouse_default_cursor_shape = 2
text = "English [en]"
[node name="French" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 144.0
margin_right = 205.0
margin_bottom = 168.0
mouse_default_cursor_shape = 2
text = "Français [fr]"
[node name="Polish" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 172.0
margin_right = 205.0
margin_bottom = 196.0
mouse_default_cursor_shape = 2
text = "Polski [pl]"
[node name="Brazilian Portuguese" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 200.0
margin_right = 205.0
margin_bottom = 224.0
mouse_default_cursor_shape = 2
text = "Português Brasileiro [pt_BR]"
[node name="Russian" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 228.0
margin_right = 205.0
margin_bottom = 252.0
mouse_default_cursor_shape = 2
text = "Русский [ru]"
[node name="Traditional Chinese" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 256.0
margin_right = 205.0
margin_bottom = 282.0
mouse_default_cursor_shape = 2
custom_fonts/font = ExtResource( 3 )
text = "繁體中文 [zh_TW]"
[node name="ThemeOption" type="OptionButton" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
visible = false
margin_top = 24.0
margin_right = 151.0
margin_bottom = 44.0
[node name="Themes" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
margin_right = 40.0
margin_bottom = 40.0
[node name="Theme Options" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_right = 205.0
margin_bottom = 28.0
rect_min_size = Vector2( 0, 28 )
text = "Theme Options:"
[node name="Dark Theme" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
text = "Dark"
items = [ "Dark", null, false, 0, null, "Gray", null, false, 1, null, "Godot", null, false, 2, null, "Gold", null, false, 3, null, "Light", null, false, 4, null ]
selected = 0
[node name="Gray Theme" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
text = "Gray"
[node name="Godot\'s Theme" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
text = "Godot"
[node name="Gold Theme" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
text = "Gold"
[node name="Light Theme" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Themes"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
text = "Light"
[node name="Grid&Guides" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
editor/display_folded = true
visible = false
margin_top = 24.0
margin_right = 151.0
@ -131,6 +176,8 @@ text = "Grid options"
margin_top = 18.0
margin_right = 151.0
margin_bottom = 94.0
custom_constants/vseparation = 4
custom_constants/hseparation = 4
columns = 2
[node name="WidthLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
@ -177,7 +224,6 @@ margin_right = 124.0
margin_bottom = 76.0
rect_min_size = Vector2( 64, 20 )
[connection signal="item_selected" from="HSplitContainer/Tree" to="." method="_on_Tree_item_selected"]
[connection signal="item_selected" from="HSplitContainer/ScrollContainer/VBoxContainer/ThemeOption" to="." method="_on_ThemeOption_item_selected"]
[connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridWidthValue" to="." method="_on_GridWidthValue_value_changed"]
[connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridHeightValue" to="." method="_on_GridHeightValue_value_changed"]
[connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridColor" to="." method="_on_GridColor_color_changed"]

View file

@ -252,7 +252,7 @@ func edit_menu_id_pressed(id : int) -> void:
Global.selected_pixels.clear()
Global.canvas.handle_redo("Rectangle Select")
3: # Preferences
$PreferencesDialog.popup_centered(Vector2(380, 300))
$PreferencesDialog.popup_centered(Vector2(300, 280))
Global.can_draw = false
func view_menu_id_pressed(id : int) -> void:

View file

@ -3,7 +3,7 @@ extends AcceptDialog
onready var tree : Tree = $HSplitContainer/Tree
onready var right_side : VBoxContainer = $HSplitContainer/ScrollContainer/VBoxContainer
onready var languages = $HSplitContainer/ScrollContainer/VBoxContainer/Languages
onready var theme_option = $HSplitContainer/ScrollContainer/VBoxContainer/ThemeOption
onready var themes = $HSplitContainer/ScrollContainer/VBoxContainer/Themes
onready var grid_guides = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides"
func _ready() -> void:
@ -20,10 +20,14 @@ func _ready() -> void:
if child is Button:
child.connect("pressed", self, "_on_Language_pressed", [child])
for child in themes.get_children():
if child is Button:
child.connect("pressed", self, "_on_Theme_pressed", [child])
if Global.config_cache.has_section_key("preferences", "theme"):
var theme_id = Global.config_cache.get_value("preferences", "theme")
change_theme(theme_id)
theme_option.selected = theme_id
themes.get_child(theme_id + 1).pressed = true
func _on_Tree_item_selected() -> void:
for child in right_side.get_children():
@ -32,7 +36,7 @@ func _on_Tree_item_selected() -> void:
if "Language" in selected:
languages.visible = true
elif "Themes" in selected:
theme_option.visible = true
themes.visible = true
elif "Guides & Grid" in selected:
grid_guides.visible = true
@ -60,12 +64,24 @@ func _on_Language_pressed(button : Button) -> void:
Global.config_cache.set_value("preferences", "locale", TranslationServer.get_locale())
Global.config_cache.save("user://cache.ini")
func _on_ThemeOption_item_selected(ID : int) -> void:
change_theme(ID)
func _on_Theme_pressed(button : Button) -> void:
var index := 0
var i := 0
for child in themes.get_children():
if child is Button:
if child == button:
button.pressed = true
index = i
else:
child.pressed = false
i += 1
Global.config_cache.set_value("preferences", "theme", ID)
change_theme(index)
Global.config_cache.set_value("preferences", "theme", index)
Global.config_cache.save("user://cache.ini")
func change_theme(ID : int) -> void:
var font = Global.control.theme.default_font
var main_theme