mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 11:54:44 -04:00
Re-added Polish in Preferences and in Main.gd's loaded_locales
This commit is contained in:
parent
dfc632e8f6
commit
3a29a729e9
5 changed files with 158 additions and 181 deletions
|
@ -1,9 +1,5 @@
|
|||
extends WindowDialog
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
onready var palette_grid = $VBoxContainer/HBoxContainer/Panel/EditPaletteGridContainer
|
||||
onready var color_name_edit = $VBoxContainer/HBoxContainer3/EditPaletteColorNameLineEdit
|
||||
onready var color_picker = $VBoxContainer/HBoxContainer/EditPaletteColorPicker
|
||||
|
@ -14,28 +10,25 @@ var current_palette : String
|
|||
var current_swatch := -1
|
||||
var working_palette : Dictionary
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func open(palette : String) -> void:
|
||||
current_palette = palette
|
||||
if Global.palettes.has(palette):
|
||||
working_palette = Global.palettes[palette].duplicate()
|
||||
|
||||
|
||||
_display_palette()
|
||||
|
||||
|
||||
self.popup_centered()
|
||||
pass
|
||||
|
||||
func _display_palette() -> void:
|
||||
_clear_swatches()
|
||||
var index := 0
|
||||
|
||||
|
||||
for color_data in working_palette.colors:
|
||||
var color = Color(color_data.data)
|
||||
var new_button = palette_button.instance()
|
||||
|
||||
|
||||
new_button.color = color
|
||||
new_button.get_child(0).modulate = color
|
||||
new_button.hint_tooltip = color_data.data.to_upper() + " " + color_data.name
|
||||
|
@ -43,7 +36,7 @@ func _display_palette() -> void:
|
|||
new_button.index = index
|
||||
new_button.connect("on_drop_data", self, "on_move_swatch")
|
||||
new_button.connect("pressed", self, "on_swatch_select", [index])
|
||||
|
||||
|
||||
palette_grid.add_child(new_button)
|
||||
index += 1
|
||||
|
||||
|
@ -63,9 +56,9 @@ func on_move_swatch(from : int, to : int) -> void:
|
|||
var color_to_move = working_palette.colors[from]
|
||||
working_palette.colors.remove(from)
|
||||
working_palette.colors.insert(to, color_to_move)
|
||||
|
||||
|
||||
palette_grid.move_child(palette_grid.get_child(from), to)
|
||||
|
||||
|
||||
# Re-index swatches with new order
|
||||
var index := 0
|
||||
for child in palette_grid.get_children():
|
||||
|
@ -73,10 +66,6 @@ func on_move_swatch(from : int, to : int) -> void:
|
|||
index += 1
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
func _on_AddSwatchButton_pressed() -> void:
|
||||
var color = Color.white
|
||||
var color_data = {}
|
||||
|
@ -84,7 +73,7 @@ func _on_AddSwatchButton_pressed() -> void:
|
|||
color_data.name = "no name"
|
||||
working_palette.colors.push_back(color_data)
|
||||
var new_button = palette_button.instance()
|
||||
|
||||
|
||||
new_button.color = color
|
||||
new_button.get_child(0).modulate = color
|
||||
new_button.hint_tooltip = color_data.data.to_upper() + " " + color_data.name
|
||||
|
@ -93,7 +82,7 @@ func _on_AddSwatchButton_pressed() -> void:
|
|||
new_button.index = index
|
||||
new_button.connect("on_drop_data", self, "on_move_swatch")
|
||||
new_button.connect("pressed", self, "on_swatch_select", [index])
|
||||
|
||||
|
||||
palette_grid.add_child(new_button)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ func _ready() -> void:
|
|||
loaded_locales = TranslationServer.get_loaded_locales()
|
||||
else:
|
||||
# Hardcoded list of locales
|
||||
loaded_locales = ["de", "el", "en", "fr"]
|
||||
loaded_locales = ["de", "el", "en", "fr", "pl"]
|
||||
|
||||
# Make sure locales are always sorted, in the same order
|
||||
loaded_locales.sort()
|
||||
|
@ -1051,7 +1051,7 @@ func _on_PaletteOptionButton_item_selected(ID) -> void:
|
|||
func _on_EditPalette_pressed() -> void:
|
||||
Global.palette_container.on_edit_palette()
|
||||
pass
|
||||
|
||||
|
||||
func _on_RemovePalette_pressed() -> void:
|
||||
Global.palette_container.remove_current_palette()
|
||||
pass
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
extends Button
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
signal on_drop_data
|
||||
|
||||
export var index := 0;
|
||||
|
@ -12,10 +7,6 @@ export var draggable := false
|
|||
|
||||
var drag_preview_texture = preload("res://Assets/Graphics/Palette/swatch_drag_preview.png")
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func get_drag_data(position):
|
||||
var data = null;
|
||||
if(draggable):
|
||||
|
@ -33,7 +24,3 @@ func can_drop_data(position, data):
|
|||
func drop_data(position, data):
|
||||
emit_signal("on_drop_data", data.source_index, index);
|
||||
pass;
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
|
|
@ -23,12 +23,12 @@ func on_palette_select(palette_name : String) -> void:
|
|||
if Global.palettes.has(palette_name): #Palette exists in memory
|
||||
current_palette = palette_name
|
||||
var palette : Dictionary = Global.palettes[palette_name]
|
||||
|
||||
|
||||
Global.remove_palette_button.disabled = true # Cannot remove by default
|
||||
if palette.has("editable"):
|
||||
if palette.editable:
|
||||
Global.remove_palette_button.disabled = false # Can remove if custom palette
|
||||
|
||||
|
||||
_display_palette(palette)
|
||||
else: #Use default on fail
|
||||
current_palette = "Default"
|
||||
|
@ -36,7 +36,7 @@ func on_palette_select(palette_name : String) -> void:
|
|||
|
||||
func on_edit_palette() -> void:
|
||||
var palette : Dictionary = Global.palettes[current_palette]
|
||||
|
||||
|
||||
var create_new_palette := true # Create new palette by default
|
||||
if palette.has("editable"):
|
||||
if palette.editable:
|
||||
|
@ -59,15 +59,15 @@ func on_new_palette_confirmed() -> void:
|
|||
|
||||
func create_new_palette(name : String, from_palette : Dictionary = {}) -> String: # Returns empty string, else error string
|
||||
var new_palette : Dictionary = {}
|
||||
|
||||
|
||||
# Check if new name is valid
|
||||
if name.empty():
|
||||
return "Error: Palette must have a valid name."
|
||||
if Global.palettes.has(name):
|
||||
return "Error: Palette '" + name + "' already exists!"
|
||||
|
||||
|
||||
new_palette.name = name
|
||||
|
||||
|
||||
# Check if source palette has data
|
||||
if from_palette.has("name"):
|
||||
new_palette = from_palette.duplicate()
|
||||
|
@ -77,36 +77,36 @@ func create_new_palette(name : String, from_palette : Dictionary = {}) -> String
|
|||
new_palette.colors = []
|
||||
new_palette.comments = ""
|
||||
new_palette.editable = true
|
||||
|
||||
|
||||
# Add palette to Global and options
|
||||
Global.palettes[name] = new_palette
|
||||
Global.palette_option_button.add_item(name)
|
||||
var index := Global.palette_option_button.get_item_count() - 1
|
||||
Global.palette_option_button.set_item_metadata(index, name)
|
||||
Global.palette_option_button.select(index)
|
||||
|
||||
|
||||
save_palette(name, name + ".json")
|
||||
|
||||
|
||||
on_palette_select(name)
|
||||
return ""
|
||||
|
||||
func _display_palette(palette : Dictionary) -> void:
|
||||
var index := 0
|
||||
|
||||
|
||||
for color_data in palette.colors:
|
||||
var color = Color(color_data.data)
|
||||
var new_button = palette_button.instance()
|
||||
|
||||
|
||||
new_button.get_child(0).modulate = color
|
||||
new_button.hint_tooltip = color_data.data.to_upper() + " " + color_data.name
|
||||
new_button.connect("pressed", self, "on_color_select", [index])
|
||||
|
||||
|
||||
add_child(new_button)
|
||||
index += 1
|
||||
|
||||
func on_color_select(index : int) -> void:
|
||||
var color = Color(Global.palettes[current_palette].colors[index].data)
|
||||
|
||||
|
||||
if Input.is_action_just_released("left_mouse"):
|
||||
Global.left_color_picker.color = color
|
||||
Global.update_left_custom_brush()
|
||||
|
@ -137,10 +137,10 @@ func _load_palettes() -> void:
|
|||
Global.palette_option_button.set_item_metadata(index, result)
|
||||
if result == "Default":
|
||||
Global.palette_option_button.select(index)
|
||||
|
||||
|
||||
dir.open("user://palettes/custom")
|
||||
var custom_palette_files : Array = get_palette_files("user://palettes/custom")
|
||||
|
||||
|
||||
for file_name in custom_palette_files:
|
||||
var result : String = load_palette("user://palettes/custom/" + file_name)
|
||||
if result:
|
||||
|
@ -151,7 +151,7 @@ func _load_palettes() -> void:
|
|||
func get_palette_files(path : String) -> Array:
|
||||
var dir := Directory.new()
|
||||
var results = []
|
||||
|
||||
|
||||
dir.open(path)
|
||||
dir.list_dir_begin()
|
||||
|
||||
|
@ -163,7 +163,7 @@ func get_palette_files(path : String) -> Array:
|
|||
results.append(file_name)
|
||||
|
||||
dir.list_dir_end()
|
||||
|
||||
|
||||
return results
|
||||
|
||||
func load_palette(path : String) -> String:
|
||||
|
@ -200,7 +200,7 @@ func remove_current_palette() -> void:
|
|||
Global.palette_option_button.remove_item(selected_index)
|
||||
if(selected_index - 1 >= 0):
|
||||
Global.palette_option_button.select(selected_index - 1)
|
||||
on_palette_select(Global.palette_option_button.get_item_metadata(selected_index - 1))
|
||||
on_palette_select(Global.palette_option_button.get_item_metadata(selected_index - 1))
|
||||
pass
|
||||
|
||||
func _delete_palette_file(file_name : String) -> void:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue