コード例 #1
0
ファイル: menu.py プロジェクト: PeterCopeland/repline
    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)
コード例 #2
0
    def __init__(self):

        self.structure = {}

        with open('local.json') as f:
            self.cards = json.load(f)
            self.config = self.cards['CONFIG']

        self.cards = self.formatCards(self.cards)
        for subject in self.cards:
            for topic in self.cards[subject]:
                self.cards[subject][topic] = self.CardSession(
                    self, self.cards[subject][topic], subject + "." + topic)

        print(self.config['favorites'])
        self.structure.update({
            'Continue': {},
            'Favorites':
            self.CardSession(self, self.config['favorites'], "favorites"),
            'View All Cards':
            self.cards,
            #'Get More Cards' : self.getCards(),
            #'Save and Exit' : saveAndExit(),
            'Settings': {
                # 'Check Server': line.checkServer()
            }
        })

        self.menu = Menu(structure=self.structure, lcd=lcd, idle_timeout=30)

        self.updateLastSession(self.config['lastSession'])

        touch.bind_defaults(self.menu)
コード例 #3
0
    'Clock': Clock(backlight),
    'Status': {
        'IP': IPAddress(),
        'CPU': GraphCPU(backlight),
        'Temp': GraphTemp()
    },
    'Settings': {
        'Display': {
            'Contrast': Contrast(lcd),
            'Backlight': Backlight(backlight)
        }
    }
},
            lcd=lcd,
            idle_handler=backlight_idle,
            idle_time=5,
            input_handler=Text())

# Pass the configuration into the idle handler,
# since the menu class does not do this!
backlight_idle.setup(menu.config)
"""
You can use anything to control dot3k.menu,
but you'll probably want to use dot3k.touch
"""
nav.bind_defaults(menu)

while 1:
    menu.redraw()
    time.sleep(0.05)
コード例 #4
0
                'Power': {
                    'Restart': lambda: system_power('restart'),
                    'Shutdown': lambda: system_power('shutdown'),
                    'Display Off': IdleDisplay(backlight)
                },
                'Network': NetworkStatus(),
                'Updates': PacmanStats(),
                'Clock': SimpleClock(),
                'Settings': {
                    'Brightness': Brightness(backlight),
                    'Backlight': Backlight(backlight),
                    'Contrast': Contrast(lcd)
                },
                'Disk': DiskUsage(),
                'Status': SystemStatus(),
            },
            lcd=lcd,
            idle_handler=IdleDisplay(backlight),
            idle_time=60)

# use touch module to control menu
touch.bind_defaults(menu)

# set initial backlight brightness
# TODO work out how this is actually set on start-up
menu.menu_options['Settings']['Brightness'].set_brightness()

while DO_REDRAW:
    menu.redraw()
    time.sleep(0.05)
コード例 #5
0
ファイル: menu.py プロジェクト: akx/dot3k
    structure={
        'WiFi': Wlan(),
        'Space Invader': my_invader,
        'Clock': Clock(backlight),
        'Status': {
            'IP': IPAddress(),
            'CPU': GraphCPU(backlight),
            'Temp': GraphTemp()
        },
        'Settings': {
            'Display': {
                'Contrast': Contrast(lcd),
                'Backlight': Backlight(backlight)
            }
        }
    },
    lcd=lcd,
    idle_handler=my_invader,
    idle_timeout=30,
    input_handler=Text())

"""
You can use anything to control dot3k.menu,
but you'll probably want to use dot3k.captouch
"""
touch.bind_defaults(menu)

while 1:
    menu.redraw()
    time.sleep(0.05)
コード例 #6
-1
ファイル: quickstart.py プロジェクト: meatyblue/dot3k-gcal
def main():
    """ 
       Set up a menu with the Calendar and go straight into it.
    """

    menu = Menu(
      structure={
          'calendar': GoogleCalendar()
      },
      lcd=lcd
    )

    # Register a function to turn the lights off on script exit.
    atexit.register(cleanup)

    # Go straight into out menu plugin, making it an app in this case
    menu.right()

    # setup default menu handlers 
    touch.bind_defaults(menu)
    while 1:
        menu.redraw()
        time.sleep(0.02)