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

Replace "Export" with "Overwrite" when importing a png

When exporting an imported image, the export will happen immediately, without having the export dialog appear, unless "Export as..." is selected. For .png imported images, the menu option will display "Overwrite" instead of "Export". This makes it clear that if Control + E is pressed on an imported png, that file will be overwritten.
This commit is contained in:
Manolis Papadeas 2022-03-25 02:00:40 +02:00
parent bd6f850ab5
commit e901fc774a
5 changed files with 28 additions and 8 deletions

View file

@ -91,6 +91,9 @@ msgstr ""
msgid "Export" msgid "Export"
msgstr "" msgstr ""
msgid "Overwrite"
msgstr ""
msgid "Export..." msgid "Export..."
msgstr "" msgstr ""

View file

@ -220,9 +220,14 @@ func export_processed_images(ignore_overwrites: bool, export_dialog: AcceptDialo
# 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
Global.current_project.was_exported = true Global.current_project.was_exported = true
Global.top_menu_container.file_menu.set_item_text( if Global.current_project.export_overwrite:
6, tr("Export") + " %s" % (file_name + file_format_string(file_format)) Global.top_menu_container.file_menu.set_item_text(
) 6, tr("Overwrite") + " %s" % (file_name + Export.file_format_string(file_format))
)
else:
Global.top_menu_container.file_menu.set_item_text(
6, tr("Export") + " %s" % (file_name + file_format_string(file_format))
)
# Only show when not exporting gif - gif export finishes in thread # Only show when not exporting gif - gif export finishes in thread
if not (current_tab == ExportTab.ANIMATION and animation_type == AnimationType.ANIMATED): if not (current_tab == ExportTab.ANIMATION and animation_type == AnimationType.ANIMATED):

View file

@ -598,8 +598,6 @@ func open_image_as_new_layer(image: Image, file_name: String, frame_index := 0)
func set_new_imported_tab(project: Project, path: String) -> void: func set_new_imported_tab(project: Project, path: String) -> void:
var prev_project_empty: bool = Global.current_project.is_empty() var prev_project_empty: bool = Global.current_project.is_empty()
var prev_project_pos: int = Global.current_project_index var prev_project_pos: int = Global.current_project_index
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
Global.canvas.camera_zoom()
Global.window_title = ( Global.window_title = (
path.get_file() path.get_file()
@ -614,8 +612,15 @@ func set_new_imported_tab(project: Project, path: String) -> void:
var directory_path := path.get_basename().replace(file_name, "") var directory_path := path.get_basename().replace(file_name, "")
project.directory_path = directory_path project.directory_path = directory_path
project.file_name = file_name project.file_name = file_name
project.was_exported = true
if path.get_extension().to_lower() == "png":
project.export_overwrite = true
Export.directory_path = directory_path Export.directory_path = directory_path
Export.file_name = file_name Export.file_name = file_name
Export.was_exported = true
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
Global.canvas.camera_zoom()
if prev_project_empty: if prev_project_empty:
Global.tabs.delete_tab(prev_project_pos) Global.tabs.delete_tab(prev_project_pos)

View file

@ -43,6 +43,7 @@ var directory_path := ""
var file_name := "untitled" var file_name := "untitled"
var file_format: int = Export.FileFormat.PNG var file_format: int = Export.FileFormat.PNG
var was_exported := false var was_exported := false
var export_overwrite := false
var frame_button_node = preload("res://src/UI/Timeline/FrameButton.tscn") var frame_button_node = preload("res://src/UI/Timeline/FrameButton.tscn")
var layer_button_node = preload("res://src/UI/Timeline/LayerButton.tscn") var layer_button_node = preload("res://src/UI/Timeline/LayerButton.tscn")
@ -246,9 +247,14 @@ func change_project() -> void:
if !was_exported: if !was_exported:
Global.top_menu_container.file_menu.set_item_text(6, tr("Export")) Global.top_menu_container.file_menu.set_item_text(6, tr("Export"))
else: else:
Global.top_menu_container.file_menu.set_item_text( if export_overwrite:
6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format)) Global.top_menu_container.file_menu.set_item_text(
) 6, tr("Overwrite") + " %s" % (file_name + Export.file_format_string(file_format))
)
else:
Global.top_menu_container.file_menu.set_item_text(
6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format))
)
for j in Global.TileMode.values(): for j in Global.TileMode.values():
Global.top_menu_container.tile_mode_submenu.set_item_checked(j, j == tile_mode) Global.top_menu_container.tile_mode_submenu.set_item_checked(j, j == tile_mode)

View file

@ -314,6 +314,7 @@ func _on_Interpolation_item_selected(id: int) -> void:
func _on_ExportDialog_confirmed() -> void: func _on_ExportDialog_confirmed() -> void:
Global.current_project.export_overwrite = false
if Export.export_processed_images(false, self): if Export.export_processed_images(false, self):
hide() hide()