Skip to content
Snippets Groups Projects

Simple Menu

Merged Pixtxa requested to merge (removed):Pixtxa-master-patch-27969 into master
@@ -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):
@@ -222,6 +225,9 @@ class Menu:
right_scroll_str = config.get_string("right_scroll")
if right_scroll_str.lower() in ["true", "1"]:
right_buttons_scroll = True
if right_scroll_str.lower() in ["false", "0"]:
right_buttons_scroll = False
except OSError:
right_buttons_scroll = self.right_buttons_scroll
@@ -329,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
Loading