コード例 #1
0
    def init(self):
        self.add(VBox())

        coverflow_data = []
        #create a level image for every directory in the level directory.
        files = os.listdir(os.path.join( CONFIG.system_path, 'levels'))
        files.sort()

        for f in files:
            try:
                if 'level.xml' in os.listdir(
                        os.path.join(CONFIG.system_path, "levels", f)):
                    coverflow_data.append([])
                    coverflow_data[-1].append(f)
                    coverflow_data[-1].append(
                            join(
                                CONFIG.system_path,
                                "levels", f, "screenshot.png"))
            except:
                logging.debug(str(f) +" is not a valid level.")

        self.coverflow = Coverflow(coverflow_data)
        self.widget.add(self.coverflow, size=(800, 275))
        self.widget.add(Button(_('Go !')), margin_left=290)
        self.widget.add(
                Button(_('Back')),
                size=(150, 40),
                margin_left=20,
                margin=20)
コード例 #2
0
    def init(self):
        self.game_data = {}
        self.game_data['character_file'] = []

        #I18N: The title of the screen where players can choose their character.
        self.name = _("characters")

        #create a character file to have the [?] image
        self.game_data['character_file'].append(join('characters', 'none'))
        self.character = []
        #I18N: in the character screen, to select no character for this player
        #I18N: (with the [?] icon)
        self.character.append(_("None"))
        #create a character for every directory in the characters directory.
        files = os.listdir(join(CONFIG.system_path, 'characters'))
        files.sort()

        for f in files:
            try:
                if f != "none":
                    self.game_data['character_file'].append(join(
                        "characters",
                        f))

                    self.character.append(entity_skin.EntitySkin(
                                    join('characters', f)).name)
            except OSError, e:
                if e.errno is 20:
                    pass
                else:
                    raise
            except IOError, e:
                pass
コード例 #3
0
    def init(self):
        self.game_data = {}
        self.game_data['character_file'] = []

        #I18N: The title of the screen where players can choose their character.
        self.name = _("characters")

        #create a character file to have the [?] image
        self.game_data['character_file'].append(join('characters', 'none'))
        self.character = []
        #I18N: in the character screen, to select no character for this player
        #I18N: (with the [?] icon)
        self.character.append(_("None"))
        #create a character for every directory in the characters directory.
        files = os.listdir(join(CONFIG.system_path, 'characters'))
        files.sort()

        for f in files:
            try:
                if f != "none":
                    self.game_data['character_file'].append(
                        join("characters", f))

                    self.character.append(
                        entity_skin.EntitySkin(join('characters', f)).name)
            except OSError, e:
                if e.errno is 20:
                    pass
                else:
                    raise
            except IOError, e:
                pass
コード例 #4
0
    def init(self):
        self.add(VBox())

        coverflow_data = []
        #create a level image for every directory in the level directory.
        files = os.listdir(os.path.join(CONFIG.system_path, 'levels'))
        files.sort()

        for f in files:
            try:
                if 'level.xml' in os.listdir(
                        os.path.join(CONFIG.system_path, "levels", f)):
                    coverflow_data.append([])
                    coverflow_data[-1].append(f)
                    coverflow_data[-1].append(
                        join(CONFIG.system_path, "levels", f,
                             "screenshot.png"))
            except:
                logging.debug(str(f) + " is not a valid level.")

        self.coverflow = Coverflow(coverflow_data)
        self.widget.add(self.coverflow, size=(800, 275))
        self.widget.add(Button(_('Go !')), margin_left=290)
        self.widget.add(Button(_('Back')),
                        size=(150, 40),
                        margin_left=20,
                        margin=20)
コード例 #5
0
    def init(self):
        self.name = "ultimate smash friends"
        self.add(VBox())

        self.widget.add(Button(_('Host game')))
        self.widget.add(Button(_('Join game')))
        self.widget.add(Button(_('Back')), margin=30)
コード例 #6
0
    def display_game_state(self):
        """
        Display whether the game is ended by a win or a draw, does nothing if the
        game is still running
        """

        alive_players = filter(Entity.alive, self.players)

        if len(alive_players) == 1:
            self.screen.blit(
                    loaders.text(
                        alive_players[0].name.capitalize() + _(" WON!"),
                        fonts["bold"][15], 0, 0, 0),
                    (self.size[0] / 2, self.size[1] / 2))

        elif len(alive_players) == 0:
            self.screen.blit(GAME_FONT.render(
                _("OOPS... DRAW!!!"),
                True,
                pygame.color.Color("#" +
                    str(math.sin(self.ending / 10))[3:5] +
                    "50" +
                    str(math.sin(self.ending / 10))[3:5] +
                    "30")),
                (self.size[0] / 2, self.size[1] / 2))
コード例 #7
0
    def init(self):
        self.name = "ultimate smash friends"
        self.add(VBox())

        self.widget.add(Button(_('Host game')))
        self.widget.add(Button(_('Join game')))
        self.widget.add(Button(_('Back')), margin=30)
コード例 #8
0
 def callback(self, action):
     if action.text == _('Host game'):
         # TODO here we should start a server protocol
         return {'goto': 'network_game_conf_screen'}
     if action.text == _('Join game'):
         return {'goto': 'network_join'}
     if action.text == _('Back'):
         return {'goto': 'back'}
コード例 #9
0
 def callback(self, action):
     if action.text == _('Host game'):
         # TODO here we should start a server protocol
         return {'goto': 'network_game_conf_screen'}
     if action.text == _('Join game'):
         return {'goto': 'network_join'}
     if action.text == _('Back'):
         return {'goto': 'back'}
コード例 #10
0
 def callback(self, action):
     if action.text == _('Audio'):
         return {'goto': 'sound'}
     if action.text == _('Display'):
         return {'goto': 'display'}
     if action.text == _('Keyboard'):
         return {'goto': 'keyboard'}
     if action.text == _('Back'):
         return {'goto': 'back'}
コード例 #11
0
    def init(self):
        self.name = "ultimate smash friends"
        self.add(VBox())

        self.widget.add(Label('Address of server:'))
        self.ip = TextEntry('X.X.X.X')
        self.widget.add(self.ip)
        self.widget.add(Button(_('Join game')))
        self.widget.add(Button(_('Back')), margin=30)
コード例 #12
0
    def init(self):
        self.name = (_("about"))
        self.add(VBox())

        self.widget.add(Paragraph('CREDITS'),
                        size=(490 * CONFIG.general.WIDTH / 800,
                              300 * CONFIG.general.HEIGHT / 600))

        self.widget.add(Button(_('Back')), margin=55)
コード例 #13
0
    def init(self):
        self.name = "ultimate smash friends"
        self.add(VBox())

        self.widget.add(Button(_('Local Game')))
        self.widget.add(Button(_('Network Game')))
        self.widget.add(Button(_('Configure')))
        self.widget.add(Button(_('Credits')))
        self.widget.add(Button(_('Quit')))
コード例 #14
0
    def init(self):
        self.name = "ultimate smash friends"
        self.add(VBox())

        self.widget.add(Button(_('Local Game')))
        self.widget.add(Button(_('Network Game')))
        self.widget.add(Button(_('Configure')))
        self.widget.add(Button(_('Credits')))
        self.widget.add(Button(_('Quit')))
コード例 #15
0
    def init(self):
        self.name = _("about")
        self.add(VBox())

        self.widget.add(
            Paragraph("CREDITS"), size=(490 * CONFIG.general.WIDTH / 800, 300 * CONFIG.general.HEIGHT / 600)
        )

        self.widget.add(Button(_("Back")), margin=55)
コード例 #16
0
 def callback(self, action):
     if action.text == _('Audio'):
         return {'goto': 'sound'}
     if action.text == _('Display'):
         return {'goto': 'display'}
     if action.text == _('Keyboard'):
         return {'goto': 'keyboard'}
     if action.text == _('Back'):
         return {'goto': 'back'}
コード例 #17
0
    def callback(self, action):
        if action.text == _('Join game'):
            # TODO: disable button

            # TODO: start a connection attempt at self.ip

            # if succeed, go to shared conf screen
            return {'goto': 'network_game_conf_screen'}

        if action.text == _('Back'):
            return {'goto': 'back'}
コード例 #18
0
 def callback(self, action):
     if action.text == _('Local Game'):
         return {'goto': 'characters'}
     if action.text == _('Network Game'):
         return {'goto': 'network'}
     if action.text == _('Configure'):
         return {'goto': 'configure'}
     if action.text == _('Credits'):
         return {'goto': 'about'}
     if action.text == _('Quit'):
         pygame.event.post(pygame.event.Event(pygame.QUIT))
コード例 #19
0
 def callback(self, action):
     if action.text == _('Local Game'):
         return {'goto': 'characters'}
     if action.text == _('Network Game'):
         return {'goto': 'network'}
     if action.text == _('Configure'):
         return {'goto': 'configure'}
     if action.text == _('Credits'):
         return {'goto': 'about'}
     if action.text == _('Quit'):
         pygame.event.post( pygame.event.Event(pygame.QUIT) )
コード例 #20
0
    def init(self):
        self.add(VBox())
        self.name = _("configure")

        #I18N:option screen
        self.widget.add(Button(_('Audio')))

        self.widget.add(Button(_('Display')))

        self.widget.add(Button(_('Keyboard')))

        self.widget.add(Button(_('Back')), margin=100)
コード例 #21
0
    def init(self):
        self.add(VBox())
        self.name = _("configure")

        #I18N:option screen
        self.widget.add(Button(_('Audio')))

        self.widget.add(Button(_('Display')))

        self.widget.add(Button(_('Keyboard')))

        self.widget.add(Button(_('Back')), margin=100)
コード例 #22
0
 def callback(self, action):
     if action.text == 'Resume':
         return {'game': 'continue'}
     if action.text == 'Quit the game':
         return {'game': 'stop'}
     if action.text == _('Configure'):
         return {'goto': 'configure'}
コード例 #23
0
 def callback(self, action):
     if action.text == 'Resume':
         return {'game': 'continue'}
     if action.text == 'Quit the game':
         return {'game': 'stop'}
     if action.text == _('Configure'):
         return {'goto': 'configure'}
コード例 #24
0
ファイル: gui.py プロジェクト: ntduffy/ultimate-smash-friends
    def update_youhere(self):
        screen_list = ""
        for scr in self.screen_history:
            screen_list += scr + "/"

        screen_list += self.current_screen + "/"
        self.here = loaders.text("> " + _("you are here:") + screen_list,
                                 fonts['mono']['30'])
コード例 #25
0
    def callback(self, action):
        if hasattr(action, 'letter'):
            setattr(CONFIG.keyboard, action.get_id(), action.get_value())

        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
コード例 #26
0
    def update_youhere(self):
        screen_list = ""
        for scr in self.screen_history:
            screen_list += scr + "/"

        screen_list += self.current_screen + "/"
        self.here = loaders.text("> " + _("you are here:") + screen_list,
            fonts['mono']['30'])
コード例 #27
0
    def callback(self, action):
        if action is self.player_spinner:
            #get the index of the player
            player_number = self.player_spinner.index(action)

            self.players[player_number] = action.get_index()
            #change the portrait
            self.portraits[player_number].setImage(
                join(self.game_data['character_file'][action.get_index()],
                     "portrait.png"))

        if action.text == _("Start"):
            i = 0
            for player in self.players:
                if player != 0:
                    i += 1
            if i > 1:
                return {'goto': 'level'}

        if action.text == _('Back'):
            return {'goto': 'back'}
コード例 #28
0
    def init(self):
        self.add(VBox())
        self.name = _("Display Options")
        modes = []
        for resolution in pygame.display.list_modes():
            if resolution[0] >= 800:
                modes.append(str(resolution[0]) + "x" + str(resolution[1]))
        modes.reverse()
        self.resolution = Spinner(modes, 170)
        self.resolution.set_value(str(CONFIG.general.WIDTH) + 'x'
                                    + str(CONFIG.general.HEIGHT))

        self.widget.add(Label(_('Screen resolution (requires a restart):')))
        self.widget.add(self.resolution)

        self.fullscreen = TextCheckBox(_('Fullscreen:'))

        self.fullscreen.set_value(CONFIG.display.FULLSCREEN)
        self.widget.add(self.fullscreen)
        self.widget.add(Label(_('Zoom sharpness:')), margin=25)
        zoom = Slider('zoom_sharpness')
        self.widget.add(zoom, margin=10, size=(220, 30))
        zoom.set_value(CONFIG.general.ZOOM_SHARPNESS/5)

        self.fps = TextCheckBox(_('Show FPS:'))

        self.fps.set_value(CONFIG.display.SHOW_FPS)
        self.widget.add(self.fps, margin=25)

        self.widget.add(Button(_('Back')), margin=30)
コード例 #29
0
    def init(self):
        self.add(VBox())
        self.name = _("Display Options")
        modes = []
        for resolution in pygame.display.list_modes():
            if resolution[0] >= 800:
                modes.append(str(resolution[0]) + "x" + str(resolution[1]))
        modes.reverse()
        self.resolution = Spinner(modes, 170)
        self.resolution.set_value(
            str(CONFIG.general.WIDTH) + 'x' + str(CONFIG.general.HEIGHT))

        self.widget.add(Label(_('Screen resolution (requires a restart):')))
        self.widget.add(self.resolution)

        self.fullscreen = TextCheckBox(_('Fullscreen:'))

        self.fullscreen.set_value(CONFIG.display.FULLSCREEN)
        self.widget.add(self.fullscreen)
        self.widget.add(Label(_('Zoom sharpness:')), margin=25)
        zoom = Slider('zoom_sharpness')
        self.widget.add(zoom, margin=10, size=(220, 30))
        zoom.set_value(CONFIG.general.ZOOM_SHARPNESS / 5)

        self.fps = TextCheckBox(_('Show FPS:'))

        self.fps.set_value(CONFIG.display.SHOW_FPS)
        self.widget.add(self.fps, margin=25)

        self.widget.add(Button(_('Back')), margin=30)
コード例 #30
0
    def callback(self, action):
        if action is self.player_spinner :
            #get the index of the player
            player_number = self.player_spinner.index(action)

            self.players[player_number] = action.get_index()
            #change the portrait
            self.portraits[player_number].setImage(
                    join(
                        self.game_data['character_file'][action.get_index()],
                        "portrait.png"))

        if action.text == _("Start"):
            i  = 0
            for player in self.players:
                if player != 0:
                    i += 1
            if i > 1:
                return {'goto': 'level'}

        if action.text == _('Back'):
            return {'goto': 'back'}
コード例 #31
0
    def init(self):
        # create widgets
        self.add(VBox())
        self.name = _('Audio Options')

        self.sound = TextCheckBox(_('Sound'))
        self.sound_volume = Slider('Sound Volume')
        self.music = TextCheckBox(_('Music'))
        self.music_volume = Slider('Music Volume')

        # set values from config
        self.sound.set_value(CONFIG.audio.SOUND)
        self.sound_volume.set_value(CONFIG.audio.SOUND_VOLUME)
        self.music.set_value(CONFIG.audio.MUSIC)
        self.music_volume.set_value(CONFIG.audio.MUSIC_VOLUME)

        # add widgets
        self.widget.add(self.sound)
        self.widget.add(self.sound_volume, margin=10, size=(220, 30))
        self.widget.add(self.music)
        self.widget.add(self.music_volume, margin=10, size=(220, 30))
        self.widget.add(Button(_('Back')), margin=30)
コード例 #32
0
    def init(self):
        self.add(VBox())
        self.name = _("Keyboard Options")

        hbox = HBox()
        hbox.add(Label(" "), size=(80, 20))
        for img in ['left.png', 'right.png', 'top.png', 'bottom.png']:
            hbox.add(Image(join(
                'gui',
                CONFIG.general.THEME,
                img)),
                size=(40, 30),
                margin=30)


        hbox.add(Label('B'), size=(30, 40), margin=40, align="center")
        hbox.add(Label('A'), size=(30, 40), margin=40, align="center")
        hbox.add(Label(_("Shield")), size=(60, 40), margin=10, align="center")
        self.widget.add(hbox)
        actions = ['Left', 'Right', 'Up', 'Down', 'A', 'B', 'Shield']

        #one iteration per player
        for i in xrange(1, 5):
            hbox = HBox()
            hbox.add(Label('Player ' + str(i + 1)), size=(80, 50))

            for action in actions:
                w = KeyboardWidget(getattr(CONFIG.keyboard, 
                                       "PL{0}_{1}".format(i, action.upper())))
                w.set_id("PL{0}_{1}".format(i, action.upper()))
                hbox.add(w, size=(40, 40), margin=30)

            self.widget.add(hbox)

        self.widget.add(Button(_('Back')), align="center")
        self.widget.update_pos()
