diff --git a/npbackup/gui/config.py b/npbackup/gui/config.py index 60d83d1..5f501df 100644 --- a/npbackup/gui/config.py +++ b/npbackup/gui/config.py @@ -63,7 +63,6 @@ sg.TreeData.delete = delete ENCRYPTED_DATA_PLACEHOLDER = "<{}>".format(_t("config_gui.encrypted_data")) -BAD_KEYS_FOUND_IN_CONFIG = set() def ask_manager_password(manager_password: str) -> bool: @@ -192,7 +191,9 @@ def config_gui(full_config: dict, config_file: str): raise ValueError("Bogus object type given") window.close() if object_type and object_name: - full_config = update_object_gui(full_config, object_type, object_name, unencrypted=False) + full_config = update_object_gui( + full_config, object_type, object_name, unencrypted=False + ) update_global_gui(full_config, unencrypted=False) return full_config, object_type, object_name @@ -289,7 +290,7 @@ def config_gui(full_config: dict, config_file: str): Update gui values depending on their type This not called directly, but rather from update_object_gui which calls iter_over_config which calls this function """ - global BAD_KEYS_FOUND_IN_CONFIG + nonlocal BAD_KEYS_FOUND_IN_CONFIG nonlocal backup_paths_tree nonlocal tags_tree @@ -629,7 +630,12 @@ def config_gui(full_config: dict, config_file: str): update_source_layout(source_type) if BAD_KEYS_FOUND_IN_CONFIG: - if sg.popup_yes_no(_t("config_gui.delete_bad_keys") + f":{BAD_KEYS_FOUND_IN_CONFIG}"): + answer = sg.popup_yes_no( + _t("config_gui.delete_bad_keys") + + f": {','.join(BAD_KEYS_FOUND_IN_CONFIG)}", + keep_on_top=True, + ) + if answer == "Yes": for key in BAD_KEYS_FOUND_IN_CONFIG: full_key_path = f"{object_type}.{object_name}.{key}" logger.info(f"Deleting bogus key {full_key_path}") @@ -2229,6 +2235,8 @@ Google Cloud storage: GOOGLE_PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS\n\ enable_close_attempted_event=True, ) + # Init fresh config objects + BAD_KEYS_FOUND_IN_CONFIG = set() backup_paths_tree = sg.TreeData() tags_tree = sg.TreeData() exclude_patterns_tree = sg.TreeData() diff --git a/npbackup/translations/config_gui.en.yml b/npbackup/translations/config_gui.en.yml index 70229b1..db115ce 100644 --- a/npbackup/translations/config_gui.en.yml +++ b/npbackup/translations/config_gui.en.yml @@ -62,7 +62,7 @@ en: runner_not_configured: Backend not configured properly. Please see logs no_binary: Cannot find backup backend. Please install restic binary from restic.net key_error: Key from configuration has no match in GUI - delete_bad_keys: Do you want to delete the bogus keys ? Note that this only affects current object. If key is inherited, you will need to load corresponding group + delete_bad_keys: Do you want to delete the bogus keys ? Note that this only affects current object. If key is inherited, you will need to load corresponding group. Concerned keys in current object configuration_saved: Configuration saved cannot_save_configuration: Could not save configuration. See logs for further info diff --git a/npbackup/translations/config_gui.fr.yml b/npbackup/translations/config_gui.fr.yml index 53e464b..1c05518 100644 --- a/npbackup/translations/config_gui.fr.yml +++ b/npbackup/translations/config_gui.fr.yml @@ -63,7 +63,7 @@ fr: runner_not_configured: Backend non configuré proprement. Verifier les logs no_binary: Impossible de trouver le coeur de sauvegarde. Merci d'installer le binaire restic depuis restic.net key_error: Un entrée de la configuration n'a pas d'équivalent dans l'interface - delete_bad_keys: Souhaitez-vous supprimer les entrées non conformes ? Notez que seul l'objet courant sera affecté. Si l'entrée est un héritage, il faudra charger le groupe correspondant + delete_bad_keys: Souhaitez-vous supprimer les entrées non conformes ? Notez que seul l'objet courant sera affecté. Si l'entrée est un héritage, il faudra charger le groupe correspondant. Entrées concernées dans l'objet courant configuration_saved: Configuration sauvegardée cannot_save_configuration: Impossible d'enregistrer la configuration. Veuillez consulter les journaux pour plus de détails