Exemplo n.º 1
0
class MainMenu():
    controller = None

    def __init__(self, repline, controller):
        self.repline = repline
        self.controller = controller

        self.menu = Menu(
            structure={
                'Record': self.record,
                'Settings': {
                    'Recording': {
                        'Normalisation': Normalisation(repline)
                    },
                    'Track detection': {
                        SilenceThreshold.title: SilenceThreshold(repline),
                        MinSilenceLength.title: MinSilenceLength(repline)
                    },
                    'Encoding': {
                        OutputFormat.title:
                        OutputFormat(repline),
                        get_quality_setting(repline).title:
                        get_quality_setting(repline)
                    },
                    # 'Saving': {
                    # },
                    'Hardware': {
                        SetInputDevice.title: SetInputDevice(repline),
                        SetOutputDevice.title: SetOutputDevice(repline),
                    }
                }
            },
            lcd=lcd)
        nav.bind_defaults(self.menu)

    def on_active(self):
        pass

    def redraw(self):
        self.menu.redraw()

    def record(self):
        self.controller.open_record_ui()

    def handle_up(self, ch, evt):
        self.menu.up()

    def handle_down(self, ch, evt):
        self.menu.down()

    def handle_left(self, ch, evt):
        self.menu.left()

    def handle_right(self, ch, evt):
        self.menu.right()

    def handle_select(self, ch, evt):
        self.menu.select()

    def handle_cancel(self, ch, evt):
        self.menu.cancel()
Exemplo n.º 2
0
__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):
            menu.down()

        @nav.on(nav.LEFT)