Exemple #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()
Exemple #2
0
#		menu.write_row(2,'fast: %s' % self.fastvar)

menu = Menu({
		'1': cpu_info(),
		'2': memory_info(),
		'3': disk_info(),
		'4': network_info('wlan0'),
		'5': network_speed('wlan0'),
		'6': network_info('eth0'),
		'7': network_speed('eth0'),
		},
	lcd, None, 30)

menu_display_time = 4	# in seconds
update_frequency = 5	# hz of screen update
last_cycled = 0			# force immediate update of screen menu

#try:
while True:
	if millis() > last_cycled + (menu_display_time * 1000.0):
		menu.cancel()
		menu.down()
		menu.right()
		last_cycled = millis()
	else:
		menu.redraw()
	time.sleep(1 / float(update_frequency))
#except:
#	lcd.clear()
#	backlight.rgb(0,0,0)