コード例 #33
0
    def init(self):
        self.game_data = {}
        self.game_data['character_file'] = []

        #I18N: The title of the screen where players can choose their character.
        self.name = _("characters")

        #create a character file to have the [?] image
        self.game_data['character_file'].append(join('characters', 'none'))
        self.character = []
        #I18N: in the character screen, to select no character for this player
        #I18N: (with the [?] icon)
        self.character.append(_("None"))
        #create a character for every directory in the characters directory.
        files = os.listdir(join(CONFIG.system_path, 'characters'))
        files.sort()

        self.load_chararacters(files)

        self.add(VBox())

        self.portrait = Image(join(self.game_data['character_file'][0],
            "portrait.png"))

        self.player_spinner = Spinner(self.character)
        player_vbox = VBox()
        player_vbox.add(Label(_('Player name'), align='center'))
        player_vbox.add(TextEntry(_('unnamed player')))
        player_vbox.add(Spinner(self.character))
        player_vbox.add(self.portrait, margin_left=65, margin=5, size=(50, 50))

        hbox = HBox()
        # adding the two box which contains the spinner and the name of the
        # characters
        hbox.add(player_vbox, margin=400)
        self.widget.add(hbox, margin=150)

        #create a level image for every directory in the level directory.
        files = os.listdir(os.path.join( CONFIG.system_path, 'levels'))
        files.sort()

        coverflow_data = self.load_levels(files)

        self.coverflow = Coverflow(coverflow_data)
        self.widget.add(self.coverflow, size=(800, 275))

        #next button to go to the level screen
        self.widget.add(Button(_("Start")),
            margin=83,
            align="center")

        #back button to come back to main screen
        self.widget.add(Button(_('Back')),
            margin=20,
            align="center")
コード例 #34
0
    def init(self):
        self.game_data = {}
        self.game_data['character_file'] = []

        #I18N: The title of the screen where players can choose their character.
        self.name = _("characters")

        #create a character file to have the [?] image
        self.game_data['character_file'].append(join('characters', 'none'))
        self.character = []
        #I18N: in the character screen, to select no character for this player
        #I18N: (with the [?] icon)
        self.character.append(_("None"))
        #create a character for every directory in the characters directory.
        files = os.listdir(join(CONFIG.system_path, 'characters'))
        files.sort()

        self.load_chararacters(files)

        self.add(VBox())

        self.portrait = Image(
            join(self.game_data['character_file'][0], "portrait.png"))

        self.player_spinner = Spinner(self.character)
        player_vbox = VBox()
        player_vbox.add(Label(_('Player name'), align='center'))
        player_vbox.add(TextEntry(_('unnamed player')))
        player_vbox.add(Spinner(self.character))
        player_vbox.add(self.portrait, margin_left=65, margin=5, size=(50, 50))

        hbox = HBox()
        # adding the two box which contains the spinner and the name of the
        # characters
        hbox.add(player_vbox, margin=400)
        self.widget.add(hbox, margin=150)

        #create a level image for every directory in the level directory.
        files = os.listdir(os.path.join(CONFIG.system_path, 'levels'))
        files.sort()

        coverflow_data = self.load_levels(files)

        self.coverflow = Coverflow(coverflow_data)
        self.widget.add(self.coverflow, size=(800, 275))

        #next button to go to the level screen
        self.widget.add(Button(_("Start")), margin=83, align="center")

        #back button to come back to main screen
        self.widget.add(Button(_('Back')), margin=20, align="center")
コード例 #35
0
    def callback(self, action):
        if action.text == 'Music Volume':
            CONFIG.audio.MUSIC_VOLUME = action.get_value()
        if action.text == 'Sound Volume':
            CONFIG.audio.SOUND_VOLUME = action.get_value()
        if action.text == 'Music':
            if CONFIG.audio.MUSIC:
                CONFIG.audio.MUSIC = False
            else:
                CONFIG.audio.MUSIC = True
        if action.text == 'Sound':
            if CONFIG.audio.SOUND:
                CONFIG.audio.SOUND = False
            else:
                CONFIG.audio.SOUND = True
        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
コード例 #36
0
    def __init__(self, players=None, level=None):
        """
        The constructor, create the render surface, set the menu initial state,
        parse command line params if any, launch the menu or the game depending
        on parameters.

        The init parameter determines if the Main object should be initialized
        once instanciated. The run parameter determines if the game should be run
        once the object is instantiated and initiated.

        """
        self.lock = threading.Lock()
        self.stop_thread = False
        self.text_thread = _("Loading...")

        self.level = level
        if players is None:
            self.players = []

        self.init()
        self.run()
