Пример #1
0
    def execute(self, *_):
        '''Tells the Menu to go to main'''
        with open('configuration/settings.json','r') as settings:
        	data = json.load(settings)

        elements = [MenuElement(data['options'][s]['description'], 'Configure', alt=str(data['options'][s]['value'])) for s in data['options']]

        options_state = State("Options Menu", "Options", elements)
        options_state.id = 'options'
        return ('PushState', {"state": options_state})
Пример #2
0
    def execute(self, args):
        '''Gets the list of nids in the playlist, then loads information'''
        # ensures that data is accurate
        if not set([a for a in args]).issuperset(['id', 'name']):
            return

        elements = [
            MenuElement('Queue', command='Queue'),
            MenuElement('Library', command='AddToLibrary'),
            MenuElement('Playlist', command='AddToPlaylistPrompt')]

        for e in elements:
            e.id = args['id']

        state = State("Add {0} to...".format(args['name']), "Options", elements)
        state.id = 'addto'

        return ('PushState', {'state': state})
Пример #3
0
    def main_menu(self):
        '''Set everything necessary for the main menu'''
        if len(self.states) == 0:
            elements = [
                MenuElement('View Suggested Songs', command='Suggested'),
                MenuElement('View Recently Added Songs', command='RecentlyAdded'),
                MenuElement('Browse Albums', command='Album'),
                MenuElement('Browse Artists', command='Artist'),
                MenuElement('Browse Playlists', command='Playlist'),
                MenuElement('Browse Radios', command='Radio'),
                MenuElement('Browse Songs', command='Song'),
                MenuElement('Connect to DJs', command='Main'),
                MenuElement('Options', command='Options'),
                MenuElement('Exit', command='Exit')]

            main_state = State("Main Menu", "Options", elements)
            main_state.id = 'main'

            self.push_state(main_state)
            return

        # Delete all other states
        self.states[1:] = []
        self.assign_state(self.states[0])