From 52fa4608769fa6c33f64303319ee0431f8486c25 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 22 Feb 2020 17:14:32 +0200 Subject: [PATCH] Saved is false after any action and is true at the beginning Also hide QuitDialog after saving --- Scripts/Global.gd | 6 ++++-- Scripts/Main.gd | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Scripts/Global.gd b/Scripts/Global.gd index 3c1ab70e5..b7bbb3656 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -8,8 +8,8 @@ var config_cache := ConfigFile.new() # warning-ignore:unused_class_variable var loaded_locales : Array var undo_redo : UndoRedo -var undos := 0 #The number of times we added undo properties -var saved := false #Checks if the user has saved +var undos := 0 # The number of times we added undo properties +var saved := true # Checks if the user has saved # Canvas related stuff var current_frame := 0 setget frame_changed @@ -426,6 +426,7 @@ func undo(_canvases : Array, layer_index : int = -1) -> void: canvas_parent.move_child(_canvases[0], _canvases[0].frame) canvas.update() + saved = false notification_label("Undo: %s" % action_name) @@ -466,6 +467,7 @@ func redo(_canvases : Array, layer_index : int = -1) -> void: canvas_parent.move_child(_canvases[0], _canvases[0].frame) canvas.update() + saved = false if control.redone: notification_label("Redo: %s" % action_name) diff --git a/Scripts/Main.gd b/Scripts/Main.gd index a6cb289f8..451de24f0 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -167,10 +167,10 @@ func _ready() -> void: Global.canvas.generate_layer_panels() Import.import_brushes("Brushes") - + $MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton.get_picker().presets_visible = false $MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton.get_picker().presets_visible = false - + if not Global.config_cache.has_section_key("preferences", "startup"): Global.config_cache.set_value("preferences", "startup", true) if Global.config_cache.get_value("preferences", "startup"): @@ -476,14 +476,14 @@ func _on_OpenSprite_file_selected(path : String) -> void: brush_line = file.get_line() file.close() - + current_save_path = path $SaveSprite.current_path = path $ExportSprites.current_export_path = path.trim_suffix(".pxo") + ".png" $ExportSprites.current_path = $ExportSprites.current_export_path file_menu.set_item_text(2, tr("Save") + " %s" % path.get_file()) file_menu.set_item_text(5, tr("Export") + " %s" % $ExportSprites.current_path.get_file()) - + OS.set_window_title(path.get_file() + " - Pixelorama") @@ -861,11 +861,12 @@ func _on_QuitDialog_confirmed() -> void: get_tree().quit() -func _on_QuitDialog_custom_action(action): +func _on_QuitDialog_custom_action(action : String) -> void: if action == "Save": $SaveSprite.popup_centered() + $QuitDialog.hide() Global.can_draw = false -func _on_QuitDialog_popup_hide(): +func _on_QuitDialog_popup_hide() -> void: if !Global.saved: SaveButton.queue_free()