def __init__(self, cpu):
        WKibCommon.WKibCommon.__init__(self, cpu, Iconos.Finales())

        self.t4 = LibChess.T4(cpu.configuration)

        o_columns = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(
            True, siLineas=False) if self.with_figurines else None
        o_columns.nueva("MOVE", _("Move"), 80, centered=True, edicion=delegado)
        o_columns.nueva("DTM", "DTM", 60, centered=True)
        self.grid = Grid.Grid(self,
                              o_columns,
                              dicVideo=self.dicVideo,
                              siSelecFilas=True)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Takeback"), Iconos.Kibitzer_Back(), self.takeback),
            (_("Manual position"), Iconos.Kibitzer_Voyager(),
             self.set_position),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        lyH = Colocacion.H().control(self.board).control(self.grid)
        layout = Colocacion.V().control(
            self.tb).espacio(-8).otro(lyH).margen(3)
        self.setLayout(layout)

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        if not self.show_board:
            self.board.hide()
        self.restore_video(self.dicVideo)
        self.ponFlags()
Example #2
0
    def creaRestoControles(self):

        liAcciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
        )
        self.tb = Controles.TBrutina(self, liAcciones, siTexto=False, tamIcon=16)
        self.tb.setAccionVisible(self.windowTop, False)
        self.em = Controles.EM(self).soloLectura()
        f = Controles.TipoLetra(nombre="Courier New", puntos=10)
        self.em.ponFuente(f)

        layout = Colocacion.V().control(self.tb).control(self.em).margen(1)

        self.setLayout(layout)

        self.lanzaMotor(True)
Example #3
0
    def creaRestoControles(self):

        liAcciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
            (_("Analyze only color"), Iconos.P_16c(), self.color),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
        )
        self.tb = Controles.TBrutina(self, liAcciones, siTexto=False, tamIcon=16)
        self.tb.setAccionVisible(self.play, False)
        self.tb.setAccionVisible(self.windowTop, False)
        self.em = Controles.EM(self).soloLectura()

        layout = Colocacion.V().control(self.tb).control(self.em).margen(1)

        self.setLayout(layout)

        self.lanzaMotor(True)
    def __init__(self, cpu):
        WKibCommon.WKibCommon.__init__(self, cpu, Iconos.Book())

        self.em = Controles.EM(self, siHTML=False).read_only()
        f = Controles.TipoLetra(name="Courier New", puntos=10)
        self.em.ponFuente(f)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.em).margen(3)
        layout = Colocacion.V().control(
            self.tb).espacio(-10).otro(ly1).margen(3)
        self.setLayout(layout)

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        self.restore_video(self.dicVideo)
        self.ponFlags()
Example #5
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.show_board = dicVideo.get("SHOW_BOARD", True)
        self.position = Position.Position()

        self.game = None
        self.siPlay = True
        self.li_moves = []
        self.history = []

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Book())

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuration = cpu.configuration

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuration.config_board(
            "kib" + cpu.kibitzer.huella, 24)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        self.board.set_dispatcher(self.mensajero)
        Delegados.generaPM(self.board.piezas)

        self.book = Books.Book("P", cpu.kibitzer.name, cpu.kibitzer.path_exe,
                               True)
        self.book.polyglot()

        self.with_figurines = cpu.configuration.x_pgn_withfigurines

        o_columns = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(
            True, siLineas=False) if self.with_figurines else None
        o_columns.nueva("MOVE", _("Move"), 80, centered=True, edicion=delegado)
        o_columns.nueva("PORC", "%", 60, centered=True)
        o_columns.nueva("WEIGHT", _("Weight"), 80, siDerecha=True)
        self.grid_moves = Grid.Grid(self,
                                    o_columns,
                                    dicVideo=dicVideo,
                                    siSelecFilas=True)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Takeback"), Iconos.pmKibitzer_Back(), self.takeback),
            (_("Manual position"), Iconos.Kibitzer_Voyager(),
             self.set_position),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.grid_moves)
        layout = Colocacion.V().control(
            self.tb).espacio(-8).otro(ly1).margen(3)
        self.setLayout(layout)

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(500)

        if not self.show_board:
            self.board.hide()
        self.restore_video(dicVideo)
        self.ponFlags()
