Ejemplo n.º 1
0
    def show(self):
        self.archivist.refresh()

        self.selectedGameButton = None
        while self.archivesGamesList['items']:
            self.archivesGamesList.removeItem(
                self.archivesGamesList['items'][0])

        colours = self.app.theme.colours
        games = self.archivist.getGames()
        for game in games:
            gameName = os.path.splitext(os.path.basename(game.filename))[0]
            button = DirectButton(
                text=gameName,
                text_fg=colours.listboxButtons,
                text1_fg=colours.listboxSelectedButtons,
                text_align=TextNode.ALeft,
                scale=0.04,
                command=self.selectArchiveGame,
                relief=None,
            )
            button['extraArgs'] = [button]
            align(button, left=0)
            button.gameFile = game

            self.archivesGamesList.addItem(button)

        if games:
            self.selectArchiveGame(self.archivesGamesList['items'][0])
        else:
            self.archivesGamesList.addItem(
                DirectLabel(
                    text='No compatible game files found',
                    text_scale=0.04,
                    text_fg=colours.noGamesColour,
                    text_align=TextNode.ALeft,
                    relief=None,
                ))