示例#1
0
    def onGamePreview(self, adm, ficsgame):
        log.debug("Archived panel onGamePreview: %s" % ficsgame)

        timemodel = TimeModel(ficsgame.minutes * 60, ficsgame.inc)

        gamemodel = ICGameModel(self.connection, ficsgame, timemodel)

        # The players need to start listening for moves IN this method if they
        # want to be noticed of all moves the FICS server sends us from now on.
        # Hence the lazy loading is skipped.
        wplayer, bplayer = ficsgame.wplayer, ficsgame.bplayer
        player0tup = (REMOTE, ICPlayer,
                      (gamemodel, wplayer.name, -1, WHITE, wplayer.long_name(),
                       wplayer.getRatingByGameType(ficsgame.game_type)),
                      wplayer.long_name())
        player1tup = (REMOTE, ICPlayer,
                      (gamemodel, bplayer.name, -1, BLACK, bplayer.long_name(),
                       bplayer.getRatingByGameType(ficsgame.game_type)),
                      bplayer.long_name())

        perspective = perspective_manager.get_perspective("games")
        create_task(
            perspective.generalStart(
                gamemodel, player0tup, player1tup,
                (StringIO(ficsgame.board.pgn), pgn, 0, -1)))
        gamemodel.connect("game_started", self.on_game_start, ficsgame)
    def onObserveGameCreated(self, bm, ficsgame):
        log.debug("FICS.onObserveGameCreated: %s" % ficsgame)

        timemodel = TimeModel(ficsgame.minutes * 60, ficsgame.inc)

        gamemodel = ICGameModel(self.connection, ficsgame, timemodel)
        gamemodel.connect("game_started", self.onGameModelStarted, ficsgame)

        # The players need to start listening for moves IN this method if they
        # want to be noticed of all moves the FICS server sends us from now on
        wplayer, bplayer = ficsgame.wplayer, ficsgame.bplayer

        player0tup = (
            REMOTE,
            ICPlayer,
            (
                gamemodel,
                wplayer.name,
                ficsgame.gameno,
                WHITE,
                wplayer.long_name(),
                wplayer.getRatingForCurrentGame(),
            ),
            wplayer.long_name(),
        )
        player1tup = (
            REMOTE,
            ICPlayer,
            (
                gamemodel,
                bplayer.name,
                ficsgame.gameno,
                BLACK,
                bplayer.long_name(),
                bplayer.getRatingForCurrentGame(),
            ),
            bplayer.long_name(),
        )

        perspective = perspective_manager.get_perspective("games")
        create_task(
            perspective.generalStart(
                gamemodel,
                player0tup,
                player1tup,
                (StringIO(ficsgame.board.pgn), pgn, 0, -1),
            ))

        if ficsgame.relation == IC_POS_OBSERVING_EXAMINATION:
            if 1:  # int(self.connection.lvm.variablesBackup["kibitz"]) == 0:
                self.connection.cm.whisper(
                    _("You have to set kibitz on to see bot messages here."))
            self.connection.fm.finger(bplayer.name)
            self.connection.fm.finger(wplayer.name)
        elif ficsgame.relation == IC_POS_EXAMINATING:
            gamemodel.examined = True
        if not self.connection.ICC:
            allob = "allob " + str(ficsgame.gameno)
            gamemodel.connection.client.run_command(allob)
示例#3
0
    def onPlayGameCreated(self, bm, ficsgame):
        log.debug("FICS.onPlayGameCreated: %s" % ficsgame)

        for message in self.messages:
            message.dismiss()
        del self.messages[:]

        if self.connection.ICC:
            for button in self.quick_seek_buttons:
                button.set_active(False)

        timemodel = TimeModel(ficsgame.minutes * 60, ficsgame.inc)

        gamemodel = ICGameModel(self.connection, ficsgame, timemodel)
        gamemodel.connect("game_started", self.onGameModelStarted, ficsgame)

        wplayer, bplayer = ficsgame.wplayer, ficsgame.bplayer

        # We start
        if wplayer.name.lower() == self.connection.getUsername().lower():
            player0tup = (LOCAL, Human, (WHITE, wplayer.long_name(),
                                         wplayer.name,
                                         wplayer.getRatingForCurrentGame()),
                          wplayer.long_name())
            player1tup = (REMOTE, ICPlayer,
                          (gamemodel, bplayer.name, ficsgame.gameno, BLACK,
                           bplayer.long_name(),
                           bplayer.getRatingForCurrentGame()),
                          bplayer.long_name())

        # She starts
        else:
            player1tup = (LOCAL, Human, (BLACK, bplayer.long_name(),
                                         bplayer.name,
                                         bplayer.getRatingForCurrentGame()),
                          bplayer.long_name())
            player0tup = (REMOTE, ICPlayer,
                          (gamemodel, wplayer.name, ficsgame.gameno, WHITE,
                           wplayer.long_name(),
                           wplayer.getRatingForCurrentGame()),
                          wplayer.long_name())

        perspective = perspective_manager.get_perspective("games")
        if not ficsgame.board.fen:
            create_task(
                perspective.generalStart(gamemodel, player0tup, player1tup))
        else:
            create_task(
                perspective.generalStart(
                    gamemodel, player0tup, player1tup,
                    (StringIO(ficsgame.board.fen), fen, 0, -1)))
示例#4
0
    def onPlayGameCreated(self, bm, ficsgame):
        log.debug("FICS.onPlayGameCreated: %s" % ficsgame)

        for message in self.messages:
            message.dismiss()
        del self.messages[:]

        if self.connection.ICC:
            for button in self.quick_seek_buttons:
                button.set_active(False)

        timemodel = TimeModel(ficsgame.minutes * 60, ficsgame.inc)

        gamemodel = ICGameModel(self.connection, ficsgame, timemodel)
        gamemodel.connect("game_started", self.onGameModelStarted, ficsgame)

        wplayer, bplayer = ficsgame.wplayer, ficsgame.bplayer

        # We start
        if wplayer.name.lower() == self.connection.getUsername().lower():
            player0tup = (LOCAL, Human,
                          (WHITE, wplayer.long_name(), wplayer.name,
                           wplayer.getRatingForCurrentGame()),
                          wplayer.long_name())
            player1tup = (REMOTE, ICPlayer, (
                gamemodel, bplayer.name, ficsgame.gameno, BLACK,
                bplayer.long_name(), bplayer.getRatingForCurrentGame()),
                bplayer.long_name())

        # She starts
        else:
            player1tup = (LOCAL, Human,
                          (BLACK, bplayer.long_name(), bplayer.name,
                           bplayer.getRatingForCurrentGame()),
                          bplayer.long_name())
            player0tup = (REMOTE, ICPlayer, (
                gamemodel, wplayer.name, ficsgame.gameno, WHITE,
                wplayer.long_name(), wplayer.getRatingForCurrentGame()),
                wplayer.long_name())

        perspective = perspective_manager.get_perspective("games")
        if not ficsgame.board.fen:
            create_task(perspective.generalStart(gamemodel, player0tup, player1tup))
        else:
            create_task(perspective.generalStart(gamemodel, player0tup, player1tup, (
                StringIO(ficsgame.board.fen), fen, 0, -1)))
示例#5
0
    def onGamePreview(self, adm, ficsgame):
        log.debug("Archived panel onGamePreview: %s" % ficsgame)

        timemodel = TimeModel(ficsgame.minutes * 60, ficsgame.inc)

        gamemodel = ICGameModel(self.connection, ficsgame, timemodel)

        # The players need to start listening for moves IN this method if they
        # want to be noticed of all moves the FICS server sends us from now on.
        # Hence the lazy loading is skipped.
        wplayer, bplayer = ficsgame.wplayer, ficsgame.bplayer
        player0tup = (REMOTE, ICPlayer, (
            gamemodel, wplayer.name, -1, WHITE,
            wplayer.long_name(), wplayer.getRatingByGameType(ficsgame.game_type)),
            wplayer.long_name())
        player1tup = (REMOTE, ICPlayer, (
            gamemodel, bplayer.name, -1, BLACK,
            bplayer.long_name(), bplayer.getRatingByGameType(ficsgame.game_type)),
            bplayer.long_name())

        perspective = perspective_manager.get_perspective("games")
        create_task(perspective.generalStart(gamemodel, player0tup, player1tup, (
            StringIO(ficsgame.board.pgn), pgn, 0, -1)))
        gamemodel.connect("game_started", self.on_game_start, ficsgame)
示例#6
0
    def onObserveGameCreated(self, bm, ficsgame):
        log.debug("FICS.onObserveGameCreated: %s" % ficsgame)

        timemodel = TimeModel(ficsgame.minutes * 60, ficsgame.inc)

        gamemodel = ICGameModel(self.connection, ficsgame, timemodel)
        gamemodel.connect("game_started", self.onGameModelStarted, ficsgame)

        # The players need to start listening for moves IN this method if they
        # want to be noticed of all moves the FICS server sends us from now on
        wplayer, bplayer = ficsgame.wplayer, ficsgame.bplayer

        player0tup = (REMOTE, ICPlayer, (
            gamemodel, wplayer.name, ficsgame.gameno, WHITE,
            wplayer.long_name(), wplayer.getRatingForCurrentGame()),
            wplayer.long_name())
        player1tup = (REMOTE, ICPlayer, (
            gamemodel, bplayer.name, ficsgame.gameno, BLACK,
            bplayer.long_name(), bplayer.getRatingForCurrentGame()),
            bplayer.long_name())

        perspective = perspective_manager.get_perspective("games")
        create_task(perspective.generalStart(gamemodel, player0tup, player1tup, (
            StringIO(ficsgame.board.pgn), pgn, 0, -1)))

        if ficsgame.relation == IC_POS_OBSERVING_EXAMINATION:
            if 1:  # int(self.connection.lvm.variablesBackup["kibitz"]) == 0:
                self.connection.cm.whisper(_(
                    "You have to set kibitz on to see bot messages here."))
            self.connection.fm.finger(bplayer.name)
            self.connection.fm.finger(wplayer.name)
        elif ficsgame.relation == IC_POS_EXAMINATING:
            gamemodel.examined = True
        if not self.connection.ICC:
            allob = 'allob ' + str(ficsgame.gameno)
            gamemodel.connection.client.run_command(allob)