Example #6
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.siShowTablero = dicVideo.get("SHOW_TABLERO", True)
        self.position = Position.Position()

        self.fen = ""
        self.almFEN = {}
        self.siPlay = True
        self.is_white = True
        self.siNegras = True

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Book())

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuracion = cpu.configuracion

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuracion.config_board(
            "kib" + cpu.kibitzer.huella, 24)
        self.tablero = Tablero.Tablero(self, config_board)
        self.tablero.crea()
        Delegados.generaPM(self.tablero.piezas)

        self.em = Controles.EM(self, siHTML=False).soloLectura()
        f = Controles.TipoLetra(name="Courier New", puntos=10)
        self.em.ponFuente(f)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
            (_("Board"), Iconos.Tablero(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     siTexto=False,
                                     tamIcon=16)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.tb)
        ly2 = Colocacion.V().otro(ly1).control(self.em)

        layout = Colocacion.H().control(self.tablero).otro(ly2)
        self.setLayout(layout)

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        if not self.siShowTablero:
            self.tablero.hide()
        self.restore_video(dicVideo)
        self.ponFlags()
Example #7
0
    def __init__(self, cpu, siWidgets=True, flags=None):
        QtGui.QDialog.__init__(self)

        self.cpu = cpu
        self.ficheroVideo = cpu.ficheroVideo
        self.motor = None

        self.liData = []
        self.almFEN = {}

        self.fen = ""

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Motor())

        if not flags:
            flags = QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowStaysOnTopHint
        self.setWindowFlags(flags)

        self.setBackgroundRole(QtGui.QPalette.Light)
        self.setStyleSheet("QTextEdit { background-color: rgb( 250,250,250); }")

        VarGen.configuracion = cpu.configuracion
        VarGen.todasPiezas = Piezas.TodasPiezas()
        confTablero = cpu.configuracion.confTablero("moscas" + cpu.titulo, 24)

        self.siWidgets = siWidgets
        if siWidgets:
            self.tablero = Tablero.Tablero(self, confTablero)
            self.tablero.crea()

        self.siShowTablero = siWidgets
        self.nArrows = 7

        self.siTop = True

        if siWidgets:
            self.em = Controles.EM(self).soloLectura()
            liAcciones = (
                (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
                (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
                (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
                (_("The best solution found by the engine is saved to the clipboard"), Iconos.MoverGrabar(), self.portapapelesUltJug),
                (_("Analyze only color"), Iconos.P_16c(), self.color),
                (_("Board"), Iconos.Tablero(), self.confTablero),
                ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
                ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
            )
            self.tb = Controles.TBrutina(self, liAcciones, siTexto=False, tamIcon=16)

            self.layoutDT = Colocacion.H().control(self.tablero).control(self.em)

        self.siPlay = True
        self.siBlancas = True
        self.siNegras = True

        self.creaRestoControles()

        self.timer = QtCore.QTimer(self)
        self.connect(self.timer, QtCore.SIGNAL("timeout()"), cpu.compruebaInput)
        self.timer.start(200)

        self.recuperarVideo()
        self.ponFlags()
Example #8
0
    def __init__(self, cpu):
        QtGui.QDialog.__init__(self)

        self.cpu = cpu

        self.ficheroVideo = cpu.ficheroVideo
        dicVideo = self.dicVideo()

        self.siTop = dicVideo.get("SITOP", True)
        self.siShowTablero = dicVideo.get("SHOW_TABLERO", True)
        self.nArrows = dicVideo.get("NARROWS", 7)

        self.fen = ""

        self.liData = []
        self.dicLineasDepth = {}

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Motor())

        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        VarGen.configuracion = cpu.configuracion

        VarGen.todasPiezas = Piezas.TodasPiezas()
        confTablero = cpu.configuracion.confTablero("moscas" + cpu.titulo, 24)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("BESTMOVE", _("Alternatives"), 80, siCentrado=True)
        oColumnas.nueva("EVALUATION", _("Evaluation"), 85, siCentrado=True)
        oColumnas.nueva("MAINLINE", _("Main line"), 300)
        self.grid = Grid.Grid(self, oColumnas, dicVideo=dicVideo)

        self.lbDepth = Controles.LB(self)

        liAcciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
            (_("The best solution found by the engine is saved to the clipboard"), Iconos.MoverGrabar(), self.portapapelesUltJug),
            (_("Analyze only color"), Iconos.P_16c(), self.color),
            (_("Board"), Iconos.Tablero(), self.confTablero),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
        )
        self.tb = Controles.TBrutina(self, liAcciones, siTexto=False, tamIcon=16)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.tb).relleno().control(self.lbDepth)
        ly2 = Colocacion.V().otro(ly1).control(self.grid)

        layout = Colocacion.H().control(self.tablero).otro(ly2)
        self.setLayout(layout)

        self.siPlay = True
        self.siBlancas = True
        self.siNegras = True

        self.timer = QtCore.QTimer(self)
        self.connect(self.timer, QtCore.SIGNAL("timeout()"), cpu.compruebaInput)
        self.timer.start(200)

        if not self.siShowTablero:
            self.tablero.hide()
        self.recuperarVideo(dicVideo)
        self.ponFlags()

        self.motor = None
        self.lanzaMotor()
Example #9
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        self.kibitzer = cpu.kibitzer

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.show_board = dicVideo.get("SHOW_BOARD", True)
        self.position = Position.Position()

        self.game = None
        self.siPlay = True
        self.is_white = True
        self.is_black = True

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Book())

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuration = cpu.configuration

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuration.config_board(
            "kib" + cpu.kibitzer.huella, 24)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        Delegados.generaPM(self.board.piezas)

        self.em = Controles.EM(self, siHTML=False).read_only()
        f = Controles.TipoLetra(name="Courier New", puntos=10)
        self.em.ponFuente(f)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.em).margen(3)
        layout = Colocacion.V().control(
            self.tb).espacio(-10).otro(ly1).margen(3)
        self.setLayout(layout)

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        if not self.show_board:
            self.board.hide()
        self.restore_video(dicVideo)
        self.ponFlags()
Example #10
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu
        self.kibitzer = cpu.kibitzer

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.show_board = dicVideo.get("SHOW_BOARD", True)
        self.history = []

        self.fen = ""
        self.liData = []

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Motor())

        self.setWindowFlags(
            QtCore.Qt.WindowCloseButtonHint
            | QtCore.Qt.Dialog
            | QtCore.Qt.WindowTitleHint
            | QtCore.Qt.WindowMinimizeButtonHint
        )

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuration = cpu.configuration

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuration.config_board("kib" + cpu.kibitzer.huella, 24)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        self.board.set_dispatcher(self.mensajero)

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("titulo", "", 100, siDerecha=True)
        o_columns.nueva("valor", "", 100, centered=True)
        o_columns.nueva("info", "", 100)
        self.grid = Grid.Grid(self, o_columns, dicVideo=dicVideo, siSelecFilas=True, siCabeceraVisible=False)

        li_acciones = (
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Takeback"), Iconos.Atras(), self.takeback),
            (_("Analyze only color"), Iconos.Kibitzer_Side(), self.color),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            (_("Manual position"), Iconos.Voyager(), self.set_position),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
        )
        self.tb = Controles.TBrutina(self, li_acciones, with_text=False, icon_size=16)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.tb).relleno()
        ly2 = Colocacion.V().otro(ly1).control(self.grid)

        layout = Colocacion.H().control(self.board).otro(ly2)
        self.setLayout(layout)

        self.siPlay = True
        self.is_white = True
        self.is_black = True

        if not self.show_board:
            self.board.hide()
        self.restore_video(dicVideo)
        self.ponFlags()

        self.engine = self.lanzaMotor()

        self.depth = 0
        self.veces = 0

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.compruebaInput)
        self.timer.start(200)
