mirror of
https://github.com/netinvent/npbackup.git
synced 2025-11-10 22:23:09 +08:00
!fixup: GUI: Hide blocked window when new window appears
This commit is contained in:
parent
b0615a09ae
commit
b90d9b67aa
1 changed files with 29 additions and 29 deletions
|
|
@ -325,17 +325,16 @@ def _make_treedata_from_json(ls_result: List[dict]) -> sg.TreeData:
|
|||
return treedata
|
||||
|
||||
|
||||
def ls_window(repo_config: dict, snapshot_id: str) -> bool:
|
||||
with HideWindow(window):
|
||||
result = gui_thread_runner(
|
||||
repo_config,
|
||||
"ls",
|
||||
snapshot=snapshot_id,
|
||||
__stdout=False,
|
||||
__autoclose=True,
|
||||
__compact=True,
|
||||
__backend_binary=backend_binary,
|
||||
)
|
||||
def ls_window(parent_window: sg.Window, repo_config: dict, snapshot_id: str) -> bool:
|
||||
result = gui_thread_runner(
|
||||
repo_config,
|
||||
"ls",
|
||||
snapshot=snapshot_id,
|
||||
__stdout=False,
|
||||
__autoclose=True,
|
||||
__compact=True,
|
||||
__backend_binary=backend_binary,
|
||||
)
|
||||
if not result or not result["result"]:
|
||||
sg.Popup(_t("main_gui.snapshot_is_empty"))
|
||||
return None, None
|
||||
|
|
@ -425,23 +424,24 @@ def ls_window(repo_config: dict, snapshot_id: str) -> bool:
|
|||
del result
|
||||
gc.collect()
|
||||
|
||||
while True:
|
||||
event, values = window.read()
|
||||
if event in (sg.WIN_CLOSED, sg.WIN_X_EVENT, "quit", "-WINDOW CLOSE ATTEMPED-"):
|
||||
break
|
||||
if event == "restore_to":
|
||||
if not values["-TREE-"]:
|
||||
sg.PopupError(_t("main_gui.select_folder"), keep_on_top=True)
|
||||
continue
|
||||
restore_window(repo_config, snapshot_id, values["-TREE-"])
|
||||
with HideWindow(parent_window):
|
||||
while True:
|
||||
event, values = window.read()
|
||||
if event in (sg.WIN_CLOSED, sg.WIN_X_EVENT, "quit", "-WINDOW CLOSE ATTEMPED-"):
|
||||
break
|
||||
if event == "restore_to":
|
||||
if not values["-TREE-"]:
|
||||
sg.PopupError(_t("main_gui.select_folder"), keep_on_top=True)
|
||||
continue
|
||||
restore_window(repo_config, snapshot_id, values["-TREE-"])
|
||||
|
||||
# Closing a big sg.Tree is really slow
|
||||
# We can workaround this by emptying the Tree with a new sg.TreeData() object
|
||||
# before closing the window
|
||||
window["-TREE-"].update(values=sg.TreeData())
|
||||
window.close()
|
||||
del window
|
||||
return True
|
||||
# Closing a big sg.Tree is really slow
|
||||
# We can workaround this by emptying the Tree with a new sg.TreeData() object
|
||||
# before closing the window
|
||||
window["-TREE-"].update(values=sg.TreeData())
|
||||
window.close()
|
||||
del window
|
||||
return True
|
||||
|
||||
|
||||
def restore_window(
|
||||
|
|
@ -1132,8 +1132,8 @@ def _main_gui(viewer_mode: bool):
|
|||
if len(values["snapshot-list"]) > 1:
|
||||
sg.Popup(_t("main_gui.select_only_one_snapshot"))
|
||||
continue
|
||||
snapshot_to_see = snapshot_list[values["snapshot-list"][0]][0]
|
||||
ls_window(repo_config, snapshot_to_see)
|
||||
snapshot_id = snapshot_list[values["snapshot-list"][0]][0]
|
||||
ls_window(parent_window=window, repo_config=repo_config, snapshot_id=snapshot_id)
|
||||
gc.collect()
|
||||
if event == "--FORGET--":
|
||||
if not full_config:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue