|
@@ -169,13 +169,14 @@ def x_grab_key(grab_window, keycode, modifiers=None):
|
|
|
)
|
|
|
|
|
|
|
|
|
-def wait_for_engine_window(xdisplay, engine_process):
|
|
|
- while engine_process.poll() is None: # TODO add timeout
|
|
|
+def wait_for_engine_window(xdisplay, engine_process, timeout_seconds=20, search_interval_seconds=2):
|
|
|
+ start_epoch = time.time()
|
|
|
+ while engine_process.poll() is None and (time.time() - start_epoch) <= timeout_seconds:
|
|
|
windows = x_find_window_by_pid(xdisplay, engine_process.pid)
|
|
|
assert len(windows) <= 1
|
|
|
if len(windows) == 1:
|
|
|
return windows[0]
|
|
|
- time.sleep(2)
|
|
|
+ time.sleep(search_interval_seconds)
|
|
|
return None
|
|
|
|
|
|
|