mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 06:18:07 +00:00
feat(python): pass whole ButtonRequest to button_request UI handler
This commit is contained in:
parent
ea2a9375ac
commit
4f0aca7bb5
2
python/.changelog.d/1671.incompatible
Normal file
2
python/.changelog.d/1671.incompatible
Normal file
@ -0,0 +1,2 @@
|
||||
The type of argument to `ui.button_request(x)` is changed from int to ButtonRequest.
|
||||
The original int value can be accessed as `x.code`
|
@ -209,7 +209,7 @@ class TrezorClient:
|
||||
__tracebackhide__ = True # for pytest # pylint: disable=W0612
|
||||
# do this raw - send ButtonAck first, notify UI later
|
||||
self._raw_write(messages.ButtonAck())
|
||||
self.ui.button_request(msg.code)
|
||||
self.ui.button_request(msg)
|
||||
return self._raw_read()
|
||||
|
||||
@tools.session
|
||||
|
@ -230,9 +230,9 @@ class DebugUI:
|
||||
self.passphrase = ""
|
||||
self.input_flow = None
|
||||
|
||||
def button_request(self, code):
|
||||
def button_request(self, br):
|
||||
if self.input_flow is None:
|
||||
if code == messages.ButtonRequestType.PinEntry:
|
||||
if br.code == messages.ButtonRequestType.PinEntry:
|
||||
self.debuglink.input(self.get_pin())
|
||||
else:
|
||||
self.debuglink.press_yes()
|
||||
@ -240,7 +240,7 @@ class DebugUI:
|
||||
raise AssertionError("input flow ended prematurely")
|
||||
else:
|
||||
try:
|
||||
self.input_flow.send(code)
|
||||
self.input_flow.send(br)
|
||||
except StopIteration:
|
||||
self.input_flow = self.INPUT_FLOW_DONE
|
||||
|
||||
|
@ -68,7 +68,7 @@ class ClickUI:
|
||||
self.always_prompt = always_prompt
|
||||
self.passphrase_on_host = passphrase_on_host
|
||||
|
||||
def button_request(self, code):
|
||||
def button_request(self, _br):
|
||||
if not self.prompt_shown:
|
||||
echo("Please confirm action on your Trezor device.")
|
||||
if not self.always_prompt:
|
||||
|
Loading…
Reference in New Issue
Block a user