Skip to content
Snippets Groups Projects
Commit d1cd9ce1 authored by Pixtxa's avatar Pixtxa
Browse files

Try loading default values from config

parent 7be1aded
Branches
No related tags found
No related merge requests found
...@@ -6,9 +6,22 @@ import time ...@@ -6,9 +6,22 @@ import time
import config import config
TIMEOUT = 0x100 TIMEOUT = 0x100
LONG_PRESS_MS = 1000
RETRIGGER_MS = 250
try:
LONG_PRESS_MS = int(config.get_string("long_press_ms"))
except OSError:
pass
try:
RETRIGGER_MS = int(config.get_string("retrigger_ms"))
except OSError:
pass
""":py:func:`~simple_menu.button_events` timeout marker.""" """:py:func:`~simple_menu.button_events` timeout marker."""
def button_events(timeout=None, long_press_ms = 1000, retrigger_ms = 250): def button_events(timeout=None, long_press_ms = LONG_PRESS_MS, retrigger_ms = RETRIGGER_MS):
""" """
Iterate over button presses (event-loop). Iterate over button presses (event-loop).
...@@ -316,7 +329,7 @@ class Menu: ...@@ -316,7 +329,7 @@ class Menu:
self.disp.update() self.disp.update()
def run(self, long_press_ms = 1000, retrigger_ms = 250): def run(self, long_press_ms = LONG_PRESS_MS, retrigger_ms = RETRIGGER_MS):
"""Start the event-loop.""" """Start the event-loop."""
try: try:
timeout = self.scroll_speed timeout = self.scroll_speed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment