Commit 580fa3fe authored by Philip Stewart's avatar Philip Stewart Committed by Øyvind Kolås
Browse files

feat(simple_menu): Make scroll buttons configurable

parent 24f5c885
...@@ -48,4 +48,6 @@ Option name Type Description ...@@ -48,4 +48,6 @@ Option name Type Description
``ble_mac`` Boolean MAC address used for BLE. Format: ``ca:4d:10:xx:xx:xx``. ``ble_mac`` Boolean MAC address used for BLE. Format: ``ca:4d:10:xx:xx:xx``.
------------------ ---------- ----------- ------------------ ---------- -----------
``ble_log_enable`` Boolean Activate HCI level logging of BLE data. Creates a new btsnoop compatible log file named ``ble.log`` in the ``logs`` folder after each boot if BLE is activated. Keeps the last 10 files. ``ble_log_enable`` Boolean Activate HCI level logging of BLE data. Creates a new btsnoop compatible log file named ``ble.log`` in the ``logs`` folder after each boot if BLE is activated. Keeps the last 10 files.
------------------ ---------- -----------
``right_scroll`` Boolean Use both right buttons to scroll up and down. Lower left button is SELECT.
================== ========== =========== ================== ========== ===========
...@@ -3,6 +3,7 @@ import color ...@@ -3,6 +3,7 @@ import color
import display import display
import sys import sys
import time import time
import config
TIMEOUT = 0x100 TIMEOUT = 0x100
""":py:func:`~simple_menu.button_events` timeout marker.""" """:py:func:`~simple_menu.button_events` timeout marker."""
...@@ -193,11 +194,18 @@ class Menu: ...@@ -193,11 +194,18 @@ class Menu:
self.idx = 0 self.idx = 0
self.select_time = time.time_ms() self.select_time = time.time_ms()
self.disp = display.open() self.disp = display.open()
try:
right_scroll_str = config.get_string("right_scroll")
if right_scroll_str.lower() in ["true", "1"]:
right_buttons_scroll = True
except OSError:
right_buttons_scroll = self.right_buttons_scroll
self.button_scroll_up = ( self.button_scroll_up = (
buttons.TOP_RIGHT if self.right_buttons_scroll else buttons.BOTTOM_LEFT buttons.TOP_RIGHT if right_buttons_scroll else buttons.BOTTOM_LEFT
) )
self.button_select = ( self.button_select = (
buttons.BOTTOM_LEFT if self.right_buttons_scroll else buttons.TOP_RIGHT buttons.BOTTOM_LEFT if right_buttons_scroll else buttons.TOP_RIGHT
) )
def entry2name(self, value): def entry2name(self, value):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment