删掉回放的五个转发、重复的空格快捷键与重复的等待循环。
回放调用点直接走 replay_ctl,场景工具的路径引导收敛到 _paths,panel_snapshot 复用 panel_check 的 _wait_for,report_from 收成模块私有的 _report_from。
This commit is contained in:
@@ -15,6 +15,12 @@ import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# The wait loop lives with the checker; this tool used to carry its own copy.
|
||||
if str(Path(__file__).resolve().parent) not in sys.path:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
from panel_check import _wait_for # noqa: E402
|
||||
|
||||
APP_ROOT = Path(__file__).resolve().parents[1]
|
||||
for path in (APP_ROOT / "src", APP_ROOT.parents[1] / "shared" / "src"):
|
||||
if str(path) not in sys.path:
|
||||
@@ -151,17 +157,5 @@ def _render_every_tab(window, app, args, width: int, height: int) -> int:
|
||||
return 1 if failures else 0
|
||||
|
||||
|
||||
def _wait_for(app, predicate, timeout: float) -> bool:
|
||||
import time
|
||||
|
||||
deadline = time.monotonic() + timeout
|
||||
while time.monotonic() < deadline:
|
||||
app.processEvents()
|
||||
if predicate():
|
||||
return True
|
||||
time.sleep(0.02)
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
||||
Reference in New Issue
Block a user