def __init__(self, owner):
        self.owner = owner
        configuracion = VarGen.configuracion
        self.siFigurines = configuracion.figurinesPGN
        puntos = configuracion.puntosPGN

        QtGui.QWidget.__init__(self, self.owner)

        liAcciones = (
            (_("Append"), Iconos.Mas(), self.tbMasVariante), None,
            ("%s+%s" % (_("Append"), _("Engine")), Iconos.MasR(), self.tbMasVarianteR), None,
            (_("Edit"), Iconos.ComentarioEditar(), self.tbEditarVariante), None,
            (_("Remove"), Iconos.Borrar(), self.tbBorrarVariante), None,
        )
        tbVariantes = Controles.TBrutina(self, liAcciones, siTexto=False, tamIcon=16)

        self.em = Controles.EM(self)#.capturaCambios(self.variantesCambiado)
        self.em.setReadOnly(True)
        self.em.capturaDobleClick(self.dobleClick)

        ly = Colocacion.V().control(tbVariantes).control(self.em).margen(3)

        f = Controles.TipoLetra(puntos=puntos)

        gbVariantes = Controles.GB(self.owner, _("Variants"), ly).ponFuente(f)

        layout = Colocacion.H().control(gbVariantes).margen(0)
        self.setLayout(layout)

        self.liVariantes = []

        self.jg = None
예제 #2
0
    def __init__(self, guion, tablero, ancho, editMode=False, withContinue=False):
        QtWidgets.QWidget.__init__(self)

        self.guion = guion
        self.tarea = None

        self.mensaje = Controles.EM(self).ponTipoLetra(puntos=VarGen.configuracion.tamFontRotulos)

        self.pb = None
        self.chb = None
        if editMode:
            self.chb = Controles.CHB(self, _("With continue button"), False).capturaCambiado(self, self.save)
            self.mensaje.capturaCambios(self.save)
        elif withContinue:
            self.pb = Controles.PB(self, _("Continue"), self.continuar, plano=False)
            self.bloqueada = True
            self.mensaje.soloLectura()
        else:
            self.mensaje.soloLectura()

        self.pbLeft = Controles.PB(self, "", self.goLeft).ponIcono(Iconos.AnteriorF()).anchoFijo(24)
        self.pbRight = Controles.PB(self, "", self.goRight).ponIcono(Iconos.SiguienteF()).anchoFijo(24)
        self.pbDown = Controles.PB(self, "", self.goDown).ponIcono(Iconos.Abajo()).anchoFijo(24)
        self.pbClose = Controles.PB(self, "", self.borrar).ponIcono(Iconos.CancelarPeque()).anchoFijo(24)

        cajon = QtWidgets.QWidget(self)
        ly = Colocacion.H()
        ly.control(self.pbLeft).control(self.pbDown)
        ly.control(self.pbRight).control(self.pbClose).margen(0)
        if self.pb:
            ly.control(self.pb)
        if self.chb:
            ly.control(self.chb)
        cajon.setLayout(ly)
        cajon.setFixedHeight(20)

        layout = Colocacion.V().control(self.mensaje).espacio(-6).control(cajon).margen(0)

        self.setLayout(layout)
        self.setWindowFlags(QtCore.Qt.ToolTip)

        posTabl = tablero.pos()
        posTablGlobal = tablero.mapToGlobal(posTabl)
        self.anchoTabl = tablero.width()
        self.anchoPizarra = ancho
        self.x = posTablGlobal.x() - posTabl.x()
        self.y = posTablGlobal.y() - posTabl.y()

        if self.guion.posPizarra == "R":
            self.goRight()
        elif self.guion.posPizarra == "L":
            self.goLeft()
        else:
            self.goDown()

        if editMode:
            self.clearFocus()
            self.mensaje.setFocus()
예제 #3
0
    def __init__(self, guion, board, ancho, edit_mode=False, with_continue=False):
        QtWidgets.QWidget.__init__(self)

        self.guion = guion
        self.tarea = None

        self.mensaje = Controles.EM(self).ponTipoLetra(puntos=Code.configuration.x_sizefont_infolabels)

        self.pb = None
        self.chb = None
        if edit_mode:
            self.chb = Controles.CHB(self, _("With continue button"), False).capture_changes(self, self.save)
            self.mensaje.capturaCambios(self.save)
        elif with_continue:
            self.pb = Controles.PB(self, _("Continue"), self.continuar, plano=False)
            self.bloqueada = True
            self.mensaje.read_only()
        else:
            self.mensaje.read_only()

        self.pbLeft = Controles.PB(self, "", self.go_left).ponIcono(Iconos.AnteriorF()).anchoFijo(24)
        self.pbRight = Controles.PB(self, "", self.go_right).ponIcono(Iconos.SiguienteF()).anchoFijo(24)
        self.pbDown = Controles.PB(self, "", self.go_down).ponIcono(Iconos.Abajo()).anchoFijo(24)
        self.pbClose = Controles.PB(self, "", self.borrar).ponIcono(Iconos.CancelarPeque()).anchoFijo(24)

        cajon = QtWidgets.QWidget(self)
        ly = Colocacion.H()
        ly.control(self.pbLeft).control(self.pbDown)
        ly.control(self.pbRight).control(self.pbClose).margen(0)
        if self.pb:
            ly.control(self.pb)
        if self.chb:
            ly.control(self.chb)
        cajon.setLayout(ly)
        cajon.setFixedHeight(20)

        layout = Colocacion.V().control(self.mensaje).espacio(-6).control(cajon).margen(0)

        self.setLayout(layout)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.ToolTip)

        pos_tabl = board.pos()
        pos_tabl_global = board.mapToGlobal(pos_tabl)
        self.anchoTabl = board.width()
        self.anchoPizarra = ancho
        self.x = pos_tabl_global.x() - pos_tabl.x()
        self.y = pos_tabl_global.y() - pos_tabl.y()

        if self.guion.posPizarra == "R":
            self.go_right()
        elif self.guion.posPizarra == "L":
            self.go_left()
        else:
            self.go_down()

        if edit_mode:
            self.clearFocus()
            self.mensaje.setFocus()
예제 #4
0
    def creaRestoControles(self):

        self.lbJug = Controles.LB(self).alinCentrado()

        self.emJug = Controles.EM(self).capturaDobleClick(self.miraMovimiento).soloLectura()

        layout = Colocacion.V().control(self.tb).control(self.emJug).control(self.lbJug).otro(self.layoutDT).margen(1)

        self.setLayout(layout)

        self.lifens = {}

        self.siMotorTrabajando = False
        self.em.hide()
        self.tablero.hide()
        self.lbJug.hide()
        self.siPrimeraVez = True
예제 #5
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)
예제 #6
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)
예제 #7
0
    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()
