Exemple #1
0
    def iniciaConUsuario(self, user):

        self.user = user

        self.web = "https://lucaschess.pythonanywhere.com"
        self.blog = "https://lucaschess.blogspot.com"

        self.liOpcionesInicio = [k_terminar, k_play, k_entrenamiento, k_competir,
                                 k_tools, k_opciones, k_informacion]  # Lo incluimos aqui porque sino no lo lee, en caso de aplazada

        self.configuracion = Configuracion.Configuracion(user)
        self.configuracion.start(self.version)
        VarGen.configuracion = self.configuracion
        AperturasStd.reset()

        VarGen.todasPiezas = Piezas.TodasPiezas()

        self.gestor = None
        self.teclaPanico = 32  # necesario

        self.siPrimeraVez = True
        self.siPresentacion = False  # si esta funcionando la presentacion

        self.posicionInicial = ControlPosicion.ControlPosicion()
        self.posicionInicial.posInicial()

        self.xrival = None
        self.xtutor = None  # creaTutor lo usa asi que hay que definirlo antes
        self.xanalyzer = None  # cuando se juega GestorEntMaq y el tutor danzando a toda maquina, se necesita otro diferente

        self.replay = None
        self.replayBeep = None

        self.liKibitzersActivas = []
    def start_with_user(self, user):
        self.user = user

        self.li_opciones_inicio = [
            TB_QUIT, TB_PLAY, TB_TRAIN, TB_COMPETE, TB_TOOLS, TB_OPTIONS,
            TB_INFORMATION
        ]  # Lo incluimos aqui porque sino no lo lee, en caso de aplazada

        self.configuration = Configuration.Configuration(user)
        self.configuration.start()
        Code.configuration = self.configuration
        Code.procesador = self
        OpeningsStd.reset()

        # Tras crear configuración miramos si hay Adjournments
        self.test_opcion_Adjournments()

        Code.todasPiezas = Piezas.TodasPiezas()

        self.manager = None

        self.siPrimeraVez = True
        self.siPresentacion = False  # si esta funcionando la presentacion

        self.posicionInicial = Position.Position()
        self.posicionInicial.set_pos_initial()

        self.xrival = None
        self.xtutor = None  # creaTutor lo usa asi que hay que definirlo antes
        self.xanalyzer = None  # cuando se juega ManagerEntMaq y el tutor danzando a toda maquina,
        # se necesita otro diferente
        self.replay = None
        self.replayBeep = None
Exemple #3
0
def run(user, file_tournament, file_work):
    sys.stderr = Util.Log("./bug.tournaments")

    app = QtWidgets.QApplication([])

    configuration = Configuration.Configuration(user)
    configuration.lee()
    configuration.leeConfBoards()
    configuration.releeTRA()
    Code.configuration = configuration
    OpeningsStd.reset()
    Code.todasPiezas = Piezas.TodasPiezas()

    app.setStyle(QtWidgets.QStyleFactory.create(configuration.x_style))
    QtWidgets.QApplication.setPalette(QtWidgets.QApplication.style().standardPalette())

    w = WTournamentRun.WTournamentRun(file_tournament, file_work)
    w.show()
    w.busca_trabajo()
Exemple #4
0
    def __init__(self, cpu, icon):
        QtWidgets.QDialog.__init__(self)
        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(icon)

        self.cpu = cpu
        self.siPlay = True
        self.kibitzer = cpu.kibitzer
        self.type = cpu.tipo
        self.dicVideo = self.cpu.dic_video
        if not self.dicVideo:
            self.dicVideo = {}
        self.game = None
        self.li_moves = []
        self.is_black = True
        self.is_white = True

        self.siTop = self.dicVideo.get("SITOP", True)
        self.show_board = self.dicVideo.get("SHOW_BOARD", True)
        self.nArrows = self.dicVideo.get(
            "NARROWS", 1 if cpu.tipo == Kibitzers.KIB_THREATS else 2)

        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)
        if not self.show_board:
            self.board.hide()

        self.with_figurines = cpu.configuration.x_pgn_withfigurines
Exemple #5
0
    def iniciaConUsuario(self, user):

        self.user = user

        self.web = "http://www-lucaschess.rhcloud.com"
        self.blog = "http://lucaschess.blogspot.com"

        self.liOpcionesInicio = [
            k_terminar, k_play, k_competicion, k_elo, k_entrenamiento, k_tools,
            k_opciones, k_informacion
        ]  # Lo incluimos aqui porque sino no lo lee, en caso de aplazada

        self.configuracion = Configuracion.Configuracion(user)
        self.configuracion.start(self.version)
        VarGen.configuracion = self.configuracion

        VarGen.todasPiezas = Piezas.TodasPiezas()

        self.gestor = None
        self.teclaPanico = 32  # necesario

        self.siPrimeraVez = True
        self.siPresentacion = False  # si esta funcionando la presentacion

        self.posicionInicial = ControlPosicion.ControlPosicion()
        self.posicionInicial.posInicial()

        self.xrival = None
        self.xtutor = None  # creaTutor lo usa asi que hay que definirlo antes

        self.replay = None
        self.replayBeep = None

        self.liKibitzersActivas = []

        self.liEngines = []
        self.xtutor = None
Exemple #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.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()
Exemple #7
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()
Exemple #8
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()
Exemple #9
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()
Exemple #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.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()
Exemple #11
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)
Exemple #12
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
Exemple #13
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()
Exemple #14
0
 def __init__(self, fdb):
     self.fdb = fdb
     self.getRaw()
     VarGen.todasPiezas = Piezas.TodasPiezas()
     VarGen.configuracion = self.configuracion