diff --git a/src/ragger/firmware/nbgl/layouts.py b/src/ragger/firmware/nbgl/layouts.py index 9217ab94..0633b4b4 100644 --- a/src/ragger/firmware/nbgl/layouts.py +++ b/src/ragger/firmware/nbgl/layouts.py @@ -84,6 +84,18 @@ def tap(self): self.client.finger_touch(*self.positions) +class KeyboardConfirmationButton(Element): + """ + This layout is to be used as the confirmation button when coupled with a keyboard. + + On Stax devices, the screen is high enoug that this is equivalent to TappableCenter, however + on Flex, this button is not centered, but slightly closer to the top of the screen. + """ + + def confirm(self): + self.client.finger_touch(*self.positions) + + # Headers ######### class RightHeader(Element): diff --git a/src/ragger/firmware/nbgl/positions.py b/src/ragger/firmware/nbgl/positions.py index c3f1703a..841a189c 100644 --- a/src/ragger/firmware/nbgl/positions.py +++ b/src/ragger/firmware/nbgl/positions.py @@ -32,6 +32,9 @@ def __iter__(self): # Flex resolution is 480x600 FLEX_CENTER = Position(240, 300) +# Used for Flex keyboard 'validation' button, which is not vertically centered, contrary to Stax +FLEX_BUTTON_UPPER_CENTER_MIDDLE = Position(240, 250) + STAX_BUTTON_UPPER_LEFT = Position(36, 36) FLEX_BUTTON_UPPER_LEFT = Position(45, 45) @@ -366,6 +369,10 @@ def __iter__(self): Firmware.STAX: STAX_CENTER, Firmware.FLEX: FLEX_CENTER, }, + "KeyboardConfirmationButton": { + Firmware.STAX: STAX_CENTER, + Firmware.FLEX: FLEX_BUTTON_UPPER_CENTER_MIDDLE, + }, "RightHeader": { Firmware.STAX: STAX_BUTTON_UPPER_RIGHT, Firmware.FLEX: FLEX_BUTTON_UPPER_RIGHT