1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

feat(core): add -r option to emu.py to allow for screen recording

[no changelog]
This commit is contained in:
grdddj 2022-10-10 10:41:35 +02:00 committed by matejcik
parent e0693d3a55
commit 0f549c02da

View File

@ -9,7 +9,7 @@ import subprocess
import sys
import tempfile
from pathlib import Path
from typing import TextIO
from typing import Optional, TextIO
import click
@ -108,6 +108,7 @@ def _from_env(name: str) -> bool:
@click.option("-p", "--profile", metavar="NAME", help="Profile name or path")
@click.option("-P", "--port", metavar="PORT", type=int, default=int(os.environ.get("TREZOR_UDP_PORT", 0)) or None, help="UDP port number")
@click.option("-q", "--quiet", is_flag=True, help="Silence emulator output")
@click.option("-r", "--record-dir", help="Directory where to record screen changes")
@click.option("-s", "--slip0014", is_flag=True, help="Initialize device with SLIP-14 seed (all all all...)")
@click.option("-t", "--temporary-profile", is_flag=True, help="Create an empty temporary profile")
@click.option("-w", "--watch", is_flag=True, help="Restart emulator if sources change")
@ -132,6 +133,7 @@ def cli(
port: int,
output: TextIO | None,
quiet: bool,
record_dir: Optional[str],
slip0014: bool,
temporary_profile: bool,
watch: bool,
@ -274,6 +276,12 @@ def cli(
label=label,
)
if record_dir:
assert emulator.client is not None
trezorlib.debuglink.record_screen(
emulator.client, record_dir, report_func=print
)
if run_command:
ret = run_command_with_emulator(emulator, command)
elif watch: