def editAnalisis(self, item, mov):

        # Hay un analysis -> se muestra en variantes
        # Analisis.show_analysis( self.procesador, self.xtutor, move, is_white, max_recursion, pos )
        fen = mov.game.last_position.fen()

        rm = mov.analysis()
        if rm is None:
            return

        game = Game.Game(mov.game.last_position)
        game.read_pv(rm.pv)
        lineaPGN = game.pgnBaseRAW()
        wowner = self.owner
        board = wowner.infoMove.board
        import Code.Variations as Variations

        Variations.edit_variation_moves(
            self.procesador,
            wowner,
            board.is_white_bottom,
            fen,
            lineaPGN,
            titulo=mov.titulo + " - " + mov.etiPuntos(True),
        )
Example #2
0
    def edit_variations(self, item, mov):
        import Code.Variations as Variations

        if mov.variantes:
            menu = QTVarios.LCMenu(self)
            for num, una in enumerate(mov.variantes):
                menu.opcion(num, una[:40], Iconos.PuntoAzul())
            menu.separador()
            menu.opcion(-1, _("New variation"), Iconos.Mas())
            menu.separador()
            menub = menu.submenu(_("Remove"), Iconos.Delete())
            for num, una in enumerate(mov.variantes):
                menub.opcion(-num - 2, una[:40], Iconos.PuntoNaranja())

            resp = menu.lanza()
            if resp is None:
                return None
            if resp == -1:
                num = None
                lineaPGN = ""
            elif resp >= 0:
                num = resp
                lineaPGN = mov.variantes[num]
            else:
                num = -resp - 2
                una = mov.variantes[num]
                if QTUtil2.pregunta(self, _X(_("Delete %1?"), una[:40])):
                    del mov.variantes[num]
                    self.ponVariations(mov)
                return
        else:
            lineaPGN = ""
            num = None
        fen = mov.game.last_position.fen()

        wowner = self.owner
        board = wowner.infoMove.board
        resp = Variations.edit_variation_moves(self.procesador, wowner,
                                               board.is_white_bottom, fen,
                                               lineaPGN)
        if resp:
            una = resp[0]
            if num is None:
                mov.variantes.append(una)
                self.ponVariations(mov)
            else:
                mov.variantes[num] = una