コード例 #37
0
    def callback(self, action):
        if action == self.resolution:
            value = action.get_value()
            CONFIG.general.WIDTH = int(value.split('x')[0])
            CONFIG.general.HEIGHT = int(value.split('x')[1])
        if action == self.fullscreen:
            pygame.display.toggle_fullscreen()
            if CONFIG.display.FULLSCREEN:
                CONFIG.display.FULLSCREEN = False
            else:
                CONFIG.display.FULLSCREEN = True
        if action == self.fps:
            if CONFIG.display.SHOW_FPS:
                CONFIG.display.SHOW_FPS = False
            else:
                CONFIG.display.SHOW_FPS = True
        if action.text == 'zoom_sharpness':
            CONFIG.general.ZOOM_SHARPNESS = (action.get_value() + 1) * 5
        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
コード例 #38
0
    def callback(self, action):
        if action == self.resolution:
            value = action.get_value()
            CONFIG.general.WIDTH = int(value.split('x')[0])
            CONFIG.general.HEIGHT = int(value.split('x')[1])
        if action == self.fullscreen:
            pygame.display.toggle_fullscreen()
            if CONFIG.display.FULLSCREEN:
                CONFIG.display.FULLSCREEN = False
            else:
                CONFIG.display.FULLSCREEN = True
        if action == self.fps:
            if CONFIG.display.SHOW_FPS:
                CONFIG.display.SHOW_FPS = False
            else:
                CONFIG.display.SHOW_FPS = True
        if action.text == 'zoom_sharpness':
            CONFIG.general.ZOOM_SHARPNESS = (action.get_value()+1)*5
        if action.text == _('Back'):
            return {'goto': 'back'}

        CONFIG.write()
コード例 #39
0
 def init(self):
     self.add(VBox())
     self.widget.add(Button('Resume'))
     self.widget.add(Button(_('Configure')))
     self.widget.add(Button('Quit the game'))
コード例 #40
0
 def callback(self, action):
     if action.text == _("Back"):
         return {"goto": "back"}
コード例 #41
0
                    pass
                else:
                    raise
            except IOError, e:
                pass

        self.add(VBox())

        self.checkboxes_ai = []
        self.portraits = []
        self.player_spinner = []
        self.player_vbox = [VBox(), VBox(), VBox(), VBox()]

        for i in range(0, 4):
            #I18N: Artificial Intelligence
            self.checkboxes_ai.append(TextCheckBox(_("AI:")))
            self.portraits.append(Image(
                    join(self.game_data['character_file'][0], "portrait.png")))

            self.player_spinner.append(Spinner(self.character))
            #I18N: %s is the player number, it can be Player 1, Player2...
            self.player_vbox[i].add(Label(_("Player %s").replace(
                "%s", str(i+1))))
            self.player_vbox[i].add(self.player_spinner[-1])
            self.player_vbox[i].add(self.portraits[-1],
                margin_left=65,
                margin=5,
                size=(50, 50))
            self.player_vbox[i].add(
                    self.checkboxes_ai[-1],
                    margin_left=(180 - self.checkboxes_ai[-1].width) / 2)
コード例 #42
0
 def callback(self, action):
     if action.text == _('Back'):
         return {'goto': 'back'}
コード例 #43
0
    def callback(self, action):
        if action.text == _('Go !'):
            return {'game': 'new'}

        if action.text == _('Back'):
            return {'goto': 'back'}
コード例 #44
0
    def callback(self, action):
        if action.text == _('Go !'):
            return {'game': 'new'}

        if action.text == _('Back'):
            return {'goto': 'back'}
コード例 #45
0
 def init(self):
     self.add(VBox())
     self.widget.add(Button('Resume'))
     self.widget.add(Button(_('Configure')))
     self.widget.add(Button('Quit the game'))
コード例 #46
0
                    pass
                else:
                    raise
            except IOError, e:
                pass

        self.add(VBox())

        self.checkboxes_ai = []
        self.portraits = []
        self.player_spinner = []
        self.player_vbox = [VBox(), VBox(), VBox(), VBox()]

        for i in range(0, 4):
            #I18N: Artificial Intelligence
            self.checkboxes_ai.append(TextCheckBox(_("AI:")))
            self.portraits.append(
                Image(join(self.game_data['character_file'][0],
                           "portrait.png")))

            self.player_spinner.append(Spinner(self.character))
            #I18N: %s is the player number, it can be Player 1, Player2...
            self.player_vbox[i].add(
                Label(_("Player %s").replace("%s", str(i + 1))))
            self.player_vbox[i].add(self.player_spinner[-1])
            self.player_vbox[i].add(self.portraits[-1],
                                    margin_left=65,
                                    margin=5,
                                    size=(50, 50))
            self.player_vbox[i].add(
                self.checkboxes_ai[-1],