예제 #8
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()
예제 #9
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()
예제 #10
0
    def __init__(self, wParent, sts, work):
        super(WWork, self).__init__(wParent)

        self.work = work

        self.setWindowTitle(sts.name)
        self.setWindowIcon(Iconos.Motor())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint
                            | QtCore.Qt.WindowMaximizeButtonHint)

        tb = QTUtil2.tbAcceptCancel(self)

        # Tabs
        tab = Controles.Tab()

        # Tab-basic --------------------------------------------------
        lbRef = Controles.LB(self, _("Reference") + ": ")
        self.edRef = Controles.ED(self, work.ref).anchoMinimo(360)

        lbInfo = Controles.LB(self, _("Information") + ": ")
        self.emInfo = Controles.EM(self, work.info,
                                   siHTML=False).anchoMinimo(360).altoFijo(60)

        lbDepth = Controles.LB(self, _("Maximum depth") + ": ")
        self.sbDepth = Controles.SB(self, work.depth, 0, 50)

        lbSeconds = Controles.LB(self, _("Maximum seconds to think") + ": ")
        self.sbSeconds = Controles.SB(self, work.seconds, 0, 9999)

        lbSample = Controles.LB(self, _("Sample") + ": ")
        self.sbIni = Controles.SB(self, work.ini + 1, 1,
                                  100).capturaCambiado(self.changeSample)
        self.sbIni.isIni = True
        lbGuion = Controles.LB(self, _("to"))
        self.sbEnd = Controles.SB(self, work.end + 1, 1,
                                  100).capturaCambiado(self.changeSample)
        self.sbEnd.isIni = False

        # self.lbError = Controles.LB(self).ponTipoLetra(peso=75).ponColorN("red")
        # self.lbError.hide()

        lySample = Colocacion.H().control(self.sbIni).control(lbGuion).control(
            self.sbEnd)
        ly = Colocacion.G()
        ly.controld(lbRef, 0, 0).control(self.edRef, 0, 1)
        ly.controld(lbInfo, 1, 0).control(self.emInfo, 1, 1)
        ly.controld(lbDepth, 2, 0).control(self.sbDepth, 2, 1)
        ly.controld(lbSeconds, 3, 0).control(self.sbSeconds, 3, 1)
        ly.controld(lbSample, 4, 0).otro(lySample, 4, 1)

        w = QtGui.QWidget()
        w.setLayout(ly)
        tab.nuevaTab(w, _("Basic data"))

        # Tab-Engine
        scrollArea = PantallaMotores.genOpcionesME(self, work.me)
        tab.nuevaTab(scrollArea, _("Engine options"))

        # Tab-Groups
        btAll = Controles.PB(self, _("All"), self.setAll, plano=False)
        btNone = Controles.PB(self, _("None"), self.setNone, plano=False)
        lyAN = Colocacion.H().control(btAll).espacio(10).control(btNone)
        self.liGroups = []
        ly = Colocacion.G()
        ly.columnaVacia(1, 10)
        fil = 0
        col = 0
        num = len(sts.groups)
        mitad = num / 2 + num % 2

        for x in range(num):
            group = sts.groups.group(x)
            chb = Controles.CHB(self, _F(group.name), work.liGroupActive[x])
            self.liGroups.append(chb)
            col = 0 if x < mitad else 2
            fil = x % mitad

            ly.control(chb, fil, col)
        ly.otroc(lyAN, mitad, 0, numColumnas=3)

        w = QtGui.QWidget()
        w.setLayout(ly)
        tab.nuevaTab(w, _("Groups"))

        layout = Colocacion.V().control(tb).control(tab).margen(8)
        self.setLayout(layout)

        self.edRef.setFocus()
예제 #11
0
    def __init__(self, w_parent, listaMotores, engine, siTorneo=False):

        super(WEngine, self).__init__(w_parent)

        self.setWindowTitle(engine.version)
        self.setWindowIcon(Iconos.Motor())
        self.setWindowFlags(
            QtCore.Qt.WindowCloseButtonHint
            | QtCore.Qt.Dialog
            | QtCore.Qt.WindowTitleHint
            | QtCore.Qt.WindowMinimizeButtonHint
            | QtCore.Qt.WindowMaximizeButtonHint
        )

        scrollArea = wgen_options_engine(self, engine)

        self.motorExterno = engine
        self.liMotores = listaMotores
        self.siTorneo = siTorneo

        # Toolbar
        tb = QTUtil2.tbAcceptCancel(self)

        lbAlias = Controles.LB2P(self, _("Alias"))
        self.edAlias = Controles.ED(self, engine.key).anchoMinimo(360)

        lbNombre = Controles.LB2P(self, _("Name"))
        self.edNombre = Controles.ED(self, engine.name).anchoMinimo(360)

        lbInfo = Controles.LB(self, _("Information") + ": ")
        self.emInfo = Controles.EM(self, engine.id_info, siHTML=False).anchoMinimo(360).altoFijo(60)

        lbElo = Controles.LB(self, "ELO: ")
        self.sbElo = Controles.SB(self, engine.elo, 0, 4000)

        lbExe = Controles.LB(self, "%s: %s" % (_("File"), Util.relative_path(engine.path_exe)))

        if siTorneo:
            lbDepth = Controles.LB(self, _("Maximum depth") + ": ")
            self.sbDepth = Controles.SB(self, engine.depth, 0, 50)

            lbTime = Controles.LB(self, _("Maximum seconds to think") + ": ")
            self.sbTime = Controles.SB(self, engine.time, 0, 9999)

            lbBook = Controles.LB(self, _("Opening book") + ": ")
            fvar = Code.configuration.file_books
            self.list_books = Books.ListBooks()
            self.list_books.restore_pickle(fvar)
            # # Comprobamos que todos esten accesibles
            self.list_books.check()
            li = [(x.name, x.path) for x in self.list_books.lista]
            li.insert(0, ("* " + _("None"), "-"))
            li.insert(0, ("* " + _("Default"), "*"))
            self.cbBooks = Controles.CB(self, li, engine.book)
            btNuevoBook = Controles.PB(self, "", self.nuevoBook, plano=False).ponIcono(Iconos.Nuevo(), icon_size=16)
            # # Respuesta rival
            li = (
                (_("Uniform random"), "au"),
                (_("Proportional random"), "ap"),
                (_("Always the highest percentage"), "mp"),
            )
            self.cbBooksRR = QTUtil2.comboBoxLB(self, li, engine.bookRR)
            lyBook = (
                Colocacion.H()
                .control(lbBook)
                .control(self.cbBooks)
                .control(self.cbBooksRR)
                .control(btNuevoBook)
                .relleno()
            )
            lyDT = (
                Colocacion.H()
                .control(lbDepth)
                .control(self.sbDepth)
                .espacio(40)
                .control(lbTime)
                .control(self.sbTime)
                .relleno()
            )
            lyTorneo = Colocacion.V().otro(lyDT).otro(lyBook)

        # Layout
        ly = Colocacion.G()
        ly.controld(lbAlias, 0, 0).control(self.edAlias, 0, 1)
        ly.controld(lbNombre, 1, 0).control(self.edNombre, 1, 1)
        ly.controld(lbInfo, 2, 0).control(self.emInfo, 2, 1)
        ly.controld(lbElo, 3, 0).control(self.sbElo, 3, 1)
        ly.control(lbExe, 4, 0, 1, 2)

        if siTorneo:
            ly.otro(lyTorneo, 5, 0, 1, 2)

        layout = Colocacion.V().control(tb).espacio(30).otro(ly).control(scrollArea)
        self.setLayout(layout)

        self.edAlias.setFocus()
    def __init__(self, wParent):
        QtGui.QWidget.__init__(self, wParent)

        self.wParent = wParent

        self.jg = None
        self.partida = None

        configuracion = VarGen.configuracion

        puntos = configuracion.puntosPGN

        f = Controles.TipoLetra(puntos=puntos, peso=75)
        f9 = Controles.TipoLetra(puntos=puntos)
        ftxt = f9

        # Apertura
        self.lbApertura = Controles.LB(self, "").ponFuente(f).alinCentrado().ponColorFondoN("#eeeeee", "#474d59").ponWrap()
        self.lbApertura.hide()

        # Valoracion
        liOpciones = [("-", "-")]
        dicNAGs = TrListas.dicNAGs()

        carpNAGs = "./IntFiles/NAGs"

        for x in dicNAGs:
            if x:
                fsvg = "%s/$%d.svg" % (carpNAGs, x)
                if os.path.isfile(fsvg):
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x), QTVarios.fsvg2ico(fsvg, 16)))
                else:
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x)))
        self.maxNAGs = 10
        self.liNAGs = []
        for x in range(self.maxNAGs):
            cb = Controles.CB(self, liOpciones, "").ponAnchoMinimo().capturaCambiado(self.valoracionCambiada).ponFuente(f9)
            if x:
                cb.hide()
            self.liNAGs.append(cb)

        btNAGS = Controles.PB(self, "", self.masNAGs).ponIcono(Iconos.Mas()).anchoFijo(22)

        liOpciones = [(x, x) for x in ("-", "!", "!!", "?", "??", "!?", "?!")]
        self.valoracionDirecta = Controles.CB(self, liOpciones, "-").ponAnchoFijo(42).capturaCambiado(self.valoracionDirectaCambiada)

        lyH = Colocacion.H().control(self.valoracionDirecta).control(self.liNAGs[0]).control(btNAGS)
        ly = Colocacion.V().otro(lyH)
        for x in range(1, self.maxNAGs):
            ly.control(self.liNAGs[x])

        self.gbValoracion = Controles.GB(self, _("Rating"), ly).ponFuente(f)

        # Comentarios
        self.comentario = Controles.EM(self, siHTML=False).capturaCambios(self.comentarioCambiado).ponFuente(ftxt).anchoMinimo(200)
        ly = Colocacion.H().control(self.comentario).margen(3)
        self.gbComentario = Controles.GB(self, _("Comments"), ly).ponFuente(f)

        # Variantes
        self.variantes = Variantes(self)

        self.splitter = splitter = QtGui.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        splitter.addWidget(self.gbComentario)
        splitter.addWidget(self.variantes)

        layout = Colocacion.V()
        layout.control(self.lbApertura)
        layout.control(self.gbValoracion)
        layout.control(self.splitter)
        layout.margen(1)

        self.setLayout(layout)
