mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
When there are errors in opening and saving files, the errors appear in the form of a popup dialog, instead of a notification or an OS alert.
This commit is contained in:
parent
9be6248024
commit
ab6bebd6d4
|
@ -16,6 +16,7 @@ PinyaColada, Rémi Verschelde (akien-mga)
|
||||||
### Changed
|
### Changed
|
||||||
- `~` is now used as a random brush prefix instead of `%`. ([#362](https://github.com/Orama-Interactive/Pixelorama/pull/362))
|
- `~` is now used as a random brush prefix instead of `%`. ([#362](https://github.com/Orama-Interactive/Pixelorama/pull/362))
|
||||||
- The default path of the dialogs for opening and saving is now the user's desktop folder.
|
- The default path of the dialogs for opening and saving is now the user's desktop folder.
|
||||||
|
- When there are errors in opening and saving files, the errors appear in the form of a popup dialog, instead of a notification or an OS alert.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Made .pxo saving safer. In case of a crash while parsing JSON data, the old .pxo file, if it exists, will no longer be overwritten and corrupted.
|
- Made .pxo saving safer. In case of a crash while parsing JSON data, the old .pxo file, if it exists, will no longer be overwritten and corrupted.
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
region_rect = Rect2( 0, 0, 8, 8 )
|
region_rect = Rect2( 0, 0, 8, 8 )
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
region_rect = Rect2( 0, 0, 8, 8 )
|
region_rect = Rect2( 0, 0, 8, 8 )
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
region_rect = Rect2( 0, 0, 8, 8 )
|
region_rect = Rect2( 0, 0, 8, 8 )
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
[ext_resource path="res://assets/graphics/palette/palette_button.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
region_rect = Rect2( 0, 0, 8, 8 )
|
region_rect = Rect2( 0, 0, 8, 8 )
|
||||||
|
|
|
@ -189,7 +189,9 @@ func export_processed_images(ignore_overwrites: bool, export_dialog: AcceptDialo
|
||||||
else:
|
else:
|
||||||
var err = processed_images[i].save_png(export_paths[i])
|
var err = processed_images[i].save_png(export_paths[i])
|
||||||
if err != OK:
|
if err != OK:
|
||||||
OS.alert("Can't save file. Error code: %s" % err)
|
Global.error_dialog.set_text(tr("File failed to save. Error code %s") % err)
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.dialog_open(true)
|
||||||
|
|
||||||
# Store settings for quick export and when the dialog is opened again
|
# Store settings for quick export and when the dialog is opened again
|
||||||
was_exported = true
|
was_exported = true
|
||||||
|
|
|
@ -53,7 +53,9 @@ func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
||||||
err = file.open(path, File.READ) # If the file is not compressed open it raw (pre-v0.7)
|
err = file.open(path, File.READ) # If the file is not compressed open it raw (pre-v0.7)
|
||||||
|
|
||||||
if err != OK:
|
if err != OK:
|
||||||
Global.notification_label(tr("File failed to open. Error code %s") % err)
|
Global.error_dialog.set_text(tr("File failed to open. Error code %s") % err)
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.dialog_open(true)
|
||||||
file.close()
|
file.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -267,11 +269,15 @@ func open_old_pxo_file(file : File, new_project : Project, first_line : String)
|
||||||
func save_pxo_file(path : String, autosave : bool, use_zstd_compression := true, project : Project = Global.current_project) -> void:
|
func save_pxo_file(path : String, autosave : bool, use_zstd_compression := true, project : Project = Global.current_project) -> void:
|
||||||
var serialized_data = project.serialize()
|
var serialized_data = project.serialize()
|
||||||
if !serialized_data:
|
if !serialized_data:
|
||||||
Global.notification_label(tr("File failed to save. Serialization to dictionary failed."))
|
Global.error_dialog.set_text(tr("File failed to save. Converting project data to dictionary failed."))
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.dialog_open(true)
|
||||||
return
|
return
|
||||||
var to_save = JSON.print(serialized_data)
|
var to_save = JSON.print(serialized_data)
|
||||||
if !to_save:
|
if !to_save:
|
||||||
Global.notification_label(tr("File failed to save. Dictionary to JSON failed."))
|
Global.error_dialog.set_text(tr("File failed to save. Converting dictionary to JSON failed."))
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.dialog_open(true)
|
||||||
return
|
return
|
||||||
|
|
||||||
var file : File = File.new()
|
var file : File = File.new()
|
||||||
|
@ -282,7 +288,9 @@ func save_pxo_file(path : String, autosave : bool, use_zstd_compression := true,
|
||||||
err = file.open(path, File.WRITE)
|
err = file.open(path, File.WRITE)
|
||||||
|
|
||||||
if err != OK:
|
if err != OK:
|
||||||
Global.notification_label(tr("File failed to save. Error code %s") % err)
|
Global.error_dialog.set_text(tr("File failed to save. Error code %s") % err)
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.dialog_open(true)
|
||||||
file.close()
|
file.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue