lcd, my_invader, 5) """ If you want menu items to appear in a defined order, you must add them one at a time using 'add_item'. This method accepts 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
__copyright__ = "Copyright 2017 rGunti" __credits__ = [] __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Raphael \"rGunti\" Guntersweiler" __email__ = "*****@*****.**" __status__ = "Development" """ :param String s """ if __name__ == '__main__': # code to execute if called from command-line menu = Menu(lcd=lcd) menu.add_item('Player', MPDPlayer()) if not DONT_USE_WIFI: menu.add_item('WiFi', WiFiApp()) menu.select() if USE_DOTHAT: nav.enable_repeat(True) nav.bind_defaults(menu) else: @nav.on(nav.UP) def handle_up(pin): menu.up() @nav.on(nav.DOWN) def handle_down(pin):
dotc += 1 lcd.set_cursor_position(6,2) for i in range(dotc / 10): lcd.write(".") lcd.clear() def shutdown_animation(): lcd.set_cursor_position(3,1) lcd.write("Bye (^_^)/") for x in reversed(range(127)): backlight.rgb(x, x * 2, x) lcd.clear() menu = Menu({}, lcd, 30) Menu.add_item(menu, 'Music Player', MusicPlayer()) Menu.add_item(menu, 'Clock', Clock()) # System # System/Networking Menu.add_item(menu, 'Networking/System/Show IPs', IPViewer()) Menu.add_item(menu, 'Networking/System/Scan WiFi', WiFiScan()) Menu.add_item(menu, 'Networking/System/WiFi Hotspot', WiFiHotspot()) # System/CPU Menu.add_item(menu, 'CPU/System/Usage', GraphCPU()) Menu.add_item(menu, 'CPU/System/Temprature', GraphTemp()) # System/Shutdown Menu.add_item(menu, 'Shutdown/System/Reboot', Reboot()) Menu.add_item(menu, 'Shutdown/System/Shutdown', Shutdown())
class State(MenuOption): def __init__(self): 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):