Skip to content

Commit

Permalink
[update] Most 'cancel', 'reject', ... Stax button are moved from cent…
Browse files Browse the repository at this point in the history
…er footer to left footer on Flex
  • Loading branch information
lpascal-ledger committed Apr 12, 2024
1 parent 0e6eb4f commit a3009ce
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
39 changes: 22 additions & 17 deletions src/ragger/firmware/touch/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ class FullKeyboardSpecialCharacters2(_FullKeyboardSpecialCharacters):
pass


# Center Info
class TappableCenter(Element):
class _TappableElement(Element):

def tap(self):
self.client.finger_touch(*self.positions)


# Center Info
class TappableCenter(_TappableElement):
pass


class KeyboardConfirmationButton(Element):
"""
This layout is to be used as the confirmation button when coupled with a keyboard.
Expand All @@ -98,34 +102,35 @@ def confirm(self):

# Headers
#########
class RightHeader(Element):

def tap(self):
self.client.finger_touch(*self.positions)
class RightHeader(_TappableElement):
pass


ExitHeader = RightHeader
InfoHeader = RightHeader


class LeftHeader(Element):

def tap(self):
self.client.finger_touch(*self.positions)
class LeftHeader(_TappableElement):
pass


NavigationHeader = LeftHeader


# Footers
#########
class CenteredFooter(Element):
class CenteredFooter(_TappableElement):
pass

def tap(self):
self.client.finger_touch(*self.positions)

class LeftFooter(_TappableElement):
pass


class CancelFooter(_TappableElement):
pass


CancelFooter = CenteredFooter
ExitFooter = CenteredFooter
InfoFooter = CenteredFooter
SettingsFooter = CenteredFooter
ExitFooter = CancelFooter
InfoFooter = CancelFooter
SettingsFooter = CancelFooter
15 changes: 11 additions & 4 deletions src/ragger/firmware/touch/positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def __iter__(self):
FLEX_BUTTON_UPPER_RIGHT = Position(405, 75)

STAX_BUTTON_LOWER_LEFT = Position(36, 606)
# TODO: Look for use cases / layout using this button
FLEX_BUTTON_LOWER_LEFT = Position(0, 0)
FLEX_BUTTON_LOWER_LEFT = Position(55, 530)

STAX_BUTTON_LOWER_MIDDLE = Position(200, 606)
FLEX_BUTTON_LOWER_MIDDLE = Position(240, 550)
Expand Down Expand Up @@ -385,6 +384,14 @@ def __iter__(self):
Firmware.STAX: STAX_BUTTON_LOWER_MIDDLE,
Firmware.FLEX: FLEX_BUTTON_LOWER_MIDDLE
},
"LeftFooter": {
Firmware.STAX: STAX_BUTTON_LOWER_LEFT,
Firmware.FLEX: FLEX_BUTTON_LOWER_LEFT
},
"CancelFooter": {
Firmware.STAX: STAX_BUTTON_LOWER_MIDDLE,
Firmware.FLEX: FLEX_BUTTON_LOWER_LEFT
},
"UseCaseHome": {
Firmware.STAX: {
"info": STAX_BUTTON_UPPER_RIGHT,
Expand Down Expand Up @@ -444,7 +451,7 @@ def __iter__(self):
},
Firmware.FLEX: {
"confirm": FLEX_BUTTON_ABOVE_LOWER_MIDDLE,
"reject": FLEX_BUTTON_LOWER_MIDDLE,
"reject": FLEX_BUTTON_LOWER_LEFT,
}
},
"UseCaseStatus": {
Expand Down Expand Up @@ -492,7 +499,7 @@ def __iter__(self):
"tap": FLEX_BUTTON_ABOVE_LOWER_MIDDLE,
"exit_qr": FLEX_BUTTON_LOWER_MIDDLE,
"confirm": FLEX_BUTTON_ABOVE_LOWER_MIDDLE,
"cancel": FLEX_BUTTON_LOWER_MIDDLE,
"cancel": FLEX_BUTTON_LOWER_LEFT,
}
},
}

0 comments on commit a3009ce

Please sign in to comment.