Small tweaks, also turned off the autosave backup dialog.

This commit is contained in:
Relintai 2020-11-29 18:17:57 +01:00
parent 37631fb8d7
commit f380b53c99
2 changed files with 36 additions and 37 deletions

View File

@ -38,8 +38,8 @@ func _enter_tree() -> void:
if not DrawGD.config_cache.has_section_key("preferences", "startup"): if not DrawGD.config_cache.has_section_key("preferences", "startup"):
DrawGD.config_cache.set_value("preferences", "startup", true) DrawGD.config_cache.set_value("preferences", "startup", true)
show_splash_screen()
show_splash_screen()
handle_backup() handle_backup()
# If the user wants to run Pixelorama with arguments in terminal mode # If the user wants to run Pixelorama with arguments in terminal mode
@ -48,6 +48,9 @@ func _enter_tree() -> void:
DrawGD.opensave.handle_loading_files(OS.get_cmdline_args()) DrawGD.opensave.handle_loading_files(OS.get_cmdline_args())
get_tree().connect("files_dropped", self, "_on_files_dropped") get_tree().connect("files_dropped", self, "_on_files_dropped")
func show_splash_screen():
yield(get_tree().create_timer(0.2), "timeout")
DrawGD.can_draw = true
func _input(event : InputEvent) -> void: func _input(event : InputEvent) -> void:
# DrawGD.left_cursor.position = get_global_mouse_position() + Vector2(-32, 32) # DrawGD.left_cursor.position = get_global_mouse_position() + Vector2(-32, 32)
@ -87,35 +90,32 @@ func setup_application_window_size() -> void:
OS.window_size = DrawGD.config_cache.get_value("window", "size") OS.window_size = DrawGD.config_cache.get_value("window", "size")
func show_splash_screen() -> void:
# Wait for the window to adjust itself, so the popup is correctly centered
yield(get_tree().create_timer(0.2), "timeout")
DrawGD.can_draw = true
func handle_backup() -> void: func handle_backup() -> void:
# If backup file exists then Pixelorama was not closed properly (probably crashed) - reopen backup # If backup file exists then Pixelorama was not closed properly (probably crashed) - reopen backup
var backup_confirmation : ConfirmationDialog = $Dialogs/BackupConfirmation # var backup_confirmation : ConfirmationDialog = $Dialogs/BackupConfirmation
backup_confirmation.get_cancel().text = tr("Delete") # backup_confirmation.get_cancel().text = tr("Delete")
if DrawGD.config_cache.has_section("backups"): # if DrawGD.config_cache.has_section("backups"):
var project_paths = DrawGD.config_cache.get_section_keys("backups") # var project_paths = DrawGD.config_cache.get_section_keys("backups")
if project_paths.size() > 0: # if project_paths.size() > 0:
# Get backup paths # # Get backup paths
var backup_paths := [] # var backup_paths := []
for p_path in project_paths: # for p_path in project_paths:
backup_paths.append(DrawGD.config_cache.get_value("backups", p_path)) # backup_paths.append(DrawGD.config_cache.get_value("backups", p_path))
# Temporatily stop autosave until user confirms backup # # Temporatily stop autosave until user confirms backup
DrawGD.opensave.autosave_timer.stop() # DrawGD.opensave.autosave_timer.stop()
backup_confirmation.dialog_text = tr("Autosaved backup for %s was found. Do you want to reload it?") % project_paths # backup_confirmation.dialog_text = tr("Autosaved backup was found. Do you want to reload it?")
backup_confirmation.connect("confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths, backup_paths]) # backup_confirmation.connect("confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths, backup_paths])
backup_confirmation.get_cancel().connect("pressed", self, "_on_BackupConfirmation_delete", [project_paths, backup_paths]) # backup_confirmation.get_cancel().connect("pressed", self, "_on_BackupConfirmation_delete", [project_paths, backup_paths])
backup_confirmation.popup_centered() # backup_confirmation.popup_centered()
DrawGD.can_draw = false # DrawGD.can_draw = false
modulate = Color(0.5, 0.5, 0.5) # modulate = Color(0.5, 0.5, 0.5)
else: # else:
if DrawGD.open_last_project: # if DrawGD.open_last_project:
load_last_project() # load_last_project()
else: # else:
# if DrawGD.open_last_project:
# load_last_project()
if DrawGD.open_last_project: if DrawGD.open_last_project:
load_last_project() load_last_project()

View File

@ -143,14 +143,13 @@ dialog_text = "Can't load file '--editor'.
Error code: 7" Error code: 7"
[node name="BackupConfirmation" type="ConfirmationDialog" parent="DrawGDControl/Dialogs"] [node name="BackupConfirmation" type="ConfirmationDialog" parent="DrawGDControl/Dialogs"]
margin_left = 429.0 margin_left = 8.0
margin_top = 316.0 margin_top = 24.0
margin_right = 851.0 margin_right = 786.0
margin_bottom = 404.0 margin_bottom = 112.0
rect_min_size = Vector2( 250, 87.5 ) rect_min_size = Vector2( 250, 87.5 )
popup_exclusive = true popup_exclusive = true
dialog_text = "Autosaved backup for [user://backup-1606662249-0] was found. dialog_text = "Autosaved backup was found. Do you want to reload it?"
Do you want to reload it?"
[node name="LeftCursor" type="Sprite" parent="DrawGDControl"] [node name="LeftCursor" type="Sprite" parent="DrawGDControl"]
visible = false visible = false