Beispiel #1
0
A nested dictionary describes a submenu.
An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc
A function name will call that function.
"""
menu = Menu(
    {
        'Clock': clock,
        'Radio Stream': Radio(),
        'Volume': Volume(backlight),
        'Status': {
            'CPU': GraphCPU(),
            'Temp': GraphTemp()
        },
        'Settings': {
            'Contrast': Contrast(lcd),
            'Backlight': Backlight(backlight)
        }
    },
    lcd,  # Draw to dot3k.lcd
    clock,  # Idle with the clock plugin,
    10  # Idle after 10 seconds
)
"""
You can use anything to control dot3k.menu,
but you'll probably want to use dot3k.touch
"""


@nav.on(nav.UP)
def handle_up(ch, evt):
Beispiel #2
0
        MenuOption.__init__(self)

class Copy(MenuOption):
    def __init__(self):
        MenuOption.__init__(self)

MyIdle = Idle()
MyState = State()
MyCopy = Copy()

# Menu argument: structure, lcd, idle_handler = None, idle_time = 60
menu = Menu(None,lcd,MyIdle,5) #30s initialy

menu.add_item('Etat',MyState)
menu.add_item('Copie',MyCopy)
menu.add_item('Options/Display/Contrast', Contrast(lcd))
menu.add_item('Options/Display/Backlight', Backlight(backlight))

# Menu Command

repeat_delay = 0.5

@nav.on(nav.UP)
def handle_up(pin):
    menu.up()
    nav.repeat(nav.UP, menu.up, repeat_delay, 0.9)

@nav.on(nav.DOWN)
def handle_down(pin):
    menu.down()
    nav.repeat(nav.DOWN, menu.down, repeat_delay, 0.9)
Beispiel #3
0
a plugin instance, plus the path where you want it to appear.

Instances of classes derived from MenuOption can
be used as menu items to show information or change settings.

See GraphTemp, GraphCPU, Contrast and Backlight for examples.
"""

menu.add_item('Space Invader', my_invader)
menu.add_item('Clock', Clock())
menu.add_item('Status/IP', IPAddress())
menu.add_item('Status/Test', '')
menu.add_item('Status/CPU', GraphCPU())
menu.add_item('Status/Arrr', 'Blah blah')
menu.add_item('Status/Temp', GraphTemp())
menu.add_item('Settings/Display/Contrast', Contrast(lcd)),
menu.add_item('Settings/Display/Backlight', Backlight(backlight))

"""
You can use anything to control dot3k.menu,
but you'll probably want to use dot3k.joystick
"""
REPEAT_DELAY = 0.5


@joystick.on(joystick.UP)
def handle_up(pin):
    menu.up()
    joystick.repeat(joystick.UP, menu.up, REPEAT_DELAY, 0.9)

Beispiel #4
0
from plugins.graph import IPAddress, GraphCPU, GraphTemp, GraphSysReboot, GraphSysShutdown
from plugins.text import Text
from plugins.utils import Contrast, Backlight

picecold = PiceCold("picecold.ini")

menu = Menu(
    structure={
        'System': {
            'Boot Options': {
                'Shutdown': GraphSysShutdown(),
                'Reboot': GraphSysReboot()
            },
            'Settings': {
                'Display': {
                    'Contrast': Contrast(picecold.lcd),
                    'Backlight': Backlight(picecold.backlight)
                }
            }
        },
        'Status': {
            'IP': IPAddress(),
            'CPU': GraphCPU(picecold.backlight),
            'Temp': GraphTemp()
        }
    },
    lcd=picecold.lcd,
    input_handler=Text())

picecold.add_to_menu(menu)