Example #11
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        self.kibitzer = cpu.kibitzer

        self.siCandidates = cpu.tipo == Kibitzers.KIB_CANDIDATES
        self.siThreats = cpu.tipo == Kibitzers.KIB_THREATS

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.siShowTablero = dicVideo.get("SHOW_TABLERO", True)
        self.nArrows = dicVideo.get("NARROWS", 2)

        self.fen = ""
        self.liData = []
        self.history = []

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Motor())

        self.setWindowFlags(
            QtCore.Qt.WindowCloseButtonHint
            | QtCore.Qt.Dialog
            | QtCore.Qt.WindowTitleHint
            | QtCore.Qt.WindowMinimizeButtonHint
        )

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuracion = cpu.configuracion

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuracion.config_board("kib" + cpu.kibitzer.huella, 24)
        self.tablero = Tablero.Tablero(self, config_board)
        self.tablero.crea()
        self.tablero.set_dispatcher(self.mensajero)

        self.siFigurines = cpu.configuracion.x_pgn_withfigurines

        Delegados.generaPM(self.tablero.piezas)
        delegado = Delegados.EtiquetaPOS(True, siLineas=False) if self.siFigurines else None

        o_columns = Columnas.ListaColumnas()
        if not self.siCandidates:
            o_columns.nueva("DEPTH", "^", 40, centered=True)
        o_columns.nueva("BESTMOVE", _("Alternatives"), 80, centered=True, edicion=delegado)
        o_columns.nueva("EVALUATION", _("Evaluation"), 85, centered=True)
        o_columns.nueva("MAINLINE", _("Main line"), 400)
        self.grid = Grid.Grid(self, o_columns, dicVideo=dicVideo, siSelecFilas=True)

        self.lbDepth = Controles.LB(self)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
            (_("Takeback"), Iconos.Atras(), self.takeback),
            (_("The line selected is saved on clipboard"), Iconos.MoverGrabar(), self.portapapelesJugSelected),
            (_("Analyze only color"), Iconos.P_16c(), self.color),
            (_("Show/hide board"), Iconos.Tablero(), self.config_board),
            (_("Manual position"), Iconos.Voyager(), self.set_position),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
            (_("Options"), Iconos.Opciones(), self.change_options),
        )
        self.tb = Controles.TBrutina(self, li_acciones, siTexto=False, tamIcon=16)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.tb).relleno().control(self.lbDepth)
        ly2 = Colocacion.V().otro(ly1).control(self.grid)

        layout = Colocacion.H().control(self.tablero).otro(ly2)
        self.setLayout(layout)

        self.siPlay = True
        self.is_white = True
        self.siNegras = True

        if not self.siShowTablero:
            self.tablero.hide()
        self.restore_video(dicVideo)
        self.ponFlags()

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.compruebaInput)
        self.timer.start(500)
        self.depth = 0
        self.veces = 0
Example #12
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.siShowTablero = dicVideo.get("SHOW_TABLERO", True)
        self.position = Position.Position()

        self.fen = ""
        self.siPlay = True
        self.li_moves = []
        self.history = []

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Finales())

        self.setWindowFlags(
            QtCore.Qt.WindowCloseButtonHint
            | QtCore.Qt.Dialog
            | QtCore.Qt.WindowTitleHint
            | QtCore.Qt.WindowMinimizeButtonHint
        )

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuracion = cpu.configuracion

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuracion.config_board("kib" + cpu.kibitzer.huella, 24)
        self.tablero = Tablero.Tablero(self, config_board)
        self.tablero.crea()
        self.tablero.set_dispatcher(self.mensajero)
        Delegados.generaPM(self.tablero.piezas)

        self.t4 = LibChess.T4(cpu.configuracion)

        self.siFigurines = cpu.configuracion.x_pgn_withfigurines

        o_columns = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(True, siLineas=False) if self.siFigurines else None
        o_columns.nueva("MOVE", _("Move"), 80, centered=True, edicion=delegado)
        o_columns.nueva("DTM", "DTM", 60, centered=True)
        self.grid_moves = Grid.Grid(self, o_columns, dicVideo=dicVideo, siSelecFilas=True)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
            (_("Takeback"), Iconos.Atras(), self.takeback),
            (_("Manual position"), Iconos.Voyager(), self.set_position),
            (_("Show/hide board"), Iconos.Tablero(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom),
        )
        self.tb = Controles.TBrutina(self, li_acciones, siTexto=False, tamIcon=16)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.tb)
        ly2 = Colocacion.V().otro(ly1).control(self.grid_moves)

        layout = Colocacion.H().control(self.tablero).otro(ly2)
        self.setLayout(layout)

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        if not self.siShowTablero:
            self.tablero.hide()
        self.restore_video(dicVideo)
        self.ponFlags()