move controller connect to popup dialog

This commit is contained in:
ykcheungab
2026-09-24 21:36:24 +08:00
parent 4dad413d29
commit 6effe74172
13 changed files with 773 additions and 99 deletions
+25
View File
@@ -50,6 +50,12 @@ def main() -> int:
action="store_true",
help="drive a simulated session so the shot shows live values",
)
parser.add_argument(
"--setup-dialog",
default="",
choices=("", "connection", "bus"),
help="photograph the device-setup dialog on this tab instead of the window",
)
args = parser.parse_args()
width, height = (int(part) for part in args.size.lower().split("x"))
@@ -89,6 +95,25 @@ def main() -> int:
window._on_move_abs(0, 1000.0)
_wait_for(app, lambda: window._last_snapshot.axis(0).dpos != 0, 4.0)
if args.setup_dialog:
# The dialog is a separate top-level window, so it is grabbed on its own
# rather than inside the page shot.
window._show_device_setup(args.setup_dialog) # noqa: SLF001
app.processEvents()
output = Path(args.out).resolve()
target = window.device_setup
if not target.grab().save(str(output)):
print(f"could not write {output}", file=sys.stderr)
return 1
print(
f"wrote {output} ({target.width()}x{target.height()}, theme={args.theme}, "
f"tab={args.setup_dialog})"
)
target.close()
window.close()
app.processEvents()
return 0
app.processEvents()
if args.compare: