Beispiel #1
0
 def back(self):
     self.current_menu.remove_observer(self)
     if self.current_menu.previous is None:  #Already on the Root level
         self.current_menu = MenuScreen(previous=None, menulist=mainmenu)
     else:
         self.current_menu = self.current_menu.previous
     self.current_menu.add_observer(self)
     self.redraw()
Beispiel #2
0
    def build(self):
        # Gather the config file options
        self.config = configparser.ConfigParser()
        self.config.read('../config.ini')

        # Create the screen manager
        sm = ScreenManager()
        sm.add_widget(MenuScreen(config=self.config, name='Menu'))
        sm.add_widget(HelpScreen(config=self.config, name='Help'))
        sm.add_widget(SettingsScreen(config=self.config, name='Settings'))
        sm.add_widget(NewProjectScreen(name='NewProjectDecide'))
        sm.add_widget(ExistingProjectScreen(name='ExistingProject'))
        sm.current = 'Menu'
        return sm
Beispiel #3
0
    def build(self):
        self.title = 'PocketCosmos'
        self.calc_iconsize()
        self.settings = ConfigController('settings.json')

        self.sound_manager = SoundManager(settings=self.settings)

        self.logic = Logic(settings=self.settings,
                           sound_manager=self.sound_manager)

        self.screenmanager = ScreenManager()

        self.mainscreen = MainScreen(logic=self.logic,
                                     iconsize=self.iconsize,
                                     iconratio_x=self.iconratio_x,
                                     iconratio_y=self.iconratio_y,
                                     name='main')

        # MenuScreen does not need logic
        self.menuscreen = MenuScreen(name='menu')

        self.settingsscreen = SettingsScreen(logic=self.logic,
                                             iconsize=self.iconsize,
                                             iconratio_x=self.iconratio_x,
                                             iconratio_y=self.iconratio_y,
                                             name='settings')

        self.savegamescreen = SavegameScreen(logic=self.logic,
                                             iconsize=self.iconsize,
                                             iconratio_x=self.iconratio_x,
                                             iconratio_y=self.iconratio_y,
                                             name='savegames')

        self.creditsscreen = CreditsScreen(iconsize=self.iconsize,
                                           name='credits')

        # order adding here reflects which screen is shown first!
        self.screenmanager.add_widget(self.menuscreen)
        self.screenmanager.add_widget(self.mainscreen)
        self.screenmanager.add_widget(self.settingsscreen)
        self.screenmanager.add_widget(self.savegamescreen)
        self.screenmanager.add_widget(self.creditsscreen)

        self.logic.apply_settings()

        return self.screenmanager
Beispiel #4
0
    def __init__(self, lcd, menu_prefix='> ', menu_selected='* '):
        """Initialize hardware."""

        # LCD instance
        self.lcd = lcd

        self.current_menu = MenuScreen(previous=None, menulist=mainmenu)
        self.current_menu.add_observer(self)

        # Position in menu
        self.menu_prefix = menu_prefix
        self.menu_selected = menu_selected
        #self._menu_pos = 0

        # Loading animation
        self.welcome()

        # Load menu
        self.redraw()
Beispiel #5
0
 def menu_screen_setup(self):  ########### Screen 3 ##########
     self.menu_scr = MenuScreen()
     self.sm.add_widget(self.menu_scr)
Beispiel #6
0
 def __init__(self):
     MenuScreen.__init__(self, "Storage Pool Administration")
Beispiel #7
0
 def __init__(self):
     MenuScreen.__init__(self, "Storage Pool Administration")
Beispiel #8
0
 def __init__(self):
     MenuScreen.__init__(self, "Host Menu Screen")
Beispiel #9
0
 def __init__(self):
     MenuScreen.__init__(self, "Node Administration")
Beispiel #10
0
 def __init__(self):
     MenuScreen.__init__(self, "Node Administration")
Beispiel #11
0
 def __init__(self):
     MenuScreen.__init__(self, "Network Administration")
Beispiel #12
0
 def __init__(self):
     MenuScreen.__init__(self, "Network Administration")
Beispiel #13
0
 def __init__(self):
     MenuScreen.__init__(self, "Main Menu")
 def start(self):
     if not self.manager.has_screen('MenuScreen'):
         from menuscreen import MenuScreen
         self.manager.add_widget(MenuScreen())
     self.manager.current = 'MenuScreen'
Beispiel #15
0
class Player(object):
    def __init__(self, lcd, menu_prefix='> ', menu_selected='* '):
        """Initialize hardware."""

        # LCD instance
        self.lcd = lcd

        self.current_menu = MenuScreen(previous=None, menulist=mainmenu)
        self.current_menu.add_observer(self)

        # Position in menu
        self.menu_prefix = menu_prefix
        self.menu_selected = menu_selected
        #self._menu_pos = 0

        # Loading animation
        self.welcome()

        # Load menu
        self.redraw()

    def welcome(self):
        """Draw a loading screen."""
        lcd.clear()
        lcd.write_string('Welcome to\n\rRaspberry Pi Radio!')
        lcd.cursor_pos = (3, 0)
        lcd.write(0)
        lcd.write(0)
        time.sleep(0.5)
        for i in xrange(2, 20, 2):
            lcd.write(0)
            lcd.write(0)
            time.sleep(0.1)

    def update(self):
        self.redraw()

    def load_menu(self, menu):
        self.lcd.clear()
        self.current_menu.menulist = menu
        items = menu[:4]
        for i, (label, func, menulist) in enumerate(items):
            if i == self.current_menu.menu_pos:
                line = self.menu_selected + label
            else:
                line = self.menu_prefix + label
            self.lcd.write_string(line[:settings.LCD_COLS] + '\n\r')

    def redraw(self):
        self.load_menu(self.current_menu.menulist)

    def run_action(self):
        item = self.current_menu.menulist[self.current_menu.menu_pos]

        function = item[-2]
        function(self.lcd)
        new_menu = item[-1]
        if new_menu is not None:  # If a MenuScreen is registered
            self.current_menu.remove_observer(self)
            new_menu.previous = self.current_menu
            self.current_menu = item[-1]
            self.current_menu.add_observer(self)

        #Update Screen with submenu
        self.redraw()

    def scroll_up(self):
        self.current_menu.menu_pos -= 1

    def scroll_down(self):
        self.current_menu.menu_pos += 1

    def back(self):
        self.current_menu.remove_observer(self)
        if self.current_menu.previous is None:  #Already on the Root level
            self.current_menu = MenuScreen(previous=None, menulist=mainmenu)
        else:
            self.current_menu = self.current_menu.previous
        self.current_menu.add_observer(self)
        self.redraw()
Beispiel #16
0
 def __init__(self):
     MenuScreen.__init__(self, "Host Menu Screen")