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

Remove Global.main_window variable

This commit is contained in:
Emmanouil Papadeas 2024-07-21 21:25:03 +03:00
parent 774786ab44
commit d82a40f9f9
4 changed files with 8 additions and 9 deletions

View file

@ -578,7 +578,6 @@ var layer_button_node := preload("res://src/UI/Timeline/LayerButton.tscn")
## The [PackedScene] of the button used by cels in the timeline.
var cel_button_scene: PackedScene = load("res://src/UI/Timeline/CelButton.tscn")
@onready var main_window := get_window() ## The main Pixelorama [Window].
## The control node (aka Main node). It has the [param Main.gd] script attached.
@onready var control := get_tree().current_scene as Control
@ -942,7 +941,7 @@ func undo_or_redo(
canvas_preview_container.canvas_preview.queue_redraw()
if !project.has_changed:
if project == current_project:
main_window.title = main_window.title + "(*)"
get_window().title = get_window().title + "(*)"
project.has_changed = true

View file

@ -275,7 +275,7 @@ func open_pxo_file(path: String, is_backup := false, replace_empty := true) -> v
else:
# Loading a backup should not change window title and save path
new_project.save_path = path
Global.main_window.title = new_project.name + " - Pixelorama " + Global.current_version
get_window().title = new_project.name + " - Pixelorama " + Global.current_version
Global.save_sprites_dialog.current_path = path
# Set last opened project path and save
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
@ -437,7 +437,7 @@ func save_pxo_file(
project.has_changed = false
Global.current_project.remove_backup_file()
Global.notification_label("File saved")
Global.main_window.title = project.name + " - Pixelorama " + Global.current_version
get_window().title = project.name + " - Pixelorama " + Global.current_version
# Set last opened project path and save
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
@ -798,11 +798,11 @@ func set_new_imported_tab(project: Project, path: String) -> void:
var prev_project_empty := Global.current_project.is_empty()
var prev_project_pos := Global.current_project_index
Global.main_window.title = (
get_window().title = (
path.get_file() + " (" + tr("imported") + ") - Pixelorama " + Global.current_version
)
if project.has_changed:
Global.main_window.title = Global.main_window.title + "(*)"
get_window().title = get_window().title + "(*)"
var file_name := path.get_basename().get_file()
project.export_directory_path = path.get_base_dir()
project.file_name = file_name

View file

@ -198,9 +198,9 @@ func change_project() -> void:
Brushes.add_project_brush(brush)
Global.transparent_checker.update_rect()
Global.cursor_position_label.text = "[%s×%s]" % [size.x, size.y]
Global.main_window.title = "%s - Pixelorama %s" % [name, Global.current_version]
Global.get_window().title = "%s - Pixelorama %s" % [name, Global.current_version]
if has_changed:
Global.main_window.title = Global.main_window.title + "(*)"
Global.get_window().title = Global.get_window().title + "(*)"
if export_directory_path != "":
Global.open_sprites_dialog.current_path = export_directory_path
Global.save_sprites_dialog.current_path = export_directory_path

View file

@ -165,7 +165,7 @@ func _init() -> void:
func _ready() -> void:
get_tree().set_auto_accept_quit(false)
Global.main_window.title = tr("untitled") + " - Pixelorama " + Global.current_version
get_window().title = tr("untitled") + " - Pixelorama " + Global.current_version
Global.current_project.layers.append(PixelLayer.new(Global.current_project))
Global.current_project.frames.append(Global.current_project.new_empty_frame())