Skip to content

Commit

Permalink
[add] New layout 'KeyboardConfirmationButton'
Browse files Browse the repository at this point in the history
  • Loading branch information
lpascal-ledger committed Apr 4, 2024
1 parent b9dfc0d commit 47bb950
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ragger/firmware/nbgl/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 7 additions & 0 deletions src/ragger/firmware/nbgl/positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47bb950

Please sign in to comment.