updated timeout handling and also closing stale dialog
This commit is contained in:
@@ -15,6 +15,7 @@ dialog_timeout = 15
|
|||||||
progress_appear = 30
|
progress_appear = 30
|
||||||
progress_finish = 1800
|
progress_finish = 1800
|
||||||
settle = 1.0
|
settle = 1.0
|
||||||
|
select_timeout = 180
|
||||||
confirm_timeout = 60
|
confirm_timeout = 60
|
||||||
|
|
||||||
[controls]
|
[controls]
|
||||||
|
|||||||
@@ -140,27 +140,30 @@ def perform_export(dlg, ctrl, timeouts):
|
|||||||
# Wait for the OK button to become ready — transferring files to the
|
# Wait for the OK button to become ready — transferring files to the
|
||||||
# selected side can take a while on large drawers.
|
# selected side can take a while on large drawers.
|
||||||
ok_btn = dlg.child_window(title=ctrl["ok_btn_title"], class_name="Button")
|
ok_btn = dlg.child_window(title=ctrl["ok_btn_title"], class_name="Button")
|
||||||
ok_btn.wait("visible ready enabled", timeout=timeouts["dialog"])
|
ok_btn.wait("visible ready enabled", timeout=timeouts["select"])
|
||||||
ok_btn.click()
|
ok_btn.click()
|
||||||
|
|
||||||
|
|
||||||
def dismiss_any_dialog(app, ctrl, log):
|
def dismiss_any_dialog(app, ctrl, log):
|
||||||
"""Try to find and dismiss any stale confirmation or error dialog."""
|
"""Try to find and dismiss any stale dialogs left from a previous failure."""
|
||||||
try:
|
try:
|
||||||
saved = app.window(title=ctrl["saved_title"], class_name=ctrl["saved_class"])
|
for w in app.windows():
|
||||||
if saved.exists(timeout=1):
|
if not (w.class_name() == "#32770" and w.is_visible()):
|
||||||
saved.child_window(title=ctrl["saved_ok_title"], class_name="Button").click()
|
continue
|
||||||
log(" Dismissed stale confirmation dialog.")
|
title = w.window_text()
|
||||||
|
# Dismiss the Send To File dialog (Cancel)
|
||||||
|
if title == ctrl["dialog_title"]:
|
||||||
|
try:
|
||||||
|
w.child_window(title="Cancel", class_name="Button").click()
|
||||||
|
log(f" Dismissed stale Send To File dialog.")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
# Also try to dismiss any generic #32770 dialog with an OK button
|
continue
|
||||||
try:
|
# Dismiss any other dialog (OK)
|
||||||
for w in app.windows():
|
|
||||||
if w.class_name() == "#32770" and w.is_visible():
|
|
||||||
try:
|
try:
|
||||||
w.child_window(title="OK", class_name="Button").click()
|
w.child_window(title="OK", class_name="Button").click()
|
||||||
log(f" Dismissed stale dialog: {w.window_text()!r}")
|
log(f" Dismissed stale dialog: {title!r}")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@@ -300,6 +303,7 @@ def main():
|
|||||||
timeouts = {
|
timeouts = {
|
||||||
"nav": cfg.getfloat("timeouts", "nav_timeout"),
|
"nav": cfg.getfloat("timeouts", "nav_timeout"),
|
||||||
"dialog": cfg.getfloat("timeouts", "dialog_timeout"),
|
"dialog": cfg.getfloat("timeouts", "dialog_timeout"),
|
||||||
|
"select": cfg.getfloat("timeouts", "select_timeout"),
|
||||||
"progress_appear": cfg.getfloat("timeouts", "progress_appear"),
|
"progress_appear": cfg.getfloat("timeouts", "progress_appear"),
|
||||||
"progress_finish": cfg.getfloat("timeouts", "progress_finish"),
|
"progress_finish": cfg.getfloat("timeouts", "progress_finish"),
|
||||||
"settle": cfg.getfloat("timeouts", "settle"),
|
"settle": cfg.getfloat("timeouts", "settle"),
|
||||||
|
|||||||
Reference in New Issue
Block a user