Skip to content

Commit

Permalink
Make B flip apps that don't support rotate
Browse files Browse the repository at this point in the history
ie button_b now always has a default action, if not overridden by the
app.
  • Loading branch information
tomsci committed May 16, 2022
1 parent 39b522e commit 295d216
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def on_start(self):
self.buttons.on_press(tidal.BUTTON_FRONT, self.navigate_back)
if self.supports_rotation():
self.buttons.on_press(tidal.BUTTON_B, self.rotate)

else:
self.buttons.on_press(tidal.BUTTON_B, self.flip)

# Note: we don't actually stop apps yet...
# def on_stop(self):
Expand Down Expand Up @@ -148,6 +149,10 @@ def set_rotation(self, rotation, redraw=True):
def rotate(self):
self.set_rotation((self.get_rotation() + 90) % 360)

def flip(self):
self.set_rotation((self.get_rotation() + 180) % 360)


class ButtonOnlyWindow:
"""This class only exists to wrap a Buttons instance for any App which doesn't actually use a Window for drawing
(and presumably draws directly to the display in its on_activate)
Expand Down

0 comments on commit 295d216

Please sign in to comment.