예제 #13
0
    def __init__(self, panelOpening, configuracion):
        QtGui.QWidget.__init__(self)

        self.panelOpening = panelOpening
        self.dbop = panelOpening.dbop

        self.partidabase = panelOpening.partidabase
        self.num_jg_inicial = len(self.partidabase)
        self.posJugada = self.num_jg_inicial

        confTablero = configuracion.confTablero("POSLINES", 32)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.ponMensajero(self.mueveHumano)
        self.tablero.dispatchSize(self.ajustaAncho)
        self.tablero.dbVisual_setFichero(self.dbop.nomFichero)
        self.tablero.dbVisual_setShowAllways(True)

        self.dbop.setdbVisual_Tablero(self.tablero)  # To close

        self.intervalo = 1400

        tipoLetra = Controles.TipoLetra(puntos=configuracion.puntosPGN)

        lybt, bt = QTVarios.lyBotonesMovimiento(self,
                                                "",
                                                siTiempo=True,
                                                siLibre=False,
                                                tamIcon=24)

        self.lbPGN = Controles.LB(self).ponWrap()
        self.lbPGN.colocate = self.colocatePartida
        self.lbPGN.setStyleSheet(
            "QLabel{ border-style: groove; border-width: 2px; border-color: LightSlateGray; padding: 8px;}"
        )
        self.lbPGN.ponFuente(tipoLetra)
        self.lbPGN.setOpenExternalLinks(False)

        def muestraPos(txt):
            self.colocatePartida(int(txt))

        self.connect(self.lbPGN, QtCore.SIGNAL("linkActivated(QString)"),
                     muestraPos)

        self.siFigurines = configuracion.figurinesPGN

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion[BUENO] = (dicNAGs[1],
                                     PantallaColores.nag2ico(1, 16))
        self.dicValoracion[MALO] = (dicNAGs[2], PantallaColores.nag2ico(2, 16))
        self.dicValoracion[MUY_BUENO] = (dicNAGs[3],
                                         PantallaColores.nag2ico(3, 16))
        self.dicValoracion[MUY_MALO] = (dicNAGs[4],
                                        PantallaColores.nag2ico(4, 16))
        self.dicValoracion[INTERESANTE] = (dicNAGs[5],
                                           PantallaColores.nag2ico(5, 16))
        self.dicValoracion[DUDOSA] = (dicNAGs[6],
                                      PantallaColores.nag2ico(6, 16))
        self.dicValoracion[SIN_VALORACION] = (_("No rating"), QtGui.QIcon())

        self.dicVentaja = collections.OrderedDict()
        self.dicVentaja[V_SIN] = (_("Undefined"), QtGui.QIcon())
        self.dicVentaja[V_IGUAL] = (dicNAGs[11],
                                    Iconos.V_Blancas_Igual_Negras())
        self.dicVentaja[V_BLANCAS] = (dicNAGs[14], Iconos.V_Blancas())
        self.dicVentaja[V_BLANCAS_MAS] = (dicNAGs[16], Iconos.V_Blancas_Mas())
        self.dicVentaja[V_BLANCAS_MAS_MAS] = (dicNAGs[18],
                                              Iconos.V_Blancas_Mas_Mas())
        self.dicVentaja[V_NEGRAS] = (dicNAGs[15], Iconos.V_Negras())
        self.dicVentaja[V_NEGRAS_MAS] = (dicNAGs[17], Iconos.V_Negras_Mas())
        self.dicVentaja[V_NEGRAS_MAS_MAS] = (dicNAGs[19],
                                             Iconos.V_Negras_Mas_Mas())

        # Valoracion
        liOpciones = [(tit[0], k, tit[1])
                      for k, tit in self.dicValoracion.iteritems()]
        self.cbValoracion = Controles.CB(self, liOpciones, 0).capturaCambiado(
            self.cambiadoValoracion)
        self.cbValoracion.ponFuente(tipoLetra)

        # Ventaja
        liOpciones = [(tit, k, icon)
                      for k, (tit, icon) in self.dicVentaja.iteritems()]
        self.cbVentaja = Controles.CB(self, liOpciones,
                                      0).capturaCambiado(self.cambiadoVentaja)
        self.cbVentaja.ponFuente(tipoLetra)

        # Comentario
        self.emComentario = Controles.EM(self, siHTML=False).capturaCambios(
            self.cambiadoComentario)
        self.emComentario.ponFuente(tipoLetra)
        self.emComentario.altoFijo(5 * configuracion.altoFilaPGN)
        lyVal = Colocacion.H().control(self.cbValoracion).control(
            self.cbVentaja)
        lyEd = Colocacion.V().otro(lyVal).control(self.emComentario)

        # Apertura
        self.lbApertura = Controles.LB(self).alinCentrado().ponFuente(
            tipoLetra).ponWrap()

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbPGN).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        layout.otro(lyEd)
        layout.control(self.lbApertura)
        layout.relleno()
        self.setLayout(layout)

        self.ajustaAncho()

        self.siReloj = False

        self.ponPartida(self.partidabase)
예제 #14
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()
예제 #15
0
    def __init__(self, w_parent):
        QtWidgets.QWidget.__init__(self, w_parent)

        self.w_parent = w_parent

        self.move = None
        self.game = None

        configuration = Code.configuration

        puntos = configuration.x_pgn_fontpoints

        f = Controles.TipoLetra(puntos=puntos, peso=75)
        f9 = Controles.TipoLetra(puntos=puntos)
        ftxt = f9

        # Opening
        self.lb_opening = (Controles.LB(
            self, "").ponFuente(f).align_center().set_foreground_backgound(
                "#eeeeee", "#474d59").set_wrap())
        self.lb_opening.hide()

        # Valoracion
        li_options = [("-", None)]
        dic_nags = TrListas.dic_nags()

        nags_folder = Code.path_resource("IntFiles", "NAGs")

        ico_vacio = QTVarios.fsvg2ico("%s/$0.svg" % (nags_folder, ), 16)

        for x in dic_nags:
            if x:
                fsvg = "%s/$%d.svg" % (nags_folder, x)
                if os.path.isfile(fsvg):
                    li_options.append(("$%d : %s" % (x, dic_nags[x]), x,
                                       QTVarios.fsvg2ico(fsvg, 16)))
                else:
                    li_options.append(
                        ("$%d : %s" % (x, dic_nags[x]), x, ico_vacio))
        self.max_nags = 10
        self.li_nags = []
        for x in range(self.max_nags):
            cb = (Controles.CB(self, li_options,
                               "").set_widthMinimo().capture_changes(
                                   self.valoration_changed).ponFuente(f9))
            if x:
                cb.hide()
            self.li_nags.append(cb)

        bt_nags = Controles.PB(self, "", self.more_nags).ponIcono(
            Iconos.Mas()).anchoFijo(22)

        ly_h = Colocacion.H().control(self.li_nags[0]).control(bt_nags)
        ly = Colocacion.V().otro(ly_h)
        for x in range(1, self.max_nags):
            ly.control(self.li_nags[x])

        self.gbValoracion = Controles.GB(self, _("Rating"), ly).ponFuente(f)

        # Comentarios
        self.comment = (Controles.EM(self, siHTML=False).capturaCambios(
            self.comment_changed).ponFuente(ftxt).anchoMinimo(200))
        ly = Colocacion.H().control(self.comment).margen(3)
        self.gb_comments = Controles.GB(self, _("Comments"), ly).ponFuente(f)

        # Variations
        self.variantes = WVariations(self)

        self.splitter = splitter = QtWidgets.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        splitter.addWidget(self.gb_comments)
        splitter.addWidget(self.variantes)
        splitter.setSizes([1, 1])

        layout = Colocacion.V()
        layout.control(self.lb_opening)
        layout.control(self.gbValoracion)
        layout.control(self.splitter)
        layout.margen(1)

        self.setLayout(layout)

        self.setMinimumWidth(220)
예제 #16
0
    def __init__(self, wParent):
        QtGui.QWidget.__init__(self, wParent)

        self.wParent = wParent

        self.jg = None
        self.partida = None

        puntos = VarGen.configuracion.puntosPGN

        f = Controles.TipoLetra(puntos=puntos, peso=75)
        # ftxt = Controles.TipoLetra( nombre="Courier New", puntos=puntos )
        f9 = Controles.TipoLetra(puntos=puntos)
        ftxt = f9

        # Apertura
        self.lbApertura = Controles.LB(
            self, "").ponFuente(f).alinCentrado().ponColorFondoN(
                "#eeeeee", "#474d59").ponWrap()
        self.lbApertura.hide()

        # Valoracion
        liOpciones = [("-", "-")]
        dicNAGs = TrListas.dicNAGs()

        carpNAGs = "./IntFiles/NAGs"

        for x in dicNAGs:
            if x:
                fsvg = "%s/$%d.svg" % (carpNAGs, x)
                if os.path.isfile(fsvg):
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x),
                                       QTVarios.fsvg2ico(fsvg, 16)))
                else:
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x)))
        self.maxNAGs = 10
        self.liNAGs = []
        for x in range(self.maxNAGs):
            cb = Controles.CB(self, liOpciones,
                              "").ponAnchoMinimo().capturaCambiado(
                                  self.valoracionCambiada).ponFuente(f9)
            if x:
                cb.hide()
            self.liNAGs.append(cb)

        liOpciones = [(x, x) for x in ("-", "!", "!!", "?", "??", "!?", "?!")]
        self.valoracionDirecta = Controles.CB(
            self, liOpciones, "-").ponAnchoFijo(42).capturaCambiado(
                self.valoracionDirectaCambiada)

        lyH = Colocacion.H().control(self.valoracionDirecta).control(
            self.liNAGs[0])
        ly = Colocacion.V().otro(lyH)
        for x in range(1, self.maxNAGs):
            ly.control(self.liNAGs[x])

        self.gbValoracion = Controles.GB(self, _("Rating"), ly).ponFuente(f)

        # Comentarios
        self.comentario = Controles.EM(self, siHTML=False).capturaCambios(
            self.comentarioCambiado).ponFuente(ftxt).anchoMinimo(200)

        ly = Colocacion.H().control(self.comentario)
        self.gbComentario = Controles.GB(self, _("Comments"), ly).ponFuente(f)

        # Variantes
        liAcciones = (
            (_("Append"), Iconos.Mas(), self.tbMasVariante),
            None,
            ("%s+%s" % (_("Append"), _("Engine")), Iconos.MasR(),
             self.tbMasVarianteR),
            None,
            (_("Edit"), Iconos.ComentarioEditar(), self.tbEditarVariante),
            None,
            (_("Remove"), Iconos.Borrar(), self.tbBorrarVariante),
            None,
        )
        tbVariantes = Controles.TBrutina(self,
                                         liAcciones,
                                         siTexto=False,
                                         tamIcon=16)

        self.variantes = Controles.EM(self, siHTML=False).capturaCambios(
            self.variantesCambiado).ponFuente(ftxt)
        self.variantes.capturaDobleClick(self.variantesDobleClick)
        self.variantes.setReadOnly(True)
        ly = Colocacion.V().control(tbVariantes).control(self.variantes)
        self.gbVariantes = Controles.GB(self, _("Variants"), ly).ponFuente(f)

        self.splitter = splitter = QtGui.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        splitter.addWidget(self.gbComentario)
        splitter.addWidget(self.gbVariantes)

        layout = Colocacion.V()
        layout.control(self.lbApertura)
        layout.control(self.gbValoracion)
        layout.control(self.splitter)
        # layout.control(self.gbComentario)
        # layout.control(self.gbVariantes)
        layout.margen(5)

        self.setLayout(layout)
예제 #17
0
    def __init__(self, w_parent):
        QtWidgets.QWidget.__init__(self, w_parent)

        self.w_parent = w_parent

        self.move = None
        self.game = None

        configuration = Code.configuration

        puntos = configuration.x_pgn_fontpoints

        font = Controles.TipoLetra(puntos=puntos)
        font_bold = Controles.TipoLetra(puntos=puntos, peso=75)

        self.themes = Themes.Themes()
        self.nags = Nags.Nags()

        # Opening
        self.lb_opening = Controles.LB(self, "").ponFuente(font).align_center().set_foreground_backgound("#eeeeee", "#474d59").set_wrap()
        self.lb_opening.hide()

        # Valoracion
        self.w_rating = QtWidgets.QWidget(self)
        ly_rating = Colocacion.V().margen(0)

        li_acciones = [(_("Rating"), Iconos.Mas(), self.edit_rating), None, (_("Theme"), Iconos.MasR(), self.edit_theme)]
        tb = QTVarios.LCTB(self, li_acciones, icon_size=16, style=QtCore.Qt.ToolButtonTextBesideIcon)
        ly_rating.control(tb)

        self.lb_rating = Controles.LB(self).ponFuente(font_bold).set_wrap()
        self.lb_rating.hide()
        self.lb_rating.setStyleSheet("*{ border: 1px solid lightgray; padding:2px; background: #f7f2f0}")
        self.lb_rating.mousePressEvent = self.edit_rating
        ly_rating.control(self.lb_rating)

        self.lb_theme = Controles.LB(self).ponFuente(font_bold).set_wrap()
        self.lb_theme.hide()
        self.lb_theme.setStyleSheet("*{ border: 1px solid lightgray; padding:2px; background: #fdfae8}")
        self.lb_theme.mousePressEvent = self.edit_theme
        ly_rating.control(self.lb_theme)
        self.w_rating.setLayout(ly_rating)

        # Comentarios
        self.comment = Controles.EM(self, siHTML=False).capturaCambios(self.comment_changed).ponFuente(font).anchoMinimo(200)
        ly = Colocacion.H().control(self.comment).margen(3)
        self.gb_comments = Controles.GB(self, _("Comments"), ly).ponFuente(font_bold)

        # Variations
        self.variantes = WVariations(self)

        self.splitter = splitter = QtWidgets.QSplitter(self)
        splitter.setOrientation(QtCore.Qt.Vertical)
        splitter.addWidget(self.gb_comments)
        splitter.addWidget(self.variantes)
        splitter.setSizes([1, 1])
        self.sp_sizes = None

        layout = Colocacion.V()
        layout.control(self.lb_opening)
        layout.control(self.w_rating)
        layout.control(splitter)
        layout.margen(1)

        self.setLayout(layout)

        self.setMinimumWidth(220)
예제 #18
0
    def __init__(self, wowner, gestor, alm, muestraAnalisis):
        titulo = _("Result of analysis")
        icono = Iconos.Estadisticas()
        extparam = "estadisticasv1"
        super().__init__(parent=wowner, titulo=titulo, icono=icono, extparam=extparam)
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint)

        self.alm = alm
        self.procesador = gestor.procesador
        self.gestor = gestor
        self.configuracion = gestor.configuracion
        self.siPawns = not gestor.procesador.configuracion.centipawns
        self.muestraAnalisis = muestraAnalisis
        self.colorWhite = QTUtil.qtColorRGB(231, 244, 254)

        def xcol():
            oColumnas = Columnas.ListaColumnas()
            oColumnas.nueva("NUM", _("N."), 50, siCentrado=True)
            oColumnas.nueva("MOVE", _("Move"), 120, siCentrado=True, edicion=Delegados.EtiquetaPGN(True, True, True))
            oColumnas.nueva("BEST", _("Best move"), 120, siCentrado=True, edicion=Delegados.EtiquetaPGN(True, True, True))
            oColumnas.nueva("DIF", _("Difference"), 80, siCentrado=True)
            oColumnas.nueva("PORC", "%", 80, siCentrado=True)
            oColumnas.nueva("ELO", _("Elo"), 80, siCentrado=True)
            return oColumnas

        self.dicLiJG = {"A": self.alm.lijg, "W": self.alm.lijgW, "B": self.alm.lijgB}
        gridAll = Grid.Grid(self, xcol(), siSelecFilas=True, xid="A")
        anchoGrid = gridAll.fixMinWidth()
        self.registrarGrid(gridAll)
        gridW = Grid.Grid(self, xcol(), siSelecFilas=True, xid="W")
        anchoGrid = max(gridW.fixMinWidth(), anchoGrid)
        self.registrarGrid(gridW)
        gridB = Grid.Grid(self, xcol(), siSelecFilas=True, xid="B")
        anchoGrid = max(gridB.fixMinWidth(), anchoGrid)
        self.registrarGrid(gridB)

        self.emIndexes = Controles.EM(self, alm.indexesHTML).soloLectura()
        pbSave = Controles.PB(self, _("Save to game comments"), self.saveIndexes, plano=False)
        pbSave.ponIcono(Iconos.Grabar())
        ly0 = Colocacion.H().control(pbSave).relleno()
        ly = Colocacion.V().control(self.emIndexes).otro(ly0).relleno()
        wIdx = QtWidgets.QWidget()
        wIdx.setLayout(ly)

        self.tabGrid = tabGrid = Controles.Tab()
        tabGrid.nuevaTab(gridAll, _("All moves"))
        tabGrid.nuevaTab(gridW, _("White"))
        tabGrid.nuevaTab(gridB, _("Black"))
        tabGrid.nuevaTab(wIdx, _("Indexes"))
        tabGrid.dispatchChange(self.tabChanged)
        self.tabActive = 0

        confTablero = VarGen.configuracion.confTablero("ANALISISGRAPH", 48)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.dispatchSize(self.tableroSizeChanged)

        self.capturas = WCapturas.CapturaLista(self, self.tablero)
        ly_tc = Colocacion.H().control(self.tablero).control(self.capturas)

        self.rbShowValues = Controles.RB(self, _("Values"), rutina=self.cambiadoShow).activa(True)
        self.rbShowElo = Controles.RB(self, _("Elo performance"), rutina=self.cambiadoShow)
        self.chbShowLostPoints = Controles.CHB(self, _("Show lost points"), self.getShowLostPoints()).capturaCambiado(self, self.showLostPointsChanged)
        ly_rb = Colocacion.H().espacio(40).control(self.rbShowValues).espacio(20).control(self.rbShowElo).espacio(30).control(self.chbShowLostPoints).relleno(1)

        layout = Colocacion.G()
        layout.controlc(tabGrid, 0, 0)
        layout.otroc(ly_rb, 1, 0)
        layout.otroc(ly_tc, 0, 1, numFilas=2)

        Controles.Tab().ponPosicion("W")
        ancho = self.tablero.width() + anchoGrid
        self.htotal = [ Histogram.Histogram(self, alm.hgame, gridAll, ancho, True),
                        Histogram.Histogram(self, alm.hwhite, gridW, ancho, True),
                        Histogram.Histogram(self, alm.hblack, gridB, ancho, True),
                        Histogram.Histogram(self, alm.hgame, gridAll, ancho, False, alm.eloT),
                        Histogram.Histogram(self, alm.hwhite, gridW, ancho, False, alm.eloW),
                        Histogram.Histogram(self, alm.hblack, gridB, ancho, False, alm.eloB)
        ]
        lh = Colocacion.V()
        for x in range(6):
            lh.control(self.htotal[x])
            if x:
                self.htotal[x].hide()

        layout.otroc(lh, 2, 0, 1, 3)
        self.setLayout(layout)

        self.recuperarVideo()

        gridAll.gotop()
        gridB.gotop()
        gridW.gotop()
        self.gridBotonIzquierdo(gridAll, 0, None)
        th = self.tablero.height()
        self.tabGrid.setFixedHeight(th)
        self.adjustSize()
        self.emIndexes.setFixedHeight(th - 72)
예제 #19
0
    def __init__(self, owner, game, configuracion):
        titulo = _("Save to PGN")
        icono = Iconos.PGN()
        extparam = "savepgn"
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.game = game
        self.game.order_tags()
        self.body = self.game.pgnBase()
        self.li_labels = self.game.li_tags
        self.configuracion = configuracion
        self.file = ""
        self.vars_read()

        # Opciones
        li_options = [
            (_("Save"), Iconos.GrabarFichero(), self.save),
            None,
            (_("Cancel"), Iconos.Cancelar(), self.terminar),
            None,
            (_("Clipboard"), Iconos.Clipboard(), self.portapapeles),
            None,
            (_("Reinit"), Iconos.Reiniciar(), self.reinit),
            None,
        ]
        tb = QTVarios.LCTB(self, li_options)

        tabs = Controles.Tab(self)

        # Tab-fichero -----------------------------------------------------------------------------------------------
        lb_file = Controles.LB(self, _("File to save") + ": ")
        bt_history = Controles.PB(self, "", self.history).ponIcono(
            Iconos.Favoritos(), 24).ponToolTip(_("Previous"))
        bt_boxrooms = (Controles.PB(self, "", self.boxrooms).ponIcono(
            Iconos.BoxRooms(), 24).ponToolTip(_("Boxrooms PGN")))
        self.bt_file = Controles.PB(self, "", self.file_select,
                                    plano=False).anchoMinimo(300)

        # Codec
        lb_codec = Controles.LB(self, _("Encoding") + ": ")
        liCodecs = [
            k for k in set(v for k, v in encodings.aliases.aliases.items())
        ]
        liCodecs.sort()
        liCodecs = [(k, k) for k in liCodecs]
        liCodecs.insert(0, (_("Same as file"), "file"))
        liCodecs.insert(0,
                        ("%s: %s" % (_("By default"), _("UTF-8")), "default"))
        self.cb_codecs = Controles.CB(self, liCodecs, self.codec)

        # Rest
        self.chb_overwrite = Controles.CHB(self, _("Overwrite"), False)
        self.chb_remove_c_v = Controles.CHB(
            self, _("Remove comments and variations"), self.remove_c_v)

        lyF = Colocacion.H().control(lb_file).control(
            self.bt_file).control(bt_history).control(bt_boxrooms).relleno(1)
        lyC = Colocacion.H().control(lb_codec).control(
            self.cb_codecs).relleno(1)
        ly = (Colocacion.V().espacio(15).otro(lyF).otro(lyC).control(
            self.chb_overwrite).control(self.chb_remove_c_v).relleno(1))
        w = QtWidgets.QWidget()
        w.setLayout(ly)
        tabs.nuevaTab(w, _("File"))
        self.chb_overwrite.hide()

        # Tab-labels -----------------------------------------------------------------------------------------------
        liAccionesWork = (
            ("", Iconos.Mas22(), self.labels_more),
            None,
            ("", Iconos.Menos22(), self.labels_less),
            None,
            ("", Iconos.Arriba(), self.labels_up),
            None,
            ("", Iconos.Abajo(), self.labels_down),
            None,
        )
        tb_labels = Controles.TBrutina(self,
                                       liAccionesWork,
                                       tamIcon=16,
                                       siTexto=False)

        # Lista
        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("ETIQUETA",
                        _("Label"),
                        150,
                        edicion=Delegados.LineaTextoUTF8())
        o_columns.nueva("VALOR",
                        _("Value"),
                        400,
                        edicion=Delegados.LineaTextoUTF8())

        self.grid_labels = Grid.Grid(self, o_columns, siEditable=True)
        n = self.grid_labels.anchoColumnas()
        self.grid_labels.setFixedWidth(n + 20)

        # Layout
        ly = Colocacion.V().control(tb_labels).control(
            self.grid_labels).margen(3)
        w = QtWidgets.QWidget()
        w.setLayout(ly)
        tabs.nuevaTab(w, _("Labels"))

        # Tab-Body -----------------------------------------------------------------------------------------------
        self.em_body = Controles.EM(self, self.body, siHTML=False)
        tabs.nuevaTab(self.em_body, _("Body"))

        layout = Colocacion.V().control(tb).control(tabs)

        self.setLayout(layout)

        if self.history_list:
            fich = self.history_list[0]
            if os.path.isfile(fich):
                self.file = fich
                self.show_file()

        self.register_grid(self.grid_labels)
        self.restore_video()
