mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Never change window title and save path when loading a backup
This commit is contained in:
parent
2c985027b9
commit
42bce917dc
|
@ -182,7 +182,7 @@ func handle_loading_video(file: String) -> bool:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
func open_pxo_file(path: String, untitled_backup := false, replace_empty := true) -> void:
|
func open_pxo_file(path: String, is_backup := false, replace_empty := true) -> void:
|
||||||
var empty_project := Global.current_project.is_empty() and replace_empty
|
var empty_project := Global.current_project.is_empty() and replace_empty
|
||||||
var new_project: Project
|
var new_project: Project
|
||||||
var zip_reader := ZIPReader.new()
|
var zip_reader := ZIPReader.new()
|
||||||
|
@ -253,8 +253,8 @@ func open_pxo_file(path: String, untitled_backup := false, replace_empty := true
|
||||||
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
|
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
|
||||||
Global.canvas.camera_zoom()
|
Global.canvas.camera_zoom()
|
||||||
|
|
||||||
if not untitled_backup:
|
if not is_backup:
|
||||||
# Untitled backup should not change window title and save path
|
# Loading a backup should not change window title and save path
|
||||||
current_save_paths[Global.current_project_index] = path
|
current_save_paths[Global.current_project_index] = path
|
||||||
Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version
|
Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version
|
||||||
Global.save_sprites_dialog.current_path = path
|
Global.save_sprites_dialog.current_path = path
|
||||||
|
@ -875,7 +875,7 @@ func reload_backup_file(project_paths: Array, backup_paths: Array) -> void:
|
||||||
|
|
||||||
# Load the backup files
|
# Load the backup files
|
||||||
for i in range(project_paths.size()):
|
for i in range(project_paths.size()):
|
||||||
open_pxo_file(backup_paths[i], project_paths[i] == backup_paths[i], i == 0)
|
open_pxo_file(backup_paths[i], true, i == 0)
|
||||||
backup_save_paths[i] = backup_paths[i]
|
backup_save_paths[i] = backup_paths[i]
|
||||||
|
|
||||||
# If project path is the same as backup save path -> the backup was untitled
|
# If project path is the same as backup save path -> the backup was untitled
|
||||||
|
|
|
@ -337,7 +337,6 @@ func serialize() -> Dictionary:
|
||||||
"tile_mode_x_basis_y": tiles.x_basis.y,
|
"tile_mode_x_basis_y": tiles.x_basis.y,
|
||||||
"tile_mode_y_basis_x": tiles.y_basis.x,
|
"tile_mode_y_basis_x": tiles.y_basis.x,
|
||||||
"tile_mode_y_basis_y": tiles.y_basis.y,
|
"tile_mode_y_basis_y": tiles.y_basis.y,
|
||||||
"save_path": OpenSave.current_save_paths[Global.projects.find(self)],
|
|
||||||
"layers": layer_data,
|
"layers": layer_data,
|
||||||
"tags": tag_data,
|
"tags": tag_data,
|
||||||
"guides": guide_data,
|
"guides": guide_data,
|
||||||
|
@ -369,8 +368,6 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces
|
||||||
if dict.has("tile_mode_y_basis_x") and dict.has("tile_mode_y_basis_y"):
|
if dict.has("tile_mode_y_basis_x") and dict.has("tile_mode_y_basis_y"):
|
||||||
tiles.y_basis.x = dict.tile_mode_y_basis_x
|
tiles.y_basis.x = dict.tile_mode_y_basis_x
|
||||||
tiles.y_basis.y = dict.tile_mode_y_basis_y
|
tiles.y_basis.y = dict.tile_mode_y_basis_y
|
||||||
if dict.has("save_path"):
|
|
||||||
OpenSave.current_save_paths[Global.projects.find(self)] = dict.save_path
|
|
||||||
if dict.has("frames") and dict.has("layers"):
|
if dict.has("frames") and dict.has("layers"):
|
||||||
for saved_layer in dict.layers:
|
for saved_layer in dict.layers:
|
||||||
match int(saved_layer.get("type", Global.LayerTypes.PIXEL)):
|
match int(saved_layer.get("type", Global.LayerTypes.PIXEL)):
|
||||||
|
|
|
@ -369,13 +369,6 @@ func _quit() -> void:
|
||||||
|
|
||||||
func _on_BackupConfirmation_confirmed(project_paths: Array, backup_paths: Array) -> void:
|
func _on_BackupConfirmation_confirmed(project_paths: Array, backup_paths: Array) -> void:
|
||||||
OpenSave.reload_backup_file(project_paths, backup_paths)
|
OpenSave.reload_backup_file(project_paths, backup_paths)
|
||||||
Global.current_project.file_name = OpenSave.current_save_paths[0].get_file().trim_suffix(".pxo")
|
|
||||||
Global.current_project.export_directory_path = OpenSave.current_save_paths[0].get_base_dir()
|
|
||||||
Global.current_project.was_exported = false
|
|
||||||
Global.top_menu_container.file_menu.set_item_text(
|
|
||||||
Global.FileMenu.SAVE, tr("Save") + " %s" % OpenSave.current_save_paths[0].get_file()
|
|
||||||
)
|
|
||||||
Global.top_menu_container.file_menu.set_item_text(Global.FileMenu.EXPORT, tr("Export"))
|
|
||||||
|
|
||||||
|
|
||||||
func _on_BackupConfirmation_custom_action(
|
func _on_BackupConfirmation_custom_action(
|
||||||
|
|
Loading…
Reference in a new issue