Reformat files

This commit is contained in:
deajan 2024-09-02 00:24:29 +02:00
parent 5060d280ca
commit 8cf3db3533
5 changed files with 32 additions and 19 deletions

View file

@ -1011,7 +1011,7 @@ class NPBackupRunner:
"""
# Possible warnings to add to json output
warnings = []
stdin_from_command = self.repo_config.g("backup_opts.stdin_from_command")
if not read_from_stdin and not stdin_from_command:
# Preflight checks
@ -1116,7 +1116,7 @@ class NPBackupRunner:
if stdin_from_command:
self.write_logs(
f"Running backup of given command stdout as name {stdin_filename} to repo {self.repo_config.g('name')}",
level="info"
level="info",
)
elif stdin_filename:
self.write_logs(

View file

@ -861,24 +861,28 @@ def config_gui(full_config: dict, config_file: str):
expand_y=True,
)
],
[
sg.Text(_t("config_gui.stdin_from_command"))
],
[sg.Text(_t("config_gui.stdin_from_command"))],
[
sg.Image(
NON_INHERITED_ICON,
key="inherited.backup_opts.stdin_from_command",
tooltip=_t("config_gui.group_inherited"),
pad=1,
),
NON_INHERITED_ICON,
key="inherited.backup_opts.stdin_from_command",
tooltip=_t("config_gui.group_inherited"),
pad=1,
),
sg.Input(key="backup_opts.stdin_from_command", size=(100, 1)),
],
[
sg.Input(visible=False, key="--ADD-PATHS-FILE--", enable_events=True),
sg.FilesBrowse(_t("generic.add_files"), target="--ADD-PATHS-FILE--", key="--ADD-PATHS-FILE-BUTTON--"),
sg.FilesBrowse(
_t("generic.add_files"),
target="--ADD-PATHS-FILE--",
key="--ADD-PATHS-FILE-BUTTON--",
),
sg.Input(visible=False, key="--ADD-PATHS-FOLDER--", enable_events=True),
sg.FolderBrowse(
_t("generic.add_folder"), target="--ADD-PATHS-FOLDER--", key="--ADD-PATHS-FOLDER-BUTTON--"
_t("generic.add_folder"),
target="--ADD-PATHS-FOLDER--",
key="--ADD-PATHS-FOLDER-BUTTON--",
),
sg.Button(_t("generic.add_manually"), key="--ADD-PATHS-MANUALLY--"),
sg.Button(_t("generic.remove_selected"), key="--REMOVE-PATHS--"),
@ -2113,7 +2117,10 @@ Google Cloud storage: GOOGLE_PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS\n\
update_global_gui(full_config, unencrypted=False)
continue
if event == "backup_opts.source_type":
value = get_key_from_value(combo_boxes["backup_opts.source_type"], values["backup_opts.source_type"])
value = get_key_from_value(
combo_boxes["backup_opts.source_type"],
values["backup_opts.source_type"],
)
if value == "stdin_from_command":
window["backup_opts.paths"].update(visible=False)
window["--ADD-PATHS-FILE-BUTTON--"].update(disabled=True)
@ -2336,7 +2343,10 @@ Google Cloud storage: GOOGLE_PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS\n\
minute=minute,
)
if result:
sg.Popup(_t("config_gui.scheduled_task_creation_success"), keep_on_top=True)
sg.Popup(
_t("config_gui.scheduled_task_creation_success"),
keep_on_top=True,
)
else:
sg.PopupError(
_t("config_gui.scheduled_task_creation_failure"),

View file

@ -279,7 +279,7 @@ def gui_thread_runner(
logger.debug("gui_thread_runner got stdout queue close signal")
read_stdout_queue = False
else:
stdout_cache += stdout_data.strip("\r\n") + '\n'
stdout_cache += stdout_data.strip("\r\n") + "\n"
# So the FreeSimpleGUI update implementation is **really** slow to update multiline when autoscroll=True
# and there's too much invisible text
# we need to create a cache that's updated once
@ -297,7 +297,7 @@ def gui_thread_runner(
read_stderr_queue = False
else:
stderr_has_messages = True
stderr_cache += stderr_data.strip("\r\n") + '\n'
stderr_cache += stderr_data.strip("\r\n") + "\n"
read_queues = read_stdout_queue or read_stderr_queue

View file

@ -883,7 +883,6 @@ class ResticRunner:
level="warning",
)
for tag in tags:
if tag:
tag = tag.strip()

View file

@ -66,9 +66,13 @@ def create_scheduled_task(
config_file = os.path.join(CURRENT_DIR, config_file)
if interval_minutes:
logger.info(f"Creating scheduled task {type} to run every {interval_minutes} minutes")
logger.info(
f"Creating scheduled task {type} to run every {interval_minutes} minutes"
)
elif hour and minute:
logger.info(f"Creating scheduled task {type} to run at everyday at {hour}h{minute}")
logger.info(
f"Creating scheduled task {type} to run at everyday at {hour}h{minute}"
)
if os.name == "nt":
return create_scheduled_task_windows(