예제 #20
0
    def __init__(self, winBookGuide, siMoves=True):
        QtGui.QWidget.__init__(self)

        self.siMoves = siMoves
        self.winBookGuide = winBookGuide
        if self.siMoves:
            self.tree = winBookGuide.wmoves.tree
        else:
            self.tree = None
        self.movActual = None

        configuracion = VarGen.configuracion
        confTablero = configuracion.confTablero("INFOMOVEBOOKGUIDE", 32)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.ponMensajero(self.mueveHumano)
        self.cpActual = ControlPosicion.ControlPosicion()
        self.historia = None
        self.posHistoria = None

        self.intervalo = 1400

        lybt, bt = QTVarios.lyBotonesMovimiento(self,
                                                "",
                                                siTiempo=True,
                                                siLibre=False,
                                                tamIcon=24)

        self.lbPGN = Controles.LB(self).anchoFijo(self.tablero.ancho).ponWrap()
        self.lbPGN.colocate = self.colocatePartida
        self.lbPGN.setStyleSheet(
            "QLabel{ border-style: groove; border-width: 2px; border-color: LightSlateGray; padding: 8px;}"
        )
        self.lbPGN.ponTipoLetra(puntos=configuracion.puntosPGN)
        self.lbPGN.setOpenExternalLinks(False)

        def muestraPos(txt):
            self.colocatePartida(int(txt))

        self.connect(self.lbPGN, QtCore.SIGNAL("linkActivated(QString)"),
                     muestraPos)

        self.siFigurines = configuracion.figurinesPGN

        if siMoves:
            tree = winBookGuide.wmoves.tree
            # Valoracion
            liOpciones = [(tit[0], k, tit[1])
                          for k, tit in tree.dicValoracion.iteritems()]
            self.lbValoracion = Controles.LB(self, _("Rating") + ":")
            self.cbValoracion = Controles.CB(
                self, liOpciones, 0).capturaCambiado(self.cambiadoValoracion)

            # Ventaja
            liOpciones = [(tit, k, icon)
                          for k, (tit, icon) in tree.dicVentaja.iteritems()]
            self.lbVentaja = Controles.LB(self, _("Advantage") + ":")
            self.cbVentaja = Controles.CB(self, liOpciones, 0).capturaCambiado(
                self.cambiadoVentaja)

            # Comentario
            self.emComentario = Controles.EM(
                self, siHTML=False).capturaCambios(self.cambiadoComentario)

            lyVal = Colocacion.H().control(self.lbValoracion).control(
                self.cbValoracion).relleno()
            lyVen = Colocacion.H().control(self.lbVentaja).control(
                self.cbVentaja).relleno()
            lyEd = Colocacion.V().otro(lyVal).otro(lyVen).control(
                self.emComentario)
        else:
            self.lbOpening = Controles.LB(self).alinCentrado().ponWrap()
            self.lbOpening.ponTipoLetra(puntos=10, peso=200)
            lyO = Colocacion.H().relleno().control(self.lbOpening).relleno()

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbPGN).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        if not siMoves:
            layout.otro(lyO)
        layout.otro(lya)
        if siMoves:
            layout.otro(lyEd)
        layout.relleno()
        self.setLayout(layout)

        self.usoNormal = True

        self.siReloj = False
예제 #21
0
    def __init__(self, procesador):

        icono = Iconos.ManualSave()
        extparam = "manualsave"
        titulo = _("Save positions to FNS/PGN")
        QTVarios.WDialogo.__init__(self, procesador.pantalla, titulo, icono, extparam)

        self.procesador = procesador
        self.configuracion = procesador.configuracion

        self.posicion = ControlPosicion.ControlPosicion()
        self.posicion.posInicial()

        self.gestor_motor = None
        self.pgn = None
        self.fns = None

        self.li_labels = [
            ["Site", ""],
            ["Event", ""],
            ["Date", ""],
            ["White", ""],
            ["Black", ""],
            ["WhiteElo", ""],
            ["BlackElo", ""],
            ["Result", ""],
        ]
        self.li_labels.extend([["", ""] for x in range(10)])

        self.li_analysis = []
        self.analyzing = False

        self.partida = None

        # Toolbar
        liAcciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar), None,
            (_("External engines"), Iconos.Motores(), self.ext_engines), None,
        )
        tb = QTVarios.LCTB(self, liAcciones)

        # Board + botones + solucion + boton salvado
        ##
        bt_change_position = Controles.PB(self, "   " + _("Change position"), self.change_position, plano=False)
        bt_change_position.ponIcono(Iconos.Datos(), 24)
        ##
        conf_tablero = self.configuracion.confTablero("MANUALSAVE", 32)
        self.tablero = Tablero.Tablero(self, conf_tablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        ##
        lybt, bt = QTVarios.lyBotonesMovimiento(self, "", siLibre=False, tamIcon=24, siTiempo=False)
        ##
        self.em_solucion = Controles.EM(self, siHTML=False).altoMinimo(40).capturaCambios(self.reset_partida)
        ##
        self.bt_solucion = Controles.PB(self, "   " + _("Save solution"), self.savesolucion, plano=False).ponIcono(Iconos.Grabar(), 24)
        self.bt_editar = Controles.PB(self, "   " + _("Edit"), self.editar_solucion, plano=False).ponIcono(Iconos.PlayGame())
        ly = Colocacion.V().control(self.em_solucion).control(self.bt_editar)
        gb = Controles.GB(self, _("Solution"), ly)
        ###
        lybtp = Colocacion.H().control(bt_change_position).espacio(20).control(self.bt_solucion)
        lyT = Colocacion.V().otro(lybtp).control(self.tablero).otro(lybt).control(gb)
        gb_left = Controles.GB(self, "", lyT)

        # Ficheros PGN + FNS
        lb_pgn = Controles.LB(self, _("PGN") + ": ")
        self.bt_pgn = Controles.PB(self, "", self.pgn_select, plano=False).anchoMinimo(300)
        bt_no_pgn = Controles.PB(self, "", self.pgn_unselect).ponIcono(Iconos.Delete()).anchoFijo(16)
        lb_fns = Controles.LB(self, _("FNS") + ": ")
        self.bt_fns = Controles.PB(self, "", self.fns_select, plano=False).anchoMinimo(300)
        bt_no_fns = Controles.PB(self, "", self.fns_unselect).ponIcono(Iconos.Delete()).anchoFijo(16)
        ## Codec
        lb_codec = Controles.LB(self, _("Encoding") + ": ")
        liCodecs = [k for k in set(v for k, v in encodings.aliases.aliases.iteritems())]
        liCodecs.sort()
        liCodecs = [(k, k) for k in liCodecs]
        liCodecs.insert(0, ("%s: %s" % (_("By default"), _("UTF-8")), "default"))
        self.codec = "default"
        self.cb_codecs = Controles.CB(self, liCodecs, self.codec)
        ###
        ly0 = Colocacion.G().control(lb_pgn, 0, 0).control(self.bt_pgn, 0, 1).control(bt_no_pgn, 0, 2)
        ly0.control(lb_fns, 1, 0).control(self.bt_fns, 1, 1).control(bt_no_fns, 1, 2)
        ly1 = Colocacion.H().control(lb_codec).control(self.cb_codecs).relleno(1)
        ly = Colocacion.V().otro(ly0).otro(ly1)
        gb_files = Controles.GB(self, _("File to save"), ly)

        # Labels + correlativo
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("LABEL", _("Label"), 80, edicion=Delegados.LineaTextoUTF8(), siCentrado=True)
        oColumnas.nueva("VALUE", _("Value"), 280, edicion=Delegados.LineaTextoUTF8())
        self.grid_labels = Grid.Grid(self, oColumnas, siEditable=True, xid=1)
        n = self.grid_labels.anchoColumnas()
        self.grid_labels.setFixedWidth(n + 20)
        self.registrarGrid(self.grid_labels)

        ##
        lb_number = Controles.LB(self, _("Correlative number")+": ")
        self.sb_number = Controles.SB(self, 0, 0, 99999999).tamMaximo(50)
        lb_number_help = Controles.LB(self, _("Replace symbol # in Value column (#=3, ###=003)"))
        lb_number_help.setWordWrap(True)

        ly_number = Colocacion.H().control(lb_number).control(self.sb_number).control(lb_number_help, 4)

        ly = Colocacion.V().control(self.grid_labels).otro(ly_number)
        gb_labels = Controles.GB(self, _("PGN labels"), ly)

        # Analysis + grid + start/stop + multiPV
        self.bt_start = Controles.PB(self, "", self.start).ponIcono(Iconos.Pelicula_Seguir(), 32)
        self.bt_stop = Controles.PB(self, "", self.stop).ponIcono(Iconos.Pelicula_Pausa(), 32)
        self.bt_stop.hide()

        lb_engine = Controles.LB(self, _("Engine") + ":")
        liMotores = self.configuracion.comboMotoresCompleto()
        self.cb_engine = Controles.CB(self, liMotores, self.configuracion.tutor.clave).capturaCambiado(self.reset_motor)

        lb_multipv = Controles.LB(self, _("Multi PV")+": ")
        self.sb_multipv = Controles.SB(self, 1, 1, 500).tamMaximo(50)
        ##
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("PDT", _("Evaluation"), 100, siCentrado=True)
        oColumnas.nueva("PGN", _("Solution"), 360)
        self.grid_analysis = Grid.Grid(self, oColumnas, siSelecFilas=True)
        self.registrarGrid(self.grid_analysis)
        ##
        lb_analysis_help = Controles.LB(self, _("Double click to send analysis line to solution"))
        ###
        ly_lin1 = Colocacion.H().control(self.bt_start).control(self.bt_stop).control(lb_engine).control(self.cb_engine)
        ly_lin1.relleno(1).control(lb_multipv).control(self.sb_multipv)
        ly = Colocacion.V().otro(ly_lin1).control(self.grid_analysis).control(lb_analysis_help)
        gb_analysis = Controles.GB(self, _("Analysis"), ly)

        # ZONA
        splitter_right = QtGui.QSplitter(self)
        splitter_right.setOrientation(QtCore.Qt.Vertical)
        splitter_right.addWidget(gb_files)
        splitter_right.addWidget(gb_labels)
        splitter_right.addWidget(gb_analysis)

        self.registrarSplitter(splitter_right, "RIGHT")
        ##
        splitter = QtGui.QSplitter(self)
        splitter.addWidget(gb_left)
        splitter.addWidget(splitter_right)

        self.registrarSplitter(splitter, "ALL")

        layout = Colocacion.V().control(tb).control(splitter).margen(5)

        self.setLayout(layout)

        self.inicializa()
예제 #22
0
    def __init__(self, wParent, listaMotores, motorExterno, siTorneo=False):

        super(WMotor, self).__init__(wParent)

        self.setWindowTitle(motorExterno.idName)
        self.setWindowIcon(Iconos.Motor())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint
                            | QtCore.Qt.WindowMaximizeButtonHint)

        scrollArea = genOpcionesME(self, motorExterno)

        self.motorExterno = motorExterno
        self.liMotores = listaMotores if siTorneo else listaMotores.liMotores
        self.siTorneo = siTorneo

        # Toolbar
        tb = QTUtil2.tbAcceptCancel(self)

        lbAlias = Controles.LB(self, _("Alias") + ": ")
        self.edAlias = Controles.ED(self, motorExterno.alias).anchoMinimo(360)

        lbInfo = Controles.LB(self, _("Information") + ": ")
        self.emInfo = Controles.EM(self, motorExterno.idInfo,
                                   siHTML=False).anchoMinimo(360).altoFijo(60)

        lbElo = Controles.LB(self, "ELO" + ": ")
        self.sbElo = Controles.SB(self, motorExterno.elo, 0, 4000)

        if siTorneo:
            lbDepth = Controles.LB(self, _("Maximum depth") + ": ")
            self.sbDepth = Controles.SB(self, motorExterno.depth(), 0, 50)

            lbTime = Controles.LB(self, _("Maximum seconds to think") + ": ")
            self.sbTime = Controles.SB(self, motorExterno.time(), 0, 9999)

            lbBook = Controles.LB(self, _("Opening book") + ": ")
            fvar = VarGen.configuracion.ficheroBooks
            self.listaLibros = Books.ListaLibros()
            self.listaLibros.recuperaVar(fvar)
            # # Comprobamos que todos esten accesibles
            self.listaLibros.comprueba()
            li = [(x.nombre, x.path) for x in self.listaLibros.lista]
            li.insert(0, ("* " + _("Engine book"), "-"))
            li.insert(0, ("* " + _("Default"), "*"))
            self.cbBooks = Controles.CB(self, li, motorExterno.book())
            btNuevoBook = Controles.PB(self, "", self.nuevoBook,
                                       plano=False).ponIcono(Iconos.Nuevo(),
                                                             tamIcon=16)
            # # Respuesta rival
            li = (
                (_("Uniform random"), "au"),
                (_("Proportional random"), "ap"),
                (_("Always the highest percentage"), "mp"),
            )
            self.cbBooksRR = QTUtil2.comboBoxLB(self, li,
                                                motorExterno.bookRR())
            lyBook = Colocacion.H().control(lbBook).control(
                self.cbBooks).control(
                    self.cbBooksRR).control(btNuevoBook).relleno()
            lyDT = Colocacion.H().control(lbDepth).control(
                self.sbDepth).espacio(40).control(lbTime).control(
                    self.sbTime).relleno()
            lyTorneo = Colocacion.V().otro(lyDT).otro(lyBook)

        # Layout
        ly = Colocacion.G()
        ly.controld(lbAlias, 0, 0).control(self.edAlias, 0, 1)
        ly.controld(lbInfo, 1, 0).control(self.emInfo, 1, 1)
        ly.controld(lbElo, 2, 0).control(self.sbElo, 2, 1)

        if siTorneo:
            ly.otro(lyTorneo, 3, 0, 1, 2)

        layout = Colocacion.V().control(tb).espacio(30).otro(ly).control(
            scrollArea)
        self.setLayout(layout)

        self.edAlias.setFocus()
예제 #23
0
    def __init__(self, panelOpening, configuracion):
        QtWidgets.QWidget.__init__(self)

        self.panelOpening = panelOpening
        self.dbop = panelOpening.dbop

        self.configuracion = configuracion

        self.partidabase = panelOpening.partidabase
        self.num_jg_inicial = len(self.partidabase)
        self.pos_move = self.num_jg_inicial

        config_board = configuracion.config_board("POSLINES", 32)
        self.tablero = Tablero.Tablero(self, config_board)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.set_dispatcher(self.mueve_humano)
        self.tablero.dispatchSize(self.ajustaAncho)
        self.tablero.dbVisual_setFichero(self.dbop.nom_fichero)
        self.tablero.dbVisual_setShowAllways(True)
        self.tablero.dbVisual_setSaveAllways(True)

        self.tablero.ponerPiezasAbajo(self.dbop.getconfig("WHITEBOTTOM", True))

        self.dbop.setdbVisual_Tablero(self.tablero)  # To close

        self.intervalo = configuracion.x_interval_replay

        tipoLetra = Controles.TipoLetra(puntos=configuracion.x_pgn_fontpoints)

        lybt, bt = QTVarios.lyBotonesMovimiento(self,
                                                "",
                                                siTiempo=True,
                                                siLibre=False,
                                                tamIcon=24)

        self.lbPGN = Controles.LB(self).ponWrap()
        self.lbPGN.colocate = self.colocatePartida
        self.lbPGN.setStyleSheet(
            "QLabel{ border-style: groove; border-width: 2px; border-color: LightSlateGray; padding: 8px;}"
        )
        self.lbPGN.ponFuente(tipoLetra)
        self.lbPGN.setOpenExternalLinks(False)

        def muestraPos(txt):
            self.colocatePartida(int(txt))

        self.lbPGN.linkActivated.connect(muestraPos)

        self.siFigurines = configuracion.x_pgn_withfigurines

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion[GOOD_MOVE] = (dicNAGs[1],
                                         PantallaColores.nag2ico(1, 16))
        self.dicValoracion[BAD_MOVE] = (dicNAGs[2],
                                        PantallaColores.nag2ico(2, 16))
        self.dicValoracion[VERY_GOOD_MOVE] = (dicNAGs[3],
                                              PantallaColores.nag2ico(3, 16))
        self.dicValoracion[VERY_POOR_MOVE] = (dicNAGs[4],
                                              PantallaColores.nag2ico(4, 16))
        self.dicValoracion[SPECULATIVE_MOVE] = (dicNAGs[5],
                                                PantallaColores.nag2ico(5, 16))
        self.dicValoracion[QUESTIONABLE_MOVE] = (dicNAGs[6],
                                                 PantallaColores.nag2ico(
                                                     6, 16))
        self.dicValoracion[NO_RATING] = (_("No rating"), QtGui.QIcon())

        self.dicVentaja = collections.OrderedDict()
        self.dicVentaja[V_SIN] = (_("Undefined"), QtGui.QIcon())
        self.dicVentaja[V_IGUAL] = (dicNAGs[11],
                                    Iconos.V_Blancas_Igual_Negras())
        self.dicVentaja[V_BLANCAS] = (dicNAGs[14], Iconos.V_Blancas())
        self.dicVentaja[V_BLANCAS_MAS] = (dicNAGs[16], Iconos.V_Blancas_Mas())
        self.dicVentaja[V_BLANCAS_MAS_MAS] = (dicNAGs[18],
                                              Iconos.V_Blancas_Mas_Mas())
        self.dicVentaja[V_NEGRAS] = (dicNAGs[15], Iconos.V_Negras())
        self.dicVentaja[V_NEGRAS_MAS] = (dicNAGs[17], Iconos.V_Negras_Mas())
        self.dicVentaja[V_NEGRAS_MAS_MAS] = (dicNAGs[19],
                                             Iconos.V_Negras_Mas_Mas())

        # Valoracion
        li_options = [(tit[0], k, tit[1])
                      for k, tit in self.dicValoracion.items()]
        self.cbValoracion = Controles.CB(self, li_options, 0).capturaCambiado(
            self.cambiadoValoracion)
        self.cbValoracion.ponFuente(tipoLetra)

        # Ventaja
        li_options = [(tit, k, icon)
                      for k, (tit, icon) in self.dicVentaja.items()]
        self.cbVentaja = Controles.CB(self, li_options,
                                      0).capturaCambiado(self.cambiadoVentaja)
        self.cbVentaja.ponFuente(tipoLetra)

        # Comentario
        self.emComentario = Controles.EM(self, siHTML=False).capturaCambios(
            self.cambiadoComentario)
        self.emComentario.ponFuente(tipoLetra)
        self.emComentario.altoFijo(5 * configuracion.x_pgn_rowheight)
        lyVal = Colocacion.H().control(self.cbValoracion).control(
            self.cbVentaja)
        lyEd = Colocacion.V().otro(lyVal).control(self.emComentario)

        # Apertura
        self.lbApertura = Controles.LB(self).alinCentrado().ponFuente(
            tipoLetra).ponWrap()

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbPGN).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        layout.otro(lyEd)
        layout.control(self.lbApertura)
        layout.relleno().margen(0)
        self.setLayout(layout)

        self.ajustaAncho()

        self.siReloj = False

        self.ponPartida(self.partidabase)
예제 #24
0
    def __init__(self, winBookGuide, siMoves=True):
        QtGui.QWidget.__init__(self)

        self.siMoves = siMoves
        self.winBookGuide = winBookGuide
        if self.siMoves:
            self.tree = winBookGuide.wmoves.tree
        else:
            self.tree = None
        self.movActual = None

        confTablero = VarGen.configuracion.confTablero("INFOMOVEBOOKGUIDE", 32)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.ponMensajero(self.mueveHumano)
        self.cpActual = ControlPosicion.ControlPosicion()
        self.historia = None
        self.posHistoria = None

        self.intervalo = 1400

        lybt, bt = QTVarios.lyBotonesMovimiento(self,
                                                "",
                                                siTiempo=True,
                                                siLibre=False,
                                                tamIcon=24)

        self.lbPGN = LBPGN("").anchoFijo(self.tablero.ancho).ponWrap()
        self.lbPGN.colocate = self.colocatePartida

        if siMoves:
            tree = winBookGuide.wmoves.tree
            # Valoracion
            liOpciones = [(tit[0], k, tit[1])
                          for k, tit in tree.dicValoracion.iteritems()]
            self.lbValoracion = Controles.LB(self, _("Rating") + ":")
            self.cbValoracion = Controles.CB(
                self, liOpciones, 0).capturaCambiado(self.cambiadoValoracion)

            # Ventaja
            liOpciones = [(tit, k, icon)
                          for k, (tit, icon) in tree.dicVentaja.iteritems()]
            self.lbVentaja = Controles.LB(self, _("Advantage") + ":")
            self.cbVentaja = Controles.CB(self, liOpciones, 0).capturaCambiado(
                self.cambiadoVentaja)

            # Comentario
            self.emComentario = Controles.EM(
                self, siHTML=False).capturaCambios(self.cambiadoComentario)

            lyVal = Colocacion.H().control(self.lbValoracion).control(
                self.cbValoracion).relleno()
            lyVen = Colocacion.H().control(self.lbVentaja).control(
                self.cbVentaja).relleno()
            lyEd = Colocacion.V().otro(lyVal).otro(lyVen).control(
                self.emComentario)

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbPGN).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        if siMoves:
            layout.otro(lyEd)
        layout.relleno()
        self.setLayout(layout)

        self.usoNormal = True

        self.siReloj = False