diff --git a/pycardium/modules/py/simple_menu.py b/pycardium/modules/py/simple_menu.py index b503569dc8929e294079b4975c98502f98c42de0..94cfb63711fbe01db4d42020310b8ca55cc01c28 100644 --- a/pycardium/modules/py/simple_menu.py +++ b/pycardium/modules/py/simple_menu.py @@ -21,7 +21,7 @@ except OSError: """:py:func:`~simple_menu.button_events` timeout marker.""" -def button_events(timeout=None, long_press_ms = LONG_PRESS_MS, retrigger_ms = RETRIGGER_MS): +def button_events(timeout=None, long_press_ms=LONG_PRESS_MS, retrigger_ms=RETRIGGER_MS): """ Iterate over button presses (event-loop). @@ -89,13 +89,16 @@ def button_events(timeout=None, long_press_ms = LONG_PRESS_MS, retrigger_ms = RE if v & buttons.TOP_RIGHT: yield buttons.TOP_RIGHT - if not still_pressed and long_press_ms and time.time_ms() - t0 <= long_press_ms: + if ( + not still_pressed + and long_press_ms + and time.time_ms() - t0 <= long_press_ms: + ): pass else: if retrigger_ms and time.time_ms() - t0 > retrigger_ms: button_pressed = False still_pressed = True - class _ExitMenuException(Exception): @@ -332,7 +335,7 @@ class Menu: self.disp.update() - def run(self, long_press_ms = LONG_PRESS_MS, retrigger_ms = RETRIGGER_MS): + def run(self, long_press_ms=LONG_PRESS_MS, retrigger_ms=RETRIGGER_MS): """Start the event-loop.""" try: timeout = self.scroll_speed