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

New theme-related methods to ExtensionsAPI (#733)

* hide accidentally visible dialog

* added new theme methods

* Wait for themes to add from api

* remove `find_theme`

* revert last commit

* Formatting

* Some code changes

* update to godot 3.5
This commit is contained in:
Variable 2022-08-08 18:20:42 +05:00 committed by GitHub
parent afe5a90722
commit 8a6e393d69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions

View file

@ -62,7 +62,7 @@ You can find Online Documentation for Pixelorama here: https://orama-interactive
It's still work in progress so there are some pages missing. If you want to contribute, you can do so in [Pixelorama-Docs' GitHub Repository](https://github.com/Orama-Interactive/Pixelorama-Docs). It's still work in progress so there are some pages missing. If you want to contribute, you can do so in [Pixelorama-Docs' GitHub Repository](https://github.com/Orama-Interactive/Pixelorama-Docs).
## Cloning Instructions ## Cloning Instructions
Pixelorama uses Godot 3.4, so you will need to have it in order to run the project. Older versions may not work. Pixelorama uses Godot 3.5, so you will need to have it in order to run the project. Older versions may not work.
As of right now, most of the code is written using GDScript, so the mono version of Godot is not required, but Pixelorama should also work with it. As of right now, most of the code is written using GDScript, so the mono version of Godot is not required, but Pixelorama should also work with it.
## Current features: ## Current features:

View file

@ -192,9 +192,23 @@ func add_theme(theme: Theme) -> void:
themes.add_theme(theme) themes.add_theme(theme)
func find_theme_index(theme: Theme) -> int:
var themes: BoxContainer = Global.preferences_dialog.find_node("Themes")
return themes.themes.find(theme)
func get_theme() -> Theme: func get_theme() -> Theme:
return Global.control.theme return Global.control.theme
func set_theme(idx: int) -> bool:
var themes: BoxContainer = Global.preferences_dialog.find_node("Themes")
if idx >= 0 and idx < themes.themes.size():
themes.buttons_container.get_child(idx).emit_signal("pressed")
return true
else:
return false
func remove_theme(theme: Theme) -> void: func remove_theme(theme: Theme) -> void:
Global.preferences_dialog.themes.remove_theme(theme) Global.preferences_dialog.themes.remove_theme(theme)

View file

@ -20,6 +20,7 @@ onready var theme_color_preview_scene = preload("res://src/Preferences/ThemeColo
func _ready() -> void: func _ready() -> void:
for theme in themes: for theme in themes:
add_theme(theme) add_theme(theme)
yield(get_tree(), "idle_frame")
var theme_id: int = Global.config_cache.get_value("preferences", "theme", 0) var theme_id: int = Global.config_cache.get_value("preferences", "theme", 0)
if theme_id >= themes.size(): if theme_id >= themes.size():

View file

@ -8,7 +8,6 @@
blend_mode = 4 blend_mode = 4
[node name="TileModeOffsetsDialog" type="ConfirmationDialog"] [node name="TileModeOffsetsDialog" type="ConfirmationDialog"]
visible = true
margin_right = 301.0 margin_right = 301.0
margin_bottom = 422.0 margin_bottom = 422.0
rect_min_size = Vector2( 172, 422 ) rect_min_size = Vector2( 172, 422 )