mirror of
https://github.com/netinvent/npbackup.git
synced 2025-11-11 14:42:37 +08:00
GUI: Fix corner cases when config not loaded
This commit is contained in:
parent
b4c3481d59
commit
84a20407e9
1 changed files with 6 additions and 5 deletions
|
|
@ -543,7 +543,8 @@ def _main_gui(viewer_mode: bool):
|
||||||
result = upgrade_runner.run_upgrade(full_config)
|
result = upgrade_runner.run_upgrade(full_config)
|
||||||
if not result:
|
if not result:
|
||||||
sg.Popup(_t("config_gui.auto_upgrade_failed"))
|
sg.Popup(_t("config_gui.auto_upgrade_failed"))
|
||||||
return auto_upgrade_result
|
return auto_upgrade_result
|
||||||
|
return None
|
||||||
|
|
||||||
def select_config_file(config_file: str = None) -> None:
|
def select_config_file(config_file: str = None) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
@ -552,7 +553,7 @@ def _main_gui(viewer_mode: bool):
|
||||||
layout = [
|
layout = [
|
||||||
[
|
[
|
||||||
sg.Text(_t("main_gui.select_config_file")),
|
sg.Text(_t("main_gui.select_config_file")),
|
||||||
sg.Input(config_file, key="-config_file-", enable_events=True),
|
sg.Input(config_file, key="-config_file-"),
|
||||||
sg.FileBrowse(_t("generic.select_file")),
|
sg.FileBrowse(_t("generic.select_file")),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -573,7 +574,7 @@ def _main_gui(viewer_mode: bool):
|
||||||
action = event
|
action = event
|
||||||
config_file = Path(values["-config_file-"])
|
config_file = Path(values["-config_file-"])
|
||||||
break
|
break
|
||||||
if event in ("--LOAD--", "-config_file-"):
|
if event == "--LOAD--":
|
||||||
config_file = Path(values["-config_file-"])
|
config_file = Path(values["-config_file-"])
|
||||||
if not values["-config_file-"] or not config_file.exists():
|
if not values["-config_file-"] or not config_file.exists():
|
||||||
sg.PopupError(_t("generic.file_does_not_exist"), keep_on_top=True)
|
sg.PopupError(_t("generic.file_does_not_exist"), keep_on_top=True)
|
||||||
|
|
@ -908,10 +909,10 @@ def _main_gui(viewer_mode: bool):
|
||||||
[
|
[
|
||||||
sg.Text(
|
sg.Text(
|
||||||
_t("main_gui.no_config"),
|
_t("main_gui.no_config"),
|
||||||
font=("Arial", 14),
|
|
||||||
text_color="red",
|
text_color="red",
|
||||||
key="-NO-CONFIG-",
|
key="-NO-CONFIG-",
|
||||||
visible=False,
|
visible=False,
|
||||||
|
size=(25, 2)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
if not viewer_mode
|
if not viewer_mode
|
||||||
|
|
@ -1171,7 +1172,7 @@ def _main_gui(viewer_mode: bool):
|
||||||
auto_upgrade_result,
|
auto_upgrade_result,
|
||||||
)
|
)
|
||||||
if event == "--STATE-BUTTON--":
|
if event == "--STATE-BUTTON--":
|
||||||
if full_config or viewer_mode:
|
if full_config or (viewer_mode and viewer_repo_uri and viewer_repo_password):
|
||||||
current_state, backup_tz, snapshot_list = get_gui_data(repo_config)
|
current_state, backup_tz, snapshot_list = get_gui_data(repo_config)
|
||||||
gui_update_state()
|
gui_update_state()
|
||||||
if current_state is None:
|
if current_state is None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue