Example #1
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()
Example #2
0
    def __init__(self, procesador):

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

        self.siPlay = False
        self.wreload = False

        self.dbwashing = Washing.DBWashing(procesador.configuracion)
        self.washing = self.dbwashing.washing
        eng = self.washing.lastEngine(procesador.configuracion)
        siTerminado = eng is None

        owner = procesador.pantalla
        titulo = _("The Washing Machine")
        extparam = "washing"
        icono = Iconos.WashingMachine()
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        # Toolbar
        tb = QTVarios.LCTB(self)
        tb.new(_("Close"), Iconos.MainMenu(), self.terminar)
        tb.new(_("File"), Iconos.Recuperar(), self.file)
        if not siTerminado:
            tb.new(_("Play"), Iconos.Play(), self.play)

        # Tab current
        ia = self.washing.index_average()

        c_create = "#f9e7e7"
        c_tactics = "#df8f87"
        c_reinit = "#8aa678"
        c_des = "#e4e4e4"
        c_hab = "#9dde67"
        c_act = "#dd2a2b"
        c_ia = "#cccdea"

        li_ia = ("#ffed00", "#ff8e00", "#29b41b", "#1174ff", "#bc01d9",
                 "#eb0000")
        d_ia = li_ia[int(eng.index() / (100.0 / 6.0)) % 6]
        state = eng.state
        wsvg = QtSvg.QSvgWidget()
        with open("IntFiles/washing-machine.svg") as f:
            svg = f.read()
            d_create = c_des
            d_tactics = c_des
            d_reinit = c_des
            ctac = ""
            if state == Washing.CREATING:
                d_create = c_act
            elif state == Washing.REPLAY:
                d_create = c_hab
                d_tactics = c_hab
                d_reinit = c_act
            elif state == Washing.TACTICS:
                d_create = c_hab
                d_tactics = c_act
                ctac = str(eng.numTactics())
            svg = svg.replace(c_create, d_create)
            svg = svg.replace(c_tactics, d_tactics)
            svg = svg.replace(c_reinit, d_reinit)
            svg = svg.replace("TAC", ctac)
            svg = svg.replace(c_ia, d_ia)
            wsvg.load(QtCore.QByteArray(svg))
        p = 1.0
        wsvg.setFixedSize(287.79 * p, 398.83 * p)

        if siTerminado:
            plant = "<tr><td align=\"right\">%s:</td><td><b>%s</b></td></tr>"
            hints, times, games = self.washing.totals()
            nEngines = self.washing.numEngines()
            html = '<h2><center>%s: %d %s</center></h2><br><table cellpadding="4">' % (
                _("Finished"), nEngines, _("engines"))
            for x in range(3):
                html += plant
            html += "</table>"

            html = html % (
                _("Hints"),
                "%d (%0.02f)" % (hints, hints * 1.0 / nEngines),
                _("Games"),
                "%d (%0.02f)" % (games, games * 1.0 / nEngines),
                _("Time"),
                "%s (%s)" %
                (Util.secs2str(times), Util.secs2str(int(times / nEngines))),
            )

        else:
            plant = "<tr><td align=\"right\">%s:</td><td><b>%s</b></td></tr>"
            plantverde = "<tr><td align=\"right\">%s:</td><td style=\"color:green;\"><b>%s</b></td></tr>"
            html = "<h2><center>%s %d/%d</center></h2><br><table cellpadding=\"4\">"
            for x in range(8):
                html += plantverde if x == 2 else plant
            html += "</table>"
            html = html % (
                _("Washing"),
                self.washing.numEngines(),
                self.washing.totalEngines(procesador.configuracion),
                _("Engine"),
                eng.nombre,
                _("Elo"),
                eng.elo,
                "<b>%s</b>" % _("Task"),
                eng.lbState(),
                _("Color"),
                _("White") if eng.color else _("Black"),
                _("Hints"),
                "%d/%d" % (eng.hints_current, eng.hints),
                _("Games"),
                eng.games,
                _("Time"),
                eng.lbTime(),
                _("Index"),
                eng.cindex(),
            )

        lbTxt = Controles.LB(self, html).ponTipoLetra(puntos=12)
        lbIdx = Controles.LB(self, "%0.2f%%" % ia).alinCentrado().ponTipoLetra(
            puntos=36, peso=700)

        ly0 = Colocacion.V().control(wsvg).relleno(1)
        ly1 = Colocacion.V().espacio(20).control(lbTxt).espacio(20).control(
            lbIdx).relleno(1)
        ly2 = Colocacion.H().otro(ly0).otro(ly1)
        gbCurrent = Controles.GB(self, "", ly2)

        # Lista
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("STEP", _("Washing"), 50, siCentrado=True)
        oColumnas.nueva("ENGINE", _("Engine"), 170, siCentrado=True)
        oColumnas.nueva("ELO", _("Elo"), 50, siCentrado=True)
        oColumnas.nueva("COLOR", _("Color"), 70, siCentrado=True)
        oColumnas.nueva("STATE", _("State"), 90, siCentrado=True)
        oColumnas.nueva("HINTS", _("Hints"), 60, siCentrado=True)
        oColumnas.nueva("GAMES", _("Games"), 60, siCentrado=True)
        oColumnas.nueva("TIME", _("Time"), 60, siCentrado=True)
        oColumnas.nueva("DATE", _("Date"), 120, siCentrado=True)
        oColumnas.nueva("INDEX", _("Index"), 60, siCentrado=True)

        self.grid = grid = Grid.Grid(self, oColumnas, siSelecFilas=True)
        nAnchoPgn = self.grid.anchoColumnas() + 20
        self.grid.setMinimumWidth(nAnchoPgn)
        self.registrarGrid(grid)

        ly0 = Colocacion.V().control(self.grid)
        gbDatos = Controles.GB(self, "", ly0)

        self.tab = Controles.Tab()
        self.tab.nuevaTab(gbCurrent, _("Current"))
        self.tab.nuevaTab(gbDatos, _("Data"))

        # Colocamos ---------------------------------------------------------------
        ly = Colocacion.V().control(tb).control(self.tab)
        self.setLayout(ly)

        self.recuperarVideo(siTam=True, anchoDefecto=nAnchoPgn)
Example #3
0
    def __init__(self, procesador):
        super(WAbout, self).__init__(procesador.main_window)

        # gen_web_bootstrap()

        self.setWindowTitle(_("About"))
        self.setWindowIcon(Iconos.Aplicacion64())
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint)
        self.setMaximumWidth(QTUtil.anchoEscritorio())

        f = Controles.TipoLetra(puntos=10)  # 0, peso=75 )

        head = '<span style="font-size:30pt; font-weight="700"; font-family:arial; color:#2D2B2B">%s</span><br>' % Code.lucas_chess
        head += '<span style="font-size:15pt;">%s</span><br>' % _X(
            _("version %1"), procesador.version)
        head += '<span style="font-size:10pt;color:2D2B2B">%s: %s</span>' % (_(
            "Author"), '<a href="mailto:[email protected]">Lucas Monge</a>')
        head += ' - <a style="font-size:10pt; color:2D2B2B" href="%s">%s</a>' % (
            procesador.web, procesador.web)
        head += ' - <a style="font-size:10pt; color:2D2B2B" href="%s">Blog : Fresh news</a>' % (
            procesador.blog, )
        head += ' - <a style="font-size:10pt; color:2D2B2B" href="%s">Sources: github</a><br>' % (
            procesador.github, )
        head += '%s <a style="font-size:10pt; color:2D2B2B" href="http://www.gnu.org/copyleft/gpl.html"> GPL</a>' % _(
            "License")

        lb_ico = Controles.LB(self).ponImagen(Iconos.pmAplicacion64())
        lb_titulo = Controles.LB(self, head)

        # Tabs
        tab = Controles.Tab()
        tab.ponFuente(f)

        ib = AboutBase.ThanksTo()

        sub_tab = None
        for k, titulo in ib.dic.items():
            txt = ib.texto(k)
            lb = Controles.LB(self, txt)
            lb.set_background("#F6F3EE")
            lb.ponFuente(f)
            if "-" in k:
                base, num = k.split("-")
                if num == "1":
                    sub_tab = Controles.Tab()
                    sub_tab.ponFuente(f)
                    sub_tab.set_position("S")
                    tab.addTab(sub_tab, _("Engines"))
                lm = ib.list_engines(num)
                titulo = lm[0][0].split(" ")[1] + " - " + lm[-1][0].split(
                    " ")[1]
                sub_tab.addTab(lb, titulo)
            else:
                tab.addTab(lb, titulo)

        ly_v1 = Colocacion.H().control(lb_ico).espacio(15).control(
            lb_titulo).relleno()
        layout = Colocacion.V().otro(ly_v1).espacio(10).control(tab).margen(10)

        self.setLayout(layout)
Example #4
0
    def __init__(self, procesador, mapa):
        self.workmap = WorkMap.WorkMap(mapa)
        dic = TrListas.maps()
        titulo = dic[mapa]
        icono = getattr(Iconos, mapa)()
        super().__init__(parent=procesador.pantalla,
                         titulo=titulo,
                         icono=icono,
                         extparam=mapa)

        self.procesador = procesador

        self.playCurrent = None

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("TIPO",
                        "",
                        24,
                        edicion=Delegados.PmIconosBMT(),
                        siCentrado=True)
        oColumnas.nueva("SELECT", _("Select one to play"), 150)

        self.grid = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="W")

        self.registrarGrid(self.grid)

        liAcciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar),
            None,
            (_("Play"), Iconos.Empezar(), self.play),
            None,
        )
        tbWork = Controles.TBrutina(self, liAcciones, tamIcon=24)

        self.lbInfo = Controles.LB(self)

        self.wsvg = wsvg = QtSvg.QSvgWidget()
        p = wsvg.palette()
        p.setColor(wsvg.backgroundRole(), QtGui.QColor("#F5F5F5"))
        wsvg.setPalette(p)

        ly = Colocacion.V().control(tbWork).control(self.lbInfo).control(
            self.grid)
        w = QtWidgets.QWidget()
        w.setLayout(ly)

        splitter = QtWidgets.QSplitter(self)
        splitter.addWidget(w)
        splitter.addWidget(wsvg)
        self.registrarSplitter(splitter, "splitter")

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("ACTIVE", _("Active"), 80, siCentrado=True)
        oColumnas.nueva("TIPO", _("Type"), 110, siCentrado=True)
        oColumnas.nueva("DCREATION", _("Creation date"), 110, siCentrado=True)
        oColumnas.nueva("DONE", _("Done"), 110, siCentrado=True)
        oColumnas.nueva("DEND", _("Ending date"), 110, siCentrado=True)
        oColumnas.nueva("RESULT", _("Result"), 110, siCentrado=True)

        self.gridData = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="H")
        self.registrarGrid(self.gridData)

        liAcciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar),
            None,
            (_("Select"), Iconos.Seleccionar(), self.data_select),
            None,
            (_("New"), Iconos.NuevoMas(), self.data_new),
            None,
            (_("Remove"), Iconos.Borrar(), self.data_remove),
            None,
        )
        tb = Controles.TBrutina(self, liAcciones, tamIcon=24)

        ly = Colocacion.V().control(tb).control(self.gridData)
        w = QtWidgets.QWidget()
        w.setLayout(ly)

        self.tab = Controles.Tab()
        self.tab.ponPosicion("W")
        self.tab.nuevaTab(splitter, _("Map"))
        self.tab.nuevaTab(w, _("Data"))

        ly = Colocacion.H().control(self.tab).margen(0)
        self.setLayout(ly)

        self.recuperarVideo(siTam=True, anchoDefecto=960, altoDefecto=600)

        self.workmap.setWidget(wsvg)
        self.workmap.resetWidget()
        self.grid.gotop()
        self.gridData.gotop()

        self.informacion()
Example #5
0
    def __init__(self, tableroOriginal):
        pantalla = tableroOriginal.parent()
        titulo = _("Colors")
        icono = Iconos.EditarColores()
        extparam = "WColores"
        QTVarios.WDialogo.__init__(self, pantalla, titulo, icono, extparam)

        self.tableroOriginal = tableroOriginal
        self.configuracion = VarGen.configuracion
        self.confTablero = tableroOriginal.confTablero.copia(tableroOriginal.confTablero._id)
        self.siBase = tableroOriginal.confTablero._id == "BASE"

        # Temas #############################################################################################################################
        liOpciones = [(_("Your themes"), self.configuracion.ficheroTemas)]
        for entry in Util.listdir("Themes"):
            filename = entry.name
            if filename.endswith("lktheme"):
                ctema = filename[:-8]
                liOpciones.append((ctema, "Themes/" + filename))

        self.cbTemas = Controles.CB(self, liOpciones, liOpciones[0][1]).capturaCambiado(self.cambiadoTema)
        self.lbSecciones = Controles.LB(self, _("Section") + ":")
        self.cbSecciones = Controles.CB(self, [], None).capturaCambiado(self.cambiadoSeccion)

        lyTemas = Colocacion.G()
        self.liBT_Temas = []
        for i in range(12):
            for j in range(6):
                bt = BotonTema(self, self.ponTema)
                lyTemas.control(bt, i, j)
                bt.ponTema(None)
                self.liBT_Temas.append(bt)

        def creaLB(txt):
            return Controles.LB(self, txt + ": ").alinDerecha()

        # Casillas
        lbTrans = Controles.LB(self, _("Degree of transparency"))
        lbPNG = Controles.LB(self, _("Image"))

        # # Blancas
        lbBlancas = creaLB(_("White squares"))
        self.btBlancas = BotonColor(self, self.confTablero.colorBlancas, self.actualizaTablero)
        self.btBlancasPNG = BotonImagen(self, self.confTablero.png64Blancas, self.actualizaTablero, self.btBlancas)
        self.dialBlancasTrans = DialNum(self, self.confTablero.transBlancas, self.actualizaTablero)

        # # Negras
        lbNegras = creaLB(_("Black squares"))
        self.btNegras = BotonColor(self, self.confTablero.colorNegras, self.actualizaTablero)
        self.btNegrasPNG = BotonImagen(self, self.confTablero.png64Negras, self.actualizaTablero, self.btNegras)
        self.dialNegrasTrans = DialNum(self, self.confTablero.transNegras, self.actualizaTablero)

        # Background
        lbFondo = creaLB(_("Background"))
        self.btFondo = BotonColor(self, self.confTablero.colorFondo, self.actualizaTablero)
        self.btFondoPNG = BotonImagen(self, self.confTablero.png64Fondo, self.actualizaTablero, self.btFondo)
        self.chbExtended = Controles.CHB(self, _("Extended to outer border"),
                                         self.confTablero.extendedColor()).capturaCambiado(self, self.extendedColor)

        # Actual
        self.chbTemas = Controles.CHB(self, _("Default"), self.confTablero.siDefTema()).capturaCambiado(self,
                                                                                                        self.defectoTemas)
        if self.siBase:
            self.chbTemas.ponValor(False)
            self.chbTemas.setVisible(False)
        # Exterior
        lbExterior = creaLB(_("Outer Border"))
        self.btExterior = BotonColor(self, self.confTablero.colorExterior, self.actualizaTablero)
        # Texto
        lbTexto = creaLB(_("Coordinates"))
        self.btTexto = BotonColor(self, self.confTablero.colorTexto, self.actualizaTablero)
        # Frontera
        lbFrontera = creaLB(_("Inner Border"))
        self.btFrontera = BotonColor(self, self.confTablero.colorFrontera, self.actualizaTablero)

        # Flechas
        lbFlecha = creaLB(_("Move indicator"))
        self.lyF = BotonFlecha(self, self.confTablero.fTransicion, self.confTablero.flechaDefecto,
                               self.actualizaTablero)
        lbFlechaAlternativa = creaLB(_("Arrow alternative"))
        self.lyFAlternativa = BotonFlecha(self, self.confTablero.fAlternativa,
                                          self.confTablero.flechaAlternativaDefecto, self.actualizaTablero)
        lbFlechaActivo = creaLB(_("Active moves"))
        self.lyFActual = BotonFlecha(self, self.confTablero.fActivo, self.confTablero.flechaActivoDefecto,
                                     self.actualizaTablero)
        lbFlechaRival = creaLB(_("Opponent moves"))
        self.lyFRival = BotonFlecha(self, self.confTablero.fRival, self.confTablero.flechaRivalDefecto,
                                    self.actualizaTablero)

        lyActual = Colocacion.G()
        lyActual.control(self.chbTemas, 0, 0)
        lyActual.controlc(lbPNG, 0, 2).controlc(lbTrans, 0, 3)
        lyActual.controld(lbBlancas, 1, 0).control(self.btBlancas, 1, 1).otroc(self.btBlancasPNG, 1, 2).otroc(
                self.dialBlancasTrans, 1, 3)
        lyActual.controld(lbNegras, 2, 0).control(self.btNegras, 2, 1).otroc(self.btNegrasPNG, 2, 2).otroc(
                self.dialNegrasTrans, 2, 3)
        lyActual.controld(lbFondo, 3, 0).control(self.btFondo, 3, 1).otroc(self.btFondoPNG, 3, 2).control(
                self.chbExtended, 3, 3)
        lyActual.controld(lbExterior, 4, 0).control(self.btExterior, 4, 1)
        lyActual.controld(lbTexto, 5, 0).control(self.btTexto, 5, 1)
        lyActual.controld(lbFrontera, 6, 0).control(self.btFrontera, 6, 1)
        lyActual.controld(lbFlecha, 7, 0).otro(self.lyF, 7, 1, 1, 4)
        lyActual.controld(lbFlechaAlternativa, 8, 0).otro(self.lyFAlternativa, 8, 1, 1, 4)
        lyActual.controld(lbFlechaActivo, 9, 0).otro(self.lyFActual, 9, 1, 1, 4)
        lyActual.controld(lbFlechaRival, 10, 0).otro(self.lyFRival, 10, 1, 1, 4)

        gbActual = Controles.GB(self, _("Active theme"), lyActual)

        lySecciones = Colocacion.H().control(self.lbSecciones).control(self.cbSecciones).relleno()
        ly = Colocacion.V().control(self.cbTemas).otro(lySecciones).otro(lyTemas).control(gbActual).relleno()
        gbTemas = Controles.GB(self, "", ly)
        gbTemas.setFlat(True)

        # mas opciones ##############################################################################################################
        def xDefecto(siDefecto):
            if self.siBase:
                siDefecto = False
            chb = Controles.CHB(self, _("Default"), siDefecto).capturaCambiado(self, self.defectoTableroM)
            if self.siBase:
                chb.setVisible(False)
            return chb

        def l2mas1(lyG, fila, a, b, c):
            if a:
                ly = Colocacion.H().controld(a).control(b)
            else:
                ly = Colocacion.H().control(b)
            lyG.otro(ly, fila, 0).control(c, fila, 1)

        # Coordenadas
        lyG = Colocacion.G()
        # _nCoordenadas
        lbCoordenadas = creaLB(_("Number"))
        liOpciones = [("0", 0), ("4", 4), ("2a", 2), ("2b", 3), ("2c", 5), ("2d", 6)]
        self.cbCoordenadas = Controles.CB(self, liOpciones, self.confTablero.nCoordenadas()).capturaCambiado(self.actualizaTableroM)
        self.chbDefCoordenadas = xDefecto(self.confTablero.siDefCoordenadas())
        l2mas1(lyG, 0, lbCoordenadas, self.cbCoordenadas, self.chbDefCoordenadas)

        # _tipoLetra
        lbTipoLetra = creaLB(_("Font"))
        self.cbTipoLetra = QtGui.QFontComboBox()
        self.cbTipoLetra.setEditable(False)
        self.cbTipoLetra.setFontFilters(self.cbTipoLetra.ScalableFonts)
        self.cbTipoLetra.setCurrentFont(QtGui.QFont(self.confTablero.tipoLetra()))
        self.connect(self.cbTipoLetra, QtCore.SIGNAL("currentIndexChanged(int)"), self.actualizaTableroM)
        self.chbDefTipoLetra = xDefecto(self.confTablero.siDefTipoLetra())
        l2mas1(lyG, 1, lbTipoLetra, self.cbTipoLetra, self.chbDefTipoLetra)

        # _cBold
        self.chbBold = Controles.CHB(self, _("Bold"), self.confTablero.siBold()).capturaCambiado(self, self.actualizaTableroM)
        self.chbDefBold = xDefecto(self.confTablero.siDefBold())
        l2mas1(lyG, 2, None, self.chbBold, self.chbDefBold)

        # _tamLetra
        lbTamLetra = creaLB(_("Size") + " %")
        self.sbTamLetra = Controles.SB(self, self.confTablero.tamLetra(), 1, 200).tamMaximo(50).capturaCambiado(
                self.actualizaTableroM)
        self.chbDefTamLetra = xDefecto(self.confTablero.siDefTamLetra())
        l2mas1(lyG, 3, lbTamLetra, self.sbTamLetra, self.chbDefTamLetra)

        # _sepLetras
        lbSepLetras = creaLB(_("Separation") + " %")
        self.sbSepLetras = Controles.SB(self, self.confTablero.sepLetras(), -1000, 1000).tamMaximo(50).capturaCambiado(
                self.actualizaTableroM)
        self.chbDefSepLetras = xDefecto(self.confTablero.siDefSepLetras())
        l2mas1(lyG, 4, lbSepLetras, self.sbSepLetras, self.chbDefSepLetras)

        gbCoordenadas = Controles.GB(self, _("Coordinates"), lyG)

        lyOtros = Colocacion.G()
        # _nomPiezas
        li = []
        lbPiezas = creaLB(_("Pieces"))
        for entry in Util.listdir("Pieces"):
            if entry.is_dir():
                li.append((entry.name, entry.name))
        li.sort(key=lambda x: x[0])
        self.cbPiezas = Controles.CB(self, li, self.confTablero.nomPiezas()).capturaCambiado(self.actualizaTableroM)
        self.chbDefPiezas = xDefecto(self.confTablero.siDefPiezas())
        l2mas1(lyOtros, 0, lbPiezas, self.cbPiezas, self.chbDefPiezas)

        # _tamRecuadro
        lbTamRecuadro = creaLB(_("Outer Border Size") + " %")
        self.sbTamRecuadro = Controles.SB(self, self.confTablero.tamRecuadro(), 0, 10000).tamMaximo(50).capturaCambiado(
                self.actualizaTableroM)
        self.chbDefTamRecuadro = xDefecto(self.confTablero.siDefTamRecuadro())
        l2mas1(lyOtros, 1, lbTamRecuadro, self.sbTamRecuadro, self.chbDefTamRecuadro)

        # _tamFrontera
        lbTamFrontera = creaLB(_("Inner Border Size") + " %")
        self.sbTamFrontera = Controles.SB(self, self.confTablero.tamFrontera(), 0, 10000).tamMaximo(50).capturaCambiado(
                self.actualizaTableroM)
        self.chbDefTamFrontera = xDefecto(self.confTablero.siDefTamFrontera())
        l2mas1(lyOtros, 2, lbTamFrontera, self.sbTamFrontera, self.chbDefTamFrontera)

        ly = Colocacion.V().control(gbCoordenadas).espacio(50).otro(lyOtros).relleno()

        gbOtros = Controles.GB(self, "", ly)
        gbOtros.setFlat(True)

        # Tablero ##########################################################################################################################
        cp = ControlPosicion.ControlPosicion().leeFen("2kr1b1r/2p1pppp/p7/3pPb2/1q3P2/2N1P3/PPP3PP/R1BQK2R w KQ - 0 1")
        self.tablero = Tablero.Tablero(self, self.confTablero, siMenuVisual=False)
        self.tablero.crea()
        self.tablero.ponPosicion(cp)
        self.rehazFlechas()

        liAcciones = [(_("Accept"), Iconos.Aceptar(), self.aceptar), None,
                      (_("Cancel"), Iconos.Cancelar(), self.cancelar), None,
                      (_("Your themes"), Iconos.Temas(), self.temas), None,
                      (_("Import"), Iconos.Mezclar(), self.importar), None,
                      (_("Export"), Iconos.Grabar(), self.exportar), None,
                      ]
        tb = Controles.TBrutina(self, liAcciones)

        # tam tablero
        self.lbTamTablero = Controles.LB(self, "%d px" % self.tablero.width())

        # Juntamos
        lyT = Colocacion.V().control(tb).espacio(15).control(self.tablero).controli(self.lbTamTablero).relleno(
                1).margen(3)

        self.tab = Controles.Tab()
        self.tab.nuevaTab(gbTemas, _("Themes"))
        self.tab.nuevaTab(gbOtros, _("Other options"))
        ly = Colocacion.H().otro(lyT).control(self.tab)

        self.setLayout(ly)

        self.elegido = None

        self.liTemas = self.leeTemas()
        self.temaActual = {}
        if self.liTemas:
            txtTM = self.confTablero.grabaTema()
            txtBS = self.confTablero.grabaBase()
            for tema in self.liTemas:
                if tema:
                    if tema.get("TEXTO", "") == txtTM and txtBS == tema.get("BASE", ""):
                        self.temaActual = tema
                        break
        self.cambiadoTema()
        self.defectoTemas()

        self.extendedColor()

        self.siActualizando = False

        self.recuperarVideo(siTam=False)
Example #6
0
    def __init__(self, wowner, manager, alm, show_analysis):
        titulo = _("Result of analysis")
        icono = Iconos.Estadisticas()
        extparam = "estadisticasv1"
        QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.alm = alm
        self.procesador = manager.procesador
        self.manager = manager
        self.configuration = manager.configuration
        self.show_analysis = show_analysis
        self.colorWhite = QTUtil.qtColorRGB(231, 244, 254)

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

        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.register_grid(gridAll)
        gridW = Grid.Grid(self, xcol(), siSelecFilas=True, xid="W")
        anchoGrid = max(gridW.fixMinWidth(), anchoGrid)
        self.register_grid(gridW)
        gridB = Grid.Grid(self, xcol(), siSelecFilas=True, xid="B")
        anchoGrid = max(gridB.fixMinWidth(), anchoGrid)
        self.register_grid(gridB)

        self.emIndexes = Controles.EM(self, alm.indexesHTML).read_only()
        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

        config_board = Code.configuration.config_board("ANALISISGRAPH", 48)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        self.board.ponerPiezasAbajo(alm.is_white_bottom)
        self.board.dispatchSize(self.boardSizeChanged)

        # self.capturas = WCapturas.CapturaLista(self, self.board)
        ly_tc = Colocacion.H().control(self.board)
        # .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()).capture_changes(
                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().set_position("W")
        ancho = self.board.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.restore_video()

        gridAll.gotop()
        gridB.gotop()
        gridW.gotop()
        self.grid_left_button(gridAll, 0, None)
        th = self.board.height()
        self.tabGrid.setFixedHeight(th)
        self.adjustSize()
        self.emIndexes.setFixedHeight(th - 72)
Example #7
0
    def __init__(self, procesador):
        self.configuration = procesador.configuration
        self.procesador = procesador

        self.db_histo = UtilSQL.DictSQL(self.configuration.ficheroGMhisto)
        self.opening_block = None
        self.li_preferred_openings = []

        w_parent = procesador.main_window
        titulo = _("Play like a Grandmaster")
        icono = Iconos.GranMaestro()

        extparam = "gm"
        QTVarios.WDialogo.__init__(self, w_parent, titulo, icono, extparam)

        flb = Controles.TipoLetra(puntos=procesador.configuration.x_menu_points)

        # Toolbar
        li_acciones = [
            (_("Accept"), Iconos.Aceptar(), self.aceptar),
            None,
            (_("Cancel"), Iconos.Cancelar(), self.cancelar),
            None,
            (_("One game"), Iconos.Uno(), self.unJuego),
            None,
            (_("Import"), Iconos.ImportarGM(), self.importar),
        ]
        tb = Controles.TBrutina(self, li_acciones)

        # Grandes maestros
        self.li_gm = GM.lista_gm()
        gb_style = Common.gb_style()
        li = [(x[0], x[1]) for x in self.li_gm]
        li.insert(0, ("-", None))
        self.cb_gm = QTUtil2.comboBoxLB(self, li, li[0][1] if len(self.li_gm) == 0 else li[1][1])
        self.cb_gm.capture_changes(self.check_gm)
        hbox = Colocacion.H().relleno().control(self.cb_gm).relleno()
        gbGM = Controles.GB(self, _("Choose a Grandmaster"), hbox).ponFuente(flb)
        gbGM.setStyleSheet(gb_style)

        # Personales
        self.li_personal = GM.lista_gm_personal(self.procesador.configuration.personal_training_folder)
        if self.li_personal:
            li = [(x[0], x[1]) for x in self.li_personal]
            li.insert(0, ("-", None))
            self.cbPersonal = QTUtil2.comboBoxLB(self, li, li[0][1])
            self.cbPersonal.capture_changes(self.check_personal)
            btBorrar = Controles.PB(self, "", self.borrarPersonal).ponIcono(Iconos.Borrar(), icon_size=24)
            hbox = Colocacion.H().relleno().control(self.cbPersonal).control(btBorrar).relleno()
            gb_personal = Controles.GB(self, _("Personal games"), hbox).ponFuente(flb)
            gb_personal.setStyleSheet(gb_style)

        # Color
        self.rb_white = Controles.RB(self, _("White"), rutina=self.check_color)
        self.rb_white.setFont(flb)
        self.rb_white.activa(True)
        self.rb_black = Controles.RB(self, _("Black"), rutina=self.check_color)
        self.rb_black.setFont(flb)
        self.rb_black.activa(False)

        # Contrario
        self.chContrario = Controles.CHB(self, _("Choose the opponent's move, when there are multiple possible answers"), False)

        # Juez
        liDepths = [("--", 0)]
        for x in range(1, 31):
            liDepths.append((str(x), x))
        self.liMotores = self.configuration.comboMotoresMultiPV10()
        self.cbJmotor, self.lbJmotor = QTUtil2.comboBoxLB(self, self.liMotores, self.configuration.tutor_inicial, _("Engine"))
        self.edJtiempo = Controles.ED(self).tipoFloat().ponFloat(1.0).anchoFijo(50)
        self.lbJtiempo = Controles.LB2P(self, _("Time in seconds"))
        self.cbJdepth = Controles.CB(self, liDepths, 0).capture_changes(self.change_depth)
        self.lbJdepth = Controles.LB2P(self, _("Depth"))
        self.lbJshow = Controles.LB2P(self, _("Show rating"))
        self.chbEvals = Controles.CHB(self, _("Show all evaluations"), False)
        li_options = [(_("All moves"), None), (_("Moves are different"), True), (_("Never"), False)]
        self.cbJshow = Controles.CB(self, li_options, True)
        self.lbJmultiPV = Controles.LB2P(self, _("Number of moves evaluated by engine(MultiPV)"))
        li = [(_("Default"), "PD"), (_("Maximum"), "MX")]
        for x in (1, 3, 5, 10, 15, 20, 30, 40, 50, 75, 100, 150, 200):
            li.append((str(x), str(x)))
        self.cbJmultiPV = Controles.CB(self, li, "PD")

        self.li_adjudicator_controls = (
            self.cbJmotor,
            self.lbJmotor,
            self.edJtiempo,
            self.lbJtiempo,
            self.lbJdepth,
            self.cbJdepth,
            self.lbJshow,
            self.cbJshow,
            self.lbJmultiPV,
            self.cbJmultiPV,
            self.chbEvals,
        )

        for control in self.li_adjudicator_controls:
            control.setFont(flb)

        # Inicial
        self.edJugInicial, lbInicial = QTUtil2.spinBoxLB(self, 1, 1, 99, etiqueta=_("Initial move"), maxTam=40)

        # Libros
        fvar = self.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) for x in self.list_books.lista]
        li.insert(0, ("--", None))
        self.cbBooks, lbBooks = QTUtil2.comboBoxLB(self, li, None, _("Bypass moves in the book"))

        # Openings

        self.btOpening = Controles.PB(self, " " * 5 + _("Undetermined") + " " * 5, self.aperturasEditar).ponPlano(False)
        self.btOpeningsFavoritas = Controles.PB(self, "", self.preferred_openings).ponIcono(Iconos.Favoritos())
        self.btOpeningsQuitar = Controles.PB(self, "", self.aperturasQuitar).ponIcono(Iconos.Motor_No())
        hbox = Colocacion.H().control(self.btOpeningsQuitar).control(self.btOpening).control(self.btOpeningsFavoritas).relleno()
        gbOpening = Controles.GB(self, _("Opening"), hbox)

        # gbBasic
        # # Color
        hbox = Colocacion.H().relleno().control(self.rb_white).espacio(10).control(self.rb_black).relleno()
        gbColor = Controles.GB(self, _("Play with"), hbox).ponFuente(flb)
        gbColor.setStyleSheet(gb_style)

        # Tiempo
        ly1 = Colocacion.H().control(self.lbJmotor).control(self.cbJmotor).relleno().control(self.lbJshow).control(self.cbJshow)
        ly2 = Colocacion.H().control(self.lbJtiempo).control(self.edJtiempo)
        ly2.control(self.lbJdepth).control(self.cbJdepth).relleno().control(self.chbEvals)
        ly3 = Colocacion.H().control(self.lbJmultiPV).control(self.cbJmultiPV).relleno()
        ly = Colocacion.V().otro(ly1).otro(ly2).otro(ly3)
        self.gbJ = Controles.GB(self, _("Adjudicator"), ly).to_connect(self.change_adjudicator)
        self.gbJ.setStyleSheet(gb_style)

        # Opciones
        vlayout = Colocacion.V().control(gbColor)
        vlayout.espacio(5).control(self.gbJ)
        vlayout.margen(20)
        gbBasic = Controles.GB(self, "", vlayout)
        gbBasic.setFlat(True)

        # Opciones avanzadas
        lyInicial = Colocacion.H().control(lbInicial).control(self.edJugInicial).relleno().control(lbBooks).control(self.cbBooks).relleno()
        vlayout = Colocacion.V().otro(lyInicial).control(gbOpening)
        vlayout.espacio(5).control(self.chContrario).margen(20).relleno()
        gbAdvanced = Controles.GB(self, "", vlayout)
        gbAdvanced.setFlat(True)

        # Historico
        self.liHisto = []
        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("FECHA", _("Date"), 100, centered=True)
        o_columns.nueva("PACIERTOS", _("Hints"), 90, centered=True)
        o_columns.nueva("PUNTOS", _("Points accumulated"), 140, centered=True)
        o_columns.nueva("ENGINE", _("Adjudicator"), 100, centered=True)
        o_columns.nueva("RESUMEN", _("Game played"), 280)

        self.grid = grid = Grid.Grid(self, o_columns, siSelecFilas=True, background=None)
        self.grid.coloresAlternados()
        self.register_grid(grid)

        # Tabs
        self.tab = Controles.Tab().set_position("S")
        self.tab.nuevaTab(gbBasic, _("Basic"))
        self.tab.nuevaTab(gbAdvanced, _("Advanced"))
        self.tab.nuevaTab(self.grid, _("Track record"))
        self.tab.setFont(flb)

        # Cabecera
        lyCab = Colocacion.H().control(gbGM)
        if self.li_personal:
            lyCab.control(gb_personal)

        layout = Colocacion.V().control(tb).otro(lyCab).control(self.tab).margen(6)

        self.setLayout(layout)

        self.restore_dic()
        self.change_adjudicator()
        self.check_gm()
        self.check_personal()
        self.check_histo()
        self.aperturaMuestra()
        self.btOpeningsFavoritas.hide()

        self.restore_video(anchoDefecto=750)
    def __init__(self, procesador, winBookGuide, dbGames):
        QtGui.QWidget.__init__(self)

        self.winBookGuide = winBookGuide
        self.procesador = procesador
        self.data = [[], [], [], []]
        self.movesWhite = []
        self.movesBlack = []
        self.lastFilterMoves = {"white": "", "black": ""}
        self.configuracion = procesador.configuracion

        self.infoMove = None  # <-- setInfoMove

        self.ap = AperturasStd.ap

        self.gridOpeningWhite = self.gridOpeningBlack = self.gridMovesWhite = self.gridMovesBlack = 0

        # GridOpening
        ancho = 54
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("opening", _("Opening"), 200)
        oColumnas.nueva("games", _("Games"), ancho, siDerecha=True)
        oColumnas.nueva("pgames", "% " + _("Games"), 70, siDerecha=True)
        oColumnas.nueva("win", _("Win"), ancho, siDerecha=True)
        oColumnas.nueva("draw", _("Draw"), ancho, siDerecha=True)
        oColumnas.nueva("lost", _("Loss"), ancho, siDerecha=True)
        oColumnas.nueva("pwin", "% " + _("Win"), ancho, siDerecha=True)
        oColumnas.nueva("pdraw", "% " + _("Draw"), ancho, siDerecha=True)
        oColumnas.nueva("plost", "% " + _("Loss"), ancho, siDerecha=True)
        oColumnas.nueva("pdrawwin", "%% %s" % _("W+D"), ancho, siDerecha=True)
        oColumnas.nueva("pdrawlost", "%% %s" % _("L+D"), ancho, siDerecha=True)

        self.gridOpeningWhite = Grid.Grid(self, oColumnas, siSelecFilas=True)
        self.gridOpeningBlack = Grid.Grid(self, oColumnas, siSelecFilas=True)

        # GridWhite/GridBlack
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("games", _("Games"), ancho, siDerecha=True)
        oColumnas.nueva("win", _("Win"), ancho, siDerecha=True)
        oColumnas.nueva("draw", _("Draw"), ancho, siDerecha=True)
        oColumnas.nueva("lost", _("Loss"), ancho, siDerecha=True)
        oColumnas.nueva("pwin", "% " + _("Win"), ancho, siDerecha=True)
        oColumnas.nueva("pdraw", "% " + _("Draw"), ancho, siDerecha=True)
        oColumnas.nueva("plost", "% " + _("Loss"), ancho, siDerecha=True)

        ancho_col = 40
        siFigurinesPGN = self.configuracion.figurinesPGN
        for x in range(1, 50):
            num = (x - 1) * 2
            oColumnas.nueva(str(num),
                            "%d." % x,
                            ancho_col,
                            siCentrado=True,
                            edicion=Delegados.EtiquetaPOS(siFigurinesPGN,
                                                          siLineas=False))
            oColumnas.nueva(str(num + 1),
                            "...",
                            ancho_col,
                            siCentrado=True,
                            edicion=Delegados.EtiquetaPOS(siFigurinesPGN,
                                                          siLineas=False))

        self.gridMovesWhite = Grid.Grid(self, oColumnas, siSelecFilas=True)
        self.gridMovesBlack = Grid.Grid(self, oColumnas, siSelecFilas=True)

        wWhite = QtGui.QWidget(self)
        tbmovesw = ToolbarMoves("white", self.dispatchMoves)
        ly = Colocacion.V().control(tbmovesw).control(
            self.gridMovesWhite).margen(3)
        wWhite.setLayout(ly)

        wblack = QtGui.QWidget(self)
        tbmovesb = ToolbarMoves("black", self.dispatchMoves)
        ly = Colocacion.V().control(tbmovesb).control(
            self.gridMovesBlack).margen(3)
        wblack.setLayout(ly)

        tabs = Controles.Tab(self)
        tabs.nuevaTab(self.gridOpeningWhite, _("White openings"))
        tabs.nuevaTab(self.gridOpeningBlack, _("Black openings"))
        tabs.nuevaTab(wWhite, _("White moves"))
        tabs.nuevaTab(wblack, _("Black moves"))

        # ToolBar
        liAccionesWork = [
            (_("Close"), Iconos.MainMenu(), self.tw_terminar),
            None,
            ("", Iconos.Usuarios(), self.tw_changeplayer),
            None,
            (_("Rebuild"), Iconos.Reindexar(), self.tw_rebuild),
            None,
        ]

        self.tbWork = Controles.TBrutina(self,
                                         liAccionesWork,
                                         tamIcon=24,
                                         puntos=12)
        self.tbWork.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)

        lyTB = Colocacion.H().control(self.tbWork)
        layout = Colocacion.V().otro(lyTB).control(tabs).margen(1)

        self.setLayout(layout)
        self.qtColor = (QTUtil.qtColorRGB(221, 255, 221),
                        QTUtil.qtColorRGB(247, 247, 247),
                        QTUtil.qtColorRGB(255, 217, 217))

        self.setdbGames(dbGames)
        self.setPlayer(self.leeVariable("PLAYER", ""))
Example #9
0
    def __init__(self, boardOriginal):
        main_window = boardOriginal.parent()
        titulo = _("Colors")
        icono = Iconos.EditarColores()
        extparam = "WColores"
        QTVarios.WDialogo.__init__(self, main_window, titulo, icono, extparam)

        self.boardOriginal = boardOriginal
        self.configuration = Code.configuration
        self.config_board = boardOriginal.config_board.copia(boardOriginal.config_board._id)
        self.is_base = boardOriginal.config_board._id == "BASE"

        # Temas #######################################################################################################
        li_options = [(_("Your themes"), self.configuration.ficheroTemas)]
        for entry in Util.listdir(Code.path_resource("Themes")):
            filename = entry.name
            if filename.endswith("lktheme3"):
                ctema = filename[:-9]
                li_options.append((ctema, Code.path_resource("Themes", filename)))

        self.cbTemas = Controles.CB(self, li_options, li_options[0][1]).capture_changes(self.cambiadoTema)
        self.lbSecciones = Controles.LB(self, _("Section") + ":")
        self.cbSecciones = Controles.CB(self, [], None).capture_changes(self.cambiadoSeccion)
        self.lb_help = Controles.LB(self, _("Left button to select, Right to show menu"))

        ly_temas = Colocacion.V()
        self.lista_bt_temas = []
        for i in range(12):
            ly = Colocacion.H()
            for j in range(6):
                bt = BotonTema(self, self.cambia_tema)
                ly.control(bt)
                bt.pon_tema(None)
                self.lista_bt_temas.append(bt)
            ly.relleno(1)
            ly_temas.otro(ly)
        ly_temas.relleno(1)

        def crea_lb(txt):
            return Controles.LB(self, txt + ": ").align_right()

        # Casillas
        lbTrans = Controles.LB(self, _("Degree of transparency"))
        lbPNG = Controles.LB(self, _("Image"))

        # # Blancas
        lbBlancas = crea_lb(_("White squares"))
        self.btBlancas = BotonColor(self, self.config_board.colorBlancas, self.actualizaBoard)
        self.btBlancasPNG = BotonImagen(self, self.config_board.png64Blancas, self.actualizaBoard, self.btBlancas)
        self.dialBlancasTrans = DialNum(self, self.config_board.transBlancas, self.actualizaBoard)

        # # Negras
        lbNegras = crea_lb(_("Black squares"))
        self.btNegras = BotonColor(self, self.config_board.colorNegras, self.actualizaBoard)
        self.btNegrasPNG = BotonImagen(self, self.config_board.png64Negras, self.actualizaBoard, self.btNegras)
        self.dialNegrasTrans = DialNum(self, self.config_board.transNegras, self.actualizaBoard)

        # Background
        lbFondo = crea_lb(_("Background"))
        self.btFondo = BotonColor(self, self.config_board.colorFondo, self.actualizaBoard)
        self.btFondoPNG = BotonImagen(self, self.config_board.png64Fondo, self.actualizaBoard, self.btFondo)
        self.chbExtended = Controles.CHB(self, _("Extended to outer border"), self.config_board.extendedColor()).capture_changes(self, self.extendedColor)

        # Actual
        self.chbTemas = Controles.CHB(self, _("Default"), self.config_board.siDefTema()).capture_changes(self, self.defectoTemas)
        if self.is_base:
            self.chbTemas.ponValor(False)
            self.chbTemas.setVisible(False)
        # Exterior
        lbExterior = crea_lb(_("Outer Border"))
        self.btExterior = BotonColor(self, self.config_board.colorExterior, self.actualizaBoard)
        self.btExteriorPNG = BotonImagen(self, self.config_board.png64Exterior, self.actualizaBoard, self.btExterior)

        # Texto
        lbTexto = crea_lb(_("Coordinates"))
        self.btTexto = BotonColor(self, self.config_board.colorTexto, self.actualizaBoard)
        # Frontera
        lbFrontera = crea_lb(_("Inner Border"))
        self.btFrontera = BotonColor(self, self.config_board.colorFrontera, self.actualizaBoard)

        # Flechas
        lbFlecha = crea_lb(_("Move indicator"))
        self.lyF = BotonFlecha(self, self.config_board.fTransicion, self.config_board.flechaDefecto, self.actualizaBoard)
        lbFlechaAlternativa = crea_lb(_("Arrow alternative"))
        self.lyFAlternativa = BotonFlecha(self, self.config_board.fAlternativa, self.config_board.flechaAlternativaDefecto, self.actualizaBoard)
        lbFlechaActivo = crea_lb(_("Active moves"))
        self.lyFActual = BotonFlecha(self, self.config_board.fActivo, self.config_board.flechaActivoDefecto, self.actualizaBoard)
        lbFlechaRival = crea_lb(_("Opponent moves"))
        self.lyFRival = BotonFlecha(self, self.config_board.fRival, self.config_board.flechaRivalDefecto, self.actualizaBoard)

        lyActual = Colocacion.G()
        lyActual.control(self.chbTemas, 0, 0)
        lyActual.controlc(lbPNG, 0, 2).controlc(lbTrans, 0, 3)
        lyActual.controld(lbBlancas, 1, 0).control(self.btBlancas, 1, 1).otroc(self.btBlancasPNG, 1, 2).otroc(self.dialBlancasTrans, 1, 3)
        lyActual.controld(lbNegras, 2, 0).control(self.btNegras, 2, 1).otroc(self.btNegrasPNG, 2, 2).otroc(self.dialNegrasTrans, 2, 3)
        lyActual.controld(lbFondo, 3, 0).control(self.btFondo, 3, 1).otroc(self.btFondoPNG, 3, 2).control(self.chbExtended, 3, 3)
        lyActual.controld(lbExterior, 4, 0).control(self.btExterior, 4, 1).otroc(self.btExteriorPNG, 4, 2)
        lyActual.controld(lbTexto, 5, 0).control(self.btTexto, 5, 1)
        lyActual.controld(lbFrontera, 6, 0).control(self.btFrontera, 6, 1)
        lyActual.controld(lbFlecha, 7, 0).otro(self.lyF, 7, 1, 1, 4)
        lyActual.controld(lbFlechaAlternativa, 8, 0).otro(self.lyFAlternativa, 8, 1, 1, 4)
        lyActual.controld(lbFlechaActivo, 9, 0).otro(self.lyFActual, 9, 1, 1, 4)
        lyActual.controld(lbFlechaRival, 10, 0).otro(self.lyFRival, 10, 1, 1, 4)

        gbActual = Controles.GB(self, _("Active theme"), lyActual)

        lySecciones = Colocacion.H().control(self.lbSecciones).control(self.cbSecciones).control(self.lb_help).relleno()
        ly = Colocacion.V().control(self.cbTemas).otro(lySecciones).otro(ly_temas).control(gbActual).relleno()
        gbTemas = Controles.GB(self, "", ly)
        gbTemas.setFlat(True)

        # mas options ################################################################################################
        def xDefecto(if_default):
            if self.is_base:
                if_default = False
            chb = Controles.CHB(self, _("Default"), if_default).capture_changes(self, self.defectoBoardM)
            if self.is_base:
                chb.setVisible(False)
            return chb

        def l2mas1(lyG, row, a, b, c):
            if a:
                ly = Colocacion.H().controld(a).control(b)
            else:
                ly = Colocacion.H().control(b)
            lyG.otro(ly, row, 0).control(c, row, 1)

        # Coordenadas
        lyG = Colocacion.G()
        # _nCoordenadas
        lbCoordenadas = crea_lb(_("Number"))
        li_options = [("0", 0), ("4", 4), ("2a", 2), ("2b", 3), ("2c", 5), ("2d", 6)]
        self.cbCoordenadas = Controles.CB(self, li_options, self.config_board.nCoordenadas()).capture_changes(self.actualizaBoardM)
        self.chbDefCoordenadas = xDefecto(self.config_board.siDefCoordenadas())
        l2mas1(lyG, 0, lbCoordenadas, self.cbCoordenadas, self.chbDefCoordenadas)

        # _tipoLetra
        lbTipoLetra = crea_lb(_("Font"))
        self.cbTipoLetra = QtWidgets.QFontComboBox()
        self.cbTipoLetra.setEditable(False)
        self.cbTipoLetra.setFontFilters(self.cbTipoLetra.ScalableFonts)
        self.cbTipoLetra.setCurrentFont(QtGui.QFont(self.config_board.tipoLetra()))
        self.cbTipoLetra.currentIndexChanged.connect(self.actualizaBoardM)
        self.chbDefTipoLetra = xDefecto(self.config_board.siDefTipoLetra())
        l2mas1(lyG, 1, lbTipoLetra, self.cbTipoLetra, self.chbDefTipoLetra)

        # _cBold
        self.chbBold = Controles.CHB(self, _("Bold"), self.config_board.siBold()).capture_changes(self, self.actualizaBoardM)
        self.chbDefBold = xDefecto(self.config_board.siDefBold())
        l2mas1(lyG, 2, None, self.chbBold, self.chbDefBold)

        # _tamLetra
        lbTamLetra = crea_lb(_("Size") + " %")
        self.sbTamLetra = Controles.SB(self, self.config_board.tamLetra(), 1, 200).tamMaximo(50).capture_changes(self.actualizaBoardM)
        self.chbDefTamLetra = xDefecto(self.config_board.siDefTamLetra())
        l2mas1(lyG, 3, lbTamLetra, self.sbTamLetra, self.chbDefTamLetra)

        # _sepLetras
        lbSepLetras = crea_lb(_("Separation") + " %")
        self.sbSepLetras = Controles.SB(self, self.config_board.sepLetras(), -1000, 1000).tamMaximo(50).capture_changes(self.actualizaBoardM)
        self.chbDefSepLetras = xDefecto(self.config_board.siDefSepLetras())
        l2mas1(lyG, 4, lbSepLetras, self.sbSepLetras, self.chbDefSepLetras)

        gbCoordenadas = Controles.GB(self, _("Coordinates"), lyG)

        ly_otros = Colocacion.G()
        # _nomPiezas
        li = []
        lbPiezas = crea_lb(_("Pieces"))
        for entry in Util.listdir(Code.path_resource("Pieces")):
            if entry.is_dir():
                li.append((entry.name, entry.name))
        li.sort(key=lambda x: x[0])
        self.cbPiezas = Controles.CB(self, li, self.config_board.nomPiezas()).capture_changes(self.actualizaBoardM)
        self.chbDefPiezas = xDefecto(self.config_board.siDefPiezas())
        l2mas1(ly_otros, 0, lbPiezas, self.cbPiezas, self.chbDefPiezas)

        # _tamRecuadro
        lbTamRecuadro = crea_lb(_("Outer Border Size") + " %")
        self.sbTamRecuadro = Controles.SB(self, self.config_board.tamRecuadro(), 0, 10000).tamMaximo(50).capture_changes(self.actualizaBoardM)
        self.chbDefTamRecuadro = xDefecto(self.config_board.siDefTamRecuadro())
        l2mas1(ly_otros, 1, lbTamRecuadro, self.sbTamRecuadro, self.chbDefTamRecuadro)

        # _tamFrontera
        lbTamFrontera = crea_lb(_("Inner Border Size") + " %")
        self.sbTamFrontera = Controles.SB(self, self.config_board.tamFrontera(), 0, 10000).tamMaximo(50).capture_changes(self.actualizaBoardM)
        self.chbDefTamFrontera = xDefecto(self.config_board.siDefTamFrontera())
        l2mas1(ly_otros, 2, lbTamFrontera, self.sbTamFrontera, self.chbDefTamFrontera)

        ly = Colocacion.V().control(gbCoordenadas).espacio(50).otro(ly_otros).relleno()

        gbOtros = Controles.GB(self, "", ly)
        gbOtros.setFlat(True)

        # Board #####################################################################################################
        cp = Position.Position().read_fen("2kr1b1r/2p1pppp/p7/3pPb2/1q3P2/2N1P3/PPP3PP/R1BQK2R w KQ - 0 1")
        self.board = Board.Board(self, self.config_board, siMenuVisual=False)
        self.board.crea()
        self.board.set_position(cp)
        self.rehazFlechas()

        li_acciones = [
            (_("Accept"), Iconos.Aceptar(), self.aceptar),
            None,
            (_("Cancel"), Iconos.Cancelar(), self.cancelar),
            None,
            ("%s/%s" % (_("Save"), _("Save as")), Iconos.Grabar(), self.menu_save),
            None,
            (_("Import"), Iconos.Import8(), self.importar),
            None,
            (_("Export"), Iconos.Export8(), self.exportar),
            None,
        ]
        tb = QTVarios.LCTB(self, li_acciones)

        # tam board
        self.lbTamBoard = Controles.LB(self, "%d px" % self.board.width())

        # Juntamos
        lyT = Colocacion.V().control(tb).espacio(15).control(self.board).controli(self.lbTamBoard).relleno(1).margen(3)

        self.tab = Controles.Tab()
        self.tab.nuevaTab(gbTemas, _("Themes"))
        self.tab.nuevaTab(gbOtros, _("Other options"))
        ly = Colocacion.H().otro(lyT).control(self.tab)

        self.setLayout(ly)

        self.elegido = None

        self.li_themes = self.read_own_themes()
        self.current_theme = {"NOMBRE": "", "SECCION": "", "CHANGE_PIECES": True, "o_tema": self.config_board.grabaTema(), "o_base": self.config_board.grabaBase()}
        self.own_theme_selected = False
        self.cambiadoTema()
        self.defectoTemas()

        self.extendedColor()

        self.siActualizando = False

        self.restore_video(siTam=False)
Example #10
0
    def __init__(self, wParent, torneo):

        titulo = _("Competition")
        icono = Iconos.Torneos()
        extparam = "untorneo_v1"
        QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)

        self.configuracion = VarGen.configuracion

        # Datos
        self.torneo = torneo
        self.liEnActual = []
        self.xjugar = None
        self.liResult = None

        # Toolbar
        liAcciones = ((_("Save") + "+" + _("Quit"), Iconos.MainMenu(), self.terminar), None,
                      (_("Cancel"), Iconos.Cancelar(), self.cancelar), None,
                      (_("Play"), Iconos.Empezar(), self.gmJugar), None,
                      )
        tb = Controles.TBrutina(self, liAcciones)

        # Tabs
        self.tab = tab = Controles.Tab()

        # Tab-configuracion --------------------------------------------------
        w = QtGui.QWidget()
        # # Nombre
        lbNombre = Controles.LB(self, _("Name") + ": ")
        self.edNombre = Controles.ED(w, torneo.nombre())
        # # Resign
        lbResign = Controles.LB(self, _("Minimum points to assign winner") + ": ")
        self.sbResign = Controles.SB(self, torneo.resign(), 60, 100000)
        # Draw-plys
        lbDrawMinPly = Controles.LB(self, _("Minimum moves to assign draw") + ": ")
        self.sbDrawMinPly = Controles.SB(self, torneo.drawMinPly(), 20, 1000)
        # Draw-puntos
        lbDrawRange = Controles.LB(self, _("Maximum points to assign draw") + ": ")
        self.sbDrawRange = Controles.SB(self, torneo.drawRange(), 0, 50)

        lbBook = Controles.LB(self, _("Opening book") + ": ")
        fvar = self.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, ("* " + _("None"), "-"))
        self.cbBooks = Controles.CB(self, li, torneo.book())
        btNuevoBook = Controles.PB(self, "", self.nuevoBook, plano=False).ponIcono(Iconos.Nuevo(), tamIcon=16)
        lyBook = Colocacion.H().control(self.cbBooks).control(btNuevoBook).relleno()

        lbBookDepth = Controles.LB(self, _("Max depth of book (0=Maximum)") + ": ")
        self.sbBookDepth = Controles.SB(self, torneo.bookDepth(), 0, 200)

        # Posicion inicial
        lbFEN = Controles.LB(self, _("Initial position") + ": ")
        self.fen = torneo.fen()
        self.btPosicion = Controles.PB(self, " " * 5 + _("Change") + " " * 5, self.posicionEditar).ponPlano(False)
        self.btPosicionQuitar = Controles.PB(self, "", self.posicionQuitar).ponIcono(Iconos.Motor_No())
        self.btPosicionPegar = Controles.PB(self, "", self.posicionPegar).ponIcono(Iconos.Pegar16()).ponToolTip(
                _("Paste FEN position"))
        lyFEN = Colocacion.H().control(self.btPosicionQuitar).control(self.btPosicion).control(
                self.btPosicionPegar).relleno()

        # Norman Pollock
        lbNorman = Controles.LB(self, '%s(<a href="https://komodochess.com/pub/40H-pgn-utilities">?</a>): ' %
                                _("Initial position from Norman Pollock openings database"))
        self.chbNorman = Controles.CHB(self, " ", self.torneo.norman())

        # Layout
        layout = Colocacion.G()
        layout.controld(lbNombre, 0, 0).control(self.edNombre, 0, 1)
        layout.controld(lbResign, 1, 0).control(self.sbResign, 1, 1)
        layout.controld(lbDrawMinPly, 2, 0).control(self.sbDrawMinPly, 2, 1)
        layout.controld(lbDrawRange, 3, 0).control(self.sbDrawRange, 3, 1)
        layout.controld(lbBook, 4, 0).otro(lyBook, 4, 1)
        layout.controld(lbBookDepth, 5, 0).control(self.sbBookDepth, 5, 1)
        layout.controld(lbFEN, 6, 0).otro(lyFEN, 6, 1)
        layout.controld(lbNorman, 7, 0).control(self.chbNorman, 7, 1)
        layoutV = Colocacion.V().relleno().otro(layout).relleno()
        layoutH = Colocacion.H().relleno().otro(layoutV).relleno()

        # Creamos
        w.setLayout(layoutH)
        tab.nuevaTab(w, _("Configuration"))

        # Tab-engines --------------------------------------------------
        self.splitterEngines = QtGui.QSplitter(self)
        self.registrarSplitter(self.splitterEngines, "engines")
        # TB
        liAcciones = [(_("New"), Iconos.TutorialesCrear(), self.enNuevo), None,
                      (_("Modify"), Iconos.Modificar(), self.enModificar), None,
                      (_("Remove"), Iconos.Borrar(), self.enBorrar), None,
                      (_("Copy"), Iconos.Copiar(), self.enCopiar), None,
                      (_("Import"), Iconos.MasDoc(), self.enImportar), None,
                      ]
        tbEnA = Controles.TBrutina(self, liAcciones, tamIcon=24)

        # Grid engine
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("ALIAS", _("Alias"), 209)
        self.gridEnginesAlias = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="EA", siSeleccionMultiple=True)
        self.registrarGrid(self.gridEnginesAlias)

        w = QtGui.QWidget()
        ly = Colocacion.V().control(self.gridEnginesAlias).margen(0)
        w.setLayout(ly)
        self.splitterEngines.addWidget(w)

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("CAMPO", _("Label"), 200, siDerecha=True)
        oColumnas.nueva("VALOR", _("Value"), 286)
        self.gridEnginesValores = Grid.Grid(self, oColumnas, siSelecFilas=False, xid="EV")
        self.registrarGrid(self.gridEnginesValores)

        w = QtGui.QWidget()
        ly = Colocacion.V().control(self.gridEnginesValores).margen(0)
        w.setLayout(ly)
        self.splitterEngines.addWidget(w)

        self.splitterEngines.setSizes([250, 520])  # por defecto

        w = QtGui.QWidget()
        ly = Colocacion.V().control(tbEnA).control(self.splitterEngines)
        w.setLayout(ly)
        tab.nuevaTab(w, _("Engines"))

        # Creamos

        # Tab-games --------------------------------------------------
        w = QtGui.QWidget()
        # TB
        liAcciones = [(_("New"), Iconos.TutorialesCrear(), self.gmCrear), None,
                      (_("Remove"), Iconos.Borrar(), self.gmBorrar), None,
                      (_("Show"), Iconos.PGN(), self.gmMostrar), None,
                      (_("Save") + "(%s)" % _("PGN"), Iconos.GrabarComo(), self.gmGuardar), None,
                      ]
        tbEnG = Controles.TBrutina(self, liAcciones, tamIcon=24)
        # Grid engine
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("WHITE", _("White"), 190, siCentrado=True)
        oColumnas.nueva("BLACK", _("Black"), 190, siCentrado=True)
        oColumnas.nueva("RESULT", _("Result"), 190, siCentrado=True)
        oColumnas.nueva("TIEMPO", _("Time"), 170, siCentrado=True)
        self.gridGames = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="G", siSeleccionMultiple=True)
        self.registrarGrid(self.gridGames)
        # Layout
        layout = Colocacion.V().control(tbEnG).control(self.gridGames)

        # Creamos
        w.setLayout(layout)
        tab.nuevaTab(w, _("Games"))

        # Tab-resultado --------------------------------------------------
        w = QtGui.QWidget()

        # Grid
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("NUMERO", _("N."), 35, siCentrado=True)
        oColumnas.nueva("MOTOR", _("Engine"), 190, siCentrado=True)
        oColumnas.nueva("GANADOS", _("Wins"), 120, siCentrado=True)
        oColumnas.nueva("TABLAS", _("Draw"), 120, siCentrado=True)
        oColumnas.nueva("PERDIDOS", _("Lost"), 120, siCentrado=True)
        oColumnas.nueva("PUNTOS", _("Points"), 120, siCentrado=True)
        self.gridResult = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="R")
        self.registrarGrid(self.gridResult)
        # Layout
        layout = Colocacion.V().control(self.gridResult)

        # Creamos
        w.setLayout(layout)
        tab.nuevaTab(w, _("Result"))

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

        self.recuperarVideo(siTam=True, anchoDefecto=800, altoDefecto=430)

        self.gridEnginesAlias.gotop()

        self.edNombre.setFocus()

        self.muestraPosicion()
Example #11
0
    def __init__(self, procesador):
        self.configuracion = procesador.configuracion
        self.procesador = procesador

        self.dbHisto = Util.DicSQL(self.configuracion.ficheroGMhisto)
        self.bloqueApertura = None
        self.liAperturasFavoritas = []

        wParent = procesador.pantalla
        titulo = _("Play like a grandmaster")
        icono = Iconos.GranMaestro()
        extparam = "gm"
        QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)

        flb = Controles.TipoLetra(puntos=10)

        # Toolbar
        liAcciones = [(_("Accept"), Iconos.Aceptar(), self.aceptar), None,
                      (_("Cancel"), Iconos.Cancelar(), self.cancelar), None,
                      (_("One game"), Iconos.Uno(), self.unJuego), None,
                      (_("Import"), Iconos.ImportarGM(), self.importar)
                      ]
        tb = Controles.TBrutina(self, liAcciones)

        # Grandes maestros
        self.liGM = GM.listaGM()
        li = [(x[0], x[1]) for x in self.liGM]
        li.insert(0, ("-", None))
        self.cbGM = QTUtil2.comboBoxLB(self, li, li[0][1] if len(self.liGM) == 0 else li[1][1])
        self.cbGM.capturaCambiado(self.compruebaGM)
        hbox = Colocacion.H().relleno().control(self.cbGM).relleno()
        gbGM = Controles.GB(self, _("Choose a grandmaster"), hbox).ponFuente(flb)

        # Personales
        self.liPersonal = GM.listaGMpersonal(self.procesador.configuracion.dirPersonalTraining)
        if self.liPersonal:
            li = [(x[0], x[1]) for x in self.liPersonal]
            li.insert(0, ("-", None))
            self.cbPersonal = QTUtil2.comboBoxLB(self, li, li[0][1])
            self.cbPersonal.capturaCambiado(self.compruebaP)
            btBorrar = Controles.PB(self, "", self.borrarPersonal, plano=False).ponIcono(Iconos.Borrar(), tamIcon=16)
            hbox = Colocacion.H().relleno().control(self.cbPersonal).control(btBorrar).relleno()
            gbPersonal = Controles.GB(self, _("Personal games"), hbox).ponFuente(flb)

        # Color
        self.rbBlancas = Controles.RB(self, _("White"), rutina=self.compruebaColor)
        self.rbBlancas.activa(True)
        self.rbNegras = Controles.RB(self, _("Black"), rutina=self.compruebaColor)
        self.rbNegras.activa(False)

        # Contrario
        self.chContrario = Controles.CHB(self, _("Choose the opponent's move, when there are multiple possible answers"),
                                         False)

        # Juez
        liDepths = [("--", 0)]
        for x in range(1, 31):
            liDepths.append((str(x), x))
        self.liMotores = self.configuracion.comboMotoresMultiPV10()
        self.cbJmotor, self.lbJmotor = QTUtil2.comboBoxLB(self, self.liMotores, self.configuracion.tutorInicial, _("Engine"))
        self.edJtiempo = Controles.ED(self).tipoFloat().ponFloat(1.0).anchoFijo(50)
        self.lbJtiempo = Controles.LB2P(self, _("Time in seconds"))
        self.cbJdepth = Controles.CB(self, liDepths, 0).capturaCambiado(self.cambiadoDepth)
        self.lbJdepth = Controles.LB2P(self, _("Depth"))
        self.lbJshow = Controles.LB2P(self, _("Show rating"))
        self.chbEvals = Controles.CHB(self, _("Show all evaluations"), False)
        liOptions = [(_("All moves"), None), (_("Moves are different"), True), (_("Never"), False)]
        self.cbJshow = Controles.CB(self, liOptions, True)
        self.lbJmultiPV = Controles.LB2P(self, _("Number of moves evaluated by engine(MultiPV)"))
        li = [(_("Default"), "PD"),
              (_("Maximum"), "MX")]
        for x in (1, 3, 5, 10, 15, 20, 30, 40, 50, 75, 100, 150, 200):
            li.append((str(x), str(x)))
        self.cbJmultiPV = Controles.CB(self, li, "PD")

        # Inicial
        self.edJugInicial, lbInicial = QTUtil2.spinBoxLB(self, 1, 1, 99, etiqueta=_("Initial move"), maxTam=40)

        # Libros
        fvar = self.configuracion.ficheroBooks
        self.listaLibros = Books.ListaLibros()
        self.listaLibros.recuperaVar(fvar)
        # # Comprobamos que todos esten accesibles
        self.listaLibros.comprueba()
        li = [(x.nombre, x) for x in self.listaLibros.lista]
        li.insert(0, ("--", None))
        self.cbBooks, lbBooks = QTUtil2.comboBoxLB(self, li, None, _("Bypass moves in the book"))

        # Aperturas

        self.btApertura = Controles.PB(self, " " * 5 + _("Undetermined") + " " * 5, self.aperturasEditar).ponPlano(
                False)
        self.btAperturasFavoritas = Controles.PB(self, "", self.aperturasFavoritas).ponIcono(Iconos.Favoritos())
        self.btAperturasQuitar = Controles.PB(self, "", self.aperturasQuitar).ponIcono(Iconos.Motor_No())
        hbox = Colocacion.H().control(self.btAperturasQuitar).control(self.btApertura).control(
                self.btAperturasFavoritas).relleno()
        gbOpening = Controles.GB(self, _("Opening"), hbox)

        # gbBasic
        # # Color
        hbox = Colocacion.H().relleno().control(self.rbBlancas).espacio(10).control(self.rbNegras).relleno()
        gbColor = Controles.GB(self, _("Play with"), hbox).ponFuente(flb)

        # Tiempo
        ly1 = Colocacion.H().control(self.lbJmotor).control(self.cbJmotor).control(self.lbJshow).control(
                self.cbJshow).relleno()
        ly2 = Colocacion.H().control(self.lbJtiempo).control(self.edJtiempo)
        ly2.control(self.lbJdepth).control(self.cbJdepth).espacio(15).control(self.chbEvals).relleno()
        ly3 = Colocacion.H().control(self.lbJmultiPV).control(self.cbJmultiPV).relleno()
        ly = Colocacion.V().otro(ly1).otro(ly2).otro(ly3)
        self.gbJ = Controles.GB(self, _("Adjudicator"), ly).conectar(self.cambiaJuez)

        # Opciones
        vlayout = Colocacion.V().control(gbColor)
        vlayout.espacio(5).control(self.gbJ)
        vlayout.margen(20)
        gbBasic = Controles.GB(self, "", vlayout)
        gbBasic.setFlat(True)

        # Opciones avanzadas
        lyInicial = Colocacion.H().control(lbInicial).control(self.edJugInicial).relleno().control(lbBooks).control(
                self.cbBooks).relleno()
        vlayout = Colocacion.V().relleno().otro(lyInicial).control(gbOpening)
        vlayout.espacio(5).control(self.chContrario).margen(20).relleno()
        gbAdvanced = Controles.GB(self, "", vlayout)
        gbAdvanced.setFlat(True)

        # Historico
        self.liHisto = []
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("FECHA", _("Date"), 80, siCentrado=True)
        oColumnas.nueva("PACIERTOS", _("Hints"), 90, siCentrado=True)
        oColumnas.nueva("PUNTOS", _("Points accumulated"), 120, siCentrado=True)
        oColumnas.nueva("ENGINE", _("Adjudicator"), 100, siCentrado=True)
        oColumnas.nueva("RESUMEN", _("Game played"), 150)

        self.grid = grid = Grid.Grid(self, oColumnas, siSelecFilas=True, background=None)
        self.grid.coloresAlternados()
        self.registrarGrid(grid)

        # Tabs
        self.tab = Controles.Tab().ponPosicion("S")
        self.tab.nuevaTab(gbBasic, _("Basic"))
        self.tab.nuevaTab(gbAdvanced, _("Advanced"))
        self.tab.nuevaTab(self.grid, _("Track record"))

        # Cabecera
        lyCab = Colocacion.H().control(gbGM)
        if self.liPersonal:
            lyCab.control(gbPersonal)

        layout = Colocacion.V().control(tb).otro(lyCab).control(self.tab).margen(3)

        self.setLayout(layout)

        self.recuperaDic()
        self.cambiaJuez()
        self.compruebaGM()
        self.compruebaP()
        self.compruebaHisto()
        self.aperturaMuestra()
        self.btAperturasFavoritas.hide()

        self.recuperarVideo(anchoDefecto=450)
Example #12
0
    def __init__(self, wParent, torneo, torneoTMP, gestor):

        titulo = _("Results")
        icono = Iconos.Torneos()
        extparam = "unresulttorneo"
        QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)

        # Datos
        self.torneo = torneo
        self.torneoTMP = torneoTMP
        self.gestor = gestor
        self.liResult = self.torneo.rehacerResult()
        self.liResultTMP = self.torneoTMP.rehacerResult()

        # Tabs
        self.tab = tab = Controles.Tab()

        # Tab-configuracion --------------------------------------------------
        w = QtGui.QWidget()
        # # Grid
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("NUMERO", _("N."), 35, siCentrado=True)
        oColumnas.nueva("MOTOR", _("Engine"), 190, siCentrado=True)
        oColumnas.nueva("GANADOS", _("Wins"), 120, siCentrado=True)
        oColumnas.nueva("PERDIDOS", _("Lost"), 120, siCentrado=True)
        oColumnas.nueva("TABLAS", _("Draw"), 120, siCentrado=True)
        oColumnas.nueva("PUNTOS", _("Points"), 120, siCentrado=True)
        self.gridResultTMP = Grid.Grid(self,
                                       oColumnas,
                                       siSelecFilas=True,
                                       id="T")
        # # Layout
        layout = Colocacion.V().control(self.gridResultTMP)
        w.setLayout(layout)
        tab.nuevaTab(w, _("Current"))

        # Tab-configuracion --------------------------------------------------
        w = QtGui.QWidget()
        ## Grid
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("NUMERO", _("N."), 35, siCentrado=True)
        oColumnas.nueva("MOTOR", _("Engine"), 190, siCentrado=True)
        oColumnas.nueva("GANADOS", _("Wins"), 120, siCentrado=True)
        oColumnas.nueva("PERDIDOS", _("Lost"), 120, siCentrado=True)
        oColumnas.nueva("TABLAS", _("Draw"), 120, siCentrado=True)
        oColumnas.nueva("PUNTOS", _("Points"), 120, siCentrado=True)
        self.gridResult = Grid.Grid(self, oColumnas, siSelecFilas=True, id="B")
        ## Layout
        layout = Colocacion.V().control(self.gridResult)
        w.setLayout(layout)
        tab.nuevaTab(w, _("All"))

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

        self.registrarGrid(self.gridResultTMP)
        self.registrarGrid(self.gridResult)
        self.recuperarVideo(siTam=True, anchoDefecto=800, altoDefecto=430)

        self.gridResult.gotop()
        self.gridResultTMP.gotop()
Example #13
0
    def __init__(self, w_parent, procesador, file_database, is_temporary,
                 si_select):
        self.is_temporary = is_temporary
        icono = Iconos.Database()
        extparam = "databases"
        titulo = _("Temporary database") if self.is_temporary else _(
            "Database")
        QTVarios.WDialogo.__init__(self, w_parent, titulo, icono, extparam)
        self.owner = w_parent

        self.procesador = procesador
        self.configuration = procesador.configuration

        self.reiniciar = False  # lo usamos para cambiar de database

        self.dbGames = DBgames.DBgames(file_database)

        self.dicvideo = self.restore_dicvideo()
        dicVideo = self.dicvideo

        siSummary = not si_select

        self.wplayer = WDB_Players.WPlayer(procesador, self, self.dbGames)
        self.wplayer_active = False

        if siSummary:
            self.wsummary = WDB_Summary.WSummary(procesador,
                                                 self,
                                                 self.dbGames,
                                                 siMoves=False)
            self.register_grid(self.wsummary.grid)

        else:
            self.wsummary = None

        self.wgames = WDB_Games.WGames(procesador, self, self.dbGames,
                                       self.wsummary, si_select)

        self.ultFocus = None

        self.tab = Controles.Tab()
        self.tab.nuevaTab(self.wgames, _("Games"))
        if siSummary:
            self.tab.nuevaTab(self.wsummary, _("Summary"))
            self.tab.dispatchChange(self.tabChanged)
        if not si_select:
            self.tab.nuevaTab(self.wplayer, _("Players"))
        self.tab.ponTipoLetra(puntos=procesador.configuration.x_tb_fontpoints)

        if self.owner and not self.is_temporary:
            liAccionesWork = [(_("Select other"), Iconos.Database(),
                               self.tw_select_other)]
            self.tbWork = QTVarios.LCTB(self, liAccionesWork, icon_size=20)
            self.tbWork.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
            self.tab.setCornerWidget(self.tbWork)

        w = QtWidgets.QWidget(self)
        layoutv = Colocacion.V().control(self.tab).margen(4)
        w.setLayout(layoutv)

        self.infoMove = WDB_InfoMove.WInfomove(self)

        self.splitter = splitter = QtWidgets.QSplitter()
        splitter.addWidget(w)
        splitter.addWidget(self.infoMove)

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

        self.restore_video(anchoDefecto=1200, altoDefecto=600)
        if not dicVideo:
            dicVideo = {
                "SPLITTER": [800, 380],
                "TREE_1": 25,
                "TREE_2": 25,
                "TREE_3": 50,
                "TREE_4": 661
            }

        if not ("SPLITTER" in dicVideo):
            ancho = self.width()
            ancho_board = self.infoMove.board.width()
            sz = [ancho - ancho_board, ancho_board]
        else:
            sz = dicVideo["SPLITTER"]
        self.splitter.setSizes(sz)

        dic_grid = self.dbGames.read_config("dic_grid")
        if not dic_grid:
            key = "databases_columns_default"
            dic_grid = self.configuration.read_variables(key)
        if dic_grid:
            self.wgames.grid.restore_video(dic_grid)
            self.wgames.grid.releerColumnas()

        self.inicializa()
Example #14
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()
Example #15
0
    def __init__(self, wParent, procesador, fenM2inicial=None, pvInicial=None):

        icono = Iconos.BookGuide()
        extparam = "edicionMyOwnBook"
        titulo = _("Personal Opening Guide")
        QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)

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

        self.fenM2inicial = fenM2inicial
        self.pvInicial = pvInicial
        self.bookGuide = BookGuide.BookGuide(self)
        self.dbGames = DBgames.DBgames(self.configuracion.ficheroDBgames)

        dicVideo = self.recuperarDicVideo()

        self.wmoves = WBG_Moves.WMoves(procesador, self)

        self.wsummary = WBG_Summary.WSummary(procesador, self, self.dbGames)

        self.wgames = WBG_Games.WGames(procesador, self, self.dbGames,
                                       self.wsummary)

        self.registrarGrid(self.wsummary.grid)
        self.registrarGrid(self.wgames.grid)

        self.ultFocus = None

        self.splitterMoves = QtGui.QSplitter(self)
        self.splitterMoves.setOrientation(QtCore.Qt.Vertical)
        self.splitterMoves.addWidget(self.wmoves)
        self.splitterMoves.addWidget(self.wsummary)

        self.tab = Controles.Tab()
        self.tab.nuevaTab(self.splitterMoves, _("Moves"))
        self.tab.nuevaTab(self.wgames, _("Games"))
        self.tab.dispatchChange(self.tabChanged)

        self.infoMove = WBG_InfoMove.WInfomove(self)

        self.splitter = splitter = QtGui.QSplitter(self)
        splitter.addWidget(self.infoMove)
        splitter.addWidget(self.tab)

        layout = Colocacion.H().control(splitter).margen(5)

        self.setLayout(layout)

        self.wmoves.tree.setFocus()

        self.recuperarVideo(anchoDefecto=1175)
        if not dicVideo:
            dicVideo = {
                'SPLITTER': [380, 816],
                'TREE_1': 25,
                'TREE_2': 25,
                'TREE_3': 50,
                'TREE_4': 661,
                'SPLITTERMOVES': [344, 244]
            }
        sz = dicVideo.get("SPLITTER", None)
        if sz:
            self.splitter.setSizes(sz)
        for x in range(1, 6):
            w = dicVideo.get("TREE_%d" % x, None)
            if w:
                self.wmoves.tree.setColumnWidth(x, w)

        self.inicializa()
Example #16
0
    def __init__(self, wParent, procesador):

        icono = Iconos.DatabaseC()
        extparam = "database"
        titulo = _("Database of complete games")
        QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)

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

        self.dbGames = DBgames.DBgames(self.configuracion.ficheroDBgames)

        dicVideo = self.recuperarDicVideo()

        self.bookGuide = BookGuide.BookGuide(self)
        self.wsummary = WBG_Summary.WSummary(procesador,
                                             self,
                                             self.dbGames,
                                             siMoves=False)

        self.wgames = WBG_Games.WGames(procesador,
                                       self,
                                       self.dbGames,
                                       self.wsummary,
                                       siMoves=False)

        self.registrarGrid(self.wsummary.grid)
        self.registrarGrid(self.wgames.grid)

        self.ultFocus = None

        self.tab = Controles.Tab()
        self.tab.nuevaTab(self.wgames, _("Games"))
        self.tab.nuevaTab(self.wsummary, _("Summary"))
        self.tab.dispatchChange(self.tabChanged)
        self.tab.ponTipoLetra(puntos=procesador.configuracion.puntosTB)

        self.infoMove = WBG_InfoMove.WInfomove(self, siMoves=False)

        self.splitter = splitter = QtGui.QSplitter()
        splitter.addWidget(self.tab)
        splitter.addWidget(self.infoMove)

        layout = Colocacion.H().control(splitter).margen(5)

        self.setLayout(layout)

        self.recuperarVideo(anchoDefecto=1200, altoDefecto=600)
        if not dicVideo:
            dicVideo = {
                'SPLITTER': [800, 380],
                'TREE_1': 25,
                'TREE_2': 25,
                'TREE_3': 50,
                'TREE_4': 661,
            }
        sz = dicVideo.get("SPLITTER", None)
        if sz:
            self.splitter.setSizes(sz)

        self.inicializa()
Example #17
0
    def __init__(self, wowner, gestor, alm, muestraAnalisis):
        titulo = _("Result of analysis")
        icono = Iconos.Estadisticas()
        extparam = "estadisticasv1"
        QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam)
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        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)

        lbIndexes = Controles.LB(self, alm.indexesHTML)
        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(lbIndexes).otro(ly0).relleno()
        wIdx = QtGui.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 perfomance"),
                                      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(siTam=False)

        gridAll.gotop()
        gridB.gotop()
        gridW.gotop()
        self.gridBotonIzquierdo(gridAll, 0, None)
        self.tabGrid.setFixedHeight(self.tablero.height())
        self.adjustSize()
Example #18
0
    def __init__(self, procesador, titulo):

        QTVarios.WDialogo.__init__(self, procesador.pantalla, titulo,
                                   Iconos.Libre(), "entMaquina")

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

        self.personalidades = Personalidades.Personalidades(
            self, self.configuracion)

        self.motores = Motores.Motores(self.configuracion)

        # Toolbar

        liAcciones = [
            (_("Accept"), Iconos.Aceptar(), self.aceptar),
            None,
            (_("Cancel"), Iconos.Cancelar(), self.cancelar),
            None,
            (_("Configurations"), Iconos.Configurar(), self.configuraciones),
            None,
        ]
        tb = Controles.TBrutina(self, liAcciones)

        # Tab

        tab = Controles.Tab()

        def nuevoG():
            lyG = Colocacion.G()
            lyG.filaActual = 0
            return lyG

        gbStyle = """
            QGroupBox {
                font: bold 16px;
                background-color: #F2F2EC;/*qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);*/
                border: 1px solid gray;
                border-radius: 3px;
                margin-top: 5ex; /* leave space at the top for the title */
            }
            QGroupBox::title {
                subcontrol-origin: margin;
                subcontrol-position: top center; /* position at the top center */
                padding: 0 3px;
             }
        """

        def _label(lyG, txt, ly, rutinaCHB=None, siCheck=False):
            gb = Controles.GB(self, txt, ly)
            if rutinaCHB:
                gb.conectar(rutinaCHB)
            elif siCheck:
                gb.setCheckable(True)
                gb.setChecked(False)

            gb.setStyleSheet(gbStyle)
            lyG.controlc(gb, lyG.filaActual, 0)
            lyG.filaActual += 1
            return gb

        # TAB General

        lyG = nuevoG()

        # Blancas o negras
        self.rbBlancas = Controles.RB(self, "").activa()
        self.rbBlancas.setIcon(
            QTVarios.fsvg2ico("Pieces/Chessicons/wp.svg", 64))
        self.rbNegras = Controles.RB(self, "")
        self.rbNegras.setIcon(QTVarios.fsvg2ico("Pieces/Chessicons/bp.svg",
                                                64))
        self.rbRandom = Controles.RB(self, _("Random"))
        hbox = Colocacion.H().relleno().control(
            self.rbBlancas).espacio(30).control(
                self.rbNegras).espacio(30).control(self.rbRandom).relleno()
        _label(lyG, _("Select color"), hbox)

        # Motores
        liDepths = [("--", 0)]
        for x in range(1, 31):
            liDepths.append((str(x), x))

        # # Rival
        self.rival = self.configuracion.rivalInicial
        self.rivalTipo = Motores.INTERNO
        self.btRival = Controles.PB(self, "", self.cambiaRival, plano=False)
        self.edRtiempo = Controles.ED(self).tipoFloat().anchoMaximo(50)
        self.cbRdepth = Controles.CB(self, liDepths,
                                     0).capturaCambiado(self.cambiadoDepth)
        lbTiempoSegundosR = Controles.LB2P(self, _("Time"))
        lbNivel = Controles.LB2P(self, _("Depth"))

        # # Ajustar rival
        liAjustes = self.personalidades.listaAjustes(True)
        self.cbAjustarRival = Controles.CB(self, liAjustes,
                                           kAjustarMejor).capturaCambiado(
                                               self.ajustesCambiado)
        lbAjustarRival = Controles.LB2P(self, _("Set strength"))
        btAjustarRival = Controles.PB(self,
                                      _("Personality"),
                                      self.cambiaPersonalidades,
                                      plano=True).ponIcono(Iconos.Mas(),
                                                           tamIcon=16)

        # Resign
        lbResign = Controles.LB2P(self, _("Resign/draw by engine"))
        liResign = ((_("Very early"), -100), (_("Early"), -300),
                    (_("Average"), -500), (_("Late"), -800),
                    (_("Very late"), -1000), (_("Never"), -9999999))
        self.cbResign = Controles.CB(self, liResign, -800)

        lyH1 = Colocacion.H().control(self.btRival).espacio(20)
        lyH1.control(lbTiempoSegundosR).control(self.edRtiempo)
        lyH1.control(lbNivel).control(self.cbRdepth).relleno()
        lyH2 = Colocacion.H().control(lbAjustarRival).control(
            self.cbAjustarRival).control(btAjustarRival).relleno()
        lyH3 = Colocacion.H().control(lbResign).control(
            self.cbResign).relleno()
        ly = Colocacion.V().otro(lyH1).otro(lyH2).otro(lyH3)
        _label(lyG, _("Opponent"), ly)

        gb = Controles.GB(self, "", lyG)
        tab.nuevaTab(gb, _("Basic configuration"))

        # TAB Ayudas
        lbAyudas = Controles.LB2P(self, _("Available hints"))
        self.sbAyudas = Controles.SB(self, 7, 0, 999).tamMaximo(50)
        self.cbAtras = Controles.CHB(self, _("Takeback"), True)
        self.cbChance = Controles.CHB(self, _("Second chance"), True)
        btTutorChange = Controles.PB(self,
                                     _("Tutor change"),
                                     self.tutorChange,
                                     plano=False).ponIcono(Iconos.Tutor(),
                                                           tamIcon=16)

        liThinks = [(_("Nothing"), -1), (_("Score"), 0)]
        for i in range(1, 5):
            liThinks.append(
                ("%d %s" % (i, _("ply") if i == 1 else _("plies")), i))
        liThinks.append((_("All"), 9999))

        lb = Controles.LB(self, _("It is showed") + ":")
        self.cbThoughtTt = Controles.CB(self, liThinks, -1)
        self.cbContinueTt = Controles.CHB(
            self, _("The tutor thinks while you think"), True)
        lbBoxHeight = Controles.LB2P(self, _("Box height"))
        self.sbBoxHeight = Controles.SB(self, 7, 0, 999).tamMaximo(50)
        ly1 = Colocacion.H().control(lb).control(self.cbThoughtTt).relleno()
        ly2 = Colocacion.H().control(lbBoxHeight).control(
            self.sbBoxHeight).relleno()
        ly = Colocacion.V().otro(ly1).control(
            self.cbContinueTt).espacio(16).otro(ly2).relleno()
        gbThoughtTt = Controles.GB(self, _("Thought of the tutor"), ly)
        gbThoughtTt.setStyleSheet(gbStyle)

        lb = Controles.LB(self, _("It is showed") + ":")
        self.cbThoughtOp = Controles.CB(self, liThinks, -1)
        lbArrows = Controles.LB2P(self, _("Arrows to show"))
        self.sbArrows = Controles.SB(self, 7, 0, 999).tamMaximo(50)
        ly1 = Colocacion.H().control(lb).control(self.cbThoughtOp).relleno()
        ly2 = Colocacion.H().control(lbArrows).control(self.sbArrows).relleno()
        ly = Colocacion.V().otro(ly1).otro(ly2).relleno()
        gbThoughtOp = Controles.GB(self, _("Thought of the opponent"), ly)
        gbThoughtOp.setStyleSheet(gbStyle)

        self.chbSummary = Controles.CHB(
            self,
            _("Save a summary when the game is finished in the main comment"),
            False)

        lyH1 = Colocacion.H().relleno()
        lyH1.control(lbAyudas).control(self.sbAyudas).relleno()
        lyH1.control(self.cbAtras).relleno()
        lyH1.control(self.cbChance).relleno()
        lyH1.control(btTutorChange).relleno()

        # lyV1 = Colocacion.V().control(gbThoughtOp)

        lyH3 = Colocacion.H().relleno()
        lyH3.control(gbThoughtOp).relleno()
        lyH3.control(gbThoughtTt).relleno()

        ly = Colocacion.V().otro(lyH1).otro(lyH3).control(
            self.chbSummary).margen(16)
        gb = Controles.GB(self, "", ly)
        tab.nuevaTab(gb, _("Help configuration"))

        # TAB Tiempo

        lyG = nuevoG()
        self.edMinutos, self.lbMinutos = QTUtil2.spinBoxLB(
            self, 15, 0, 999, maxTam=50, etiqueta=_("Total minutes"))
        self.edSegundos, self.lbSegundos = QTUtil2.spinBoxLB(
            self,
            6,
            -999,
            999,
            maxTam=54,
            etiqueta=_("Seconds added per move"))
        self.edMinExtra, self.lbMinExtra = QTUtil2.spinBoxLB(
            self,
            0,
            -999,
            999,
            maxTam=70,
            etiqueta=_("Extra minutes for the player"))
        self.edZeitnot, self.lbZeitnot = QTUtil2.spinBoxLB(
            self,
            0,
            -999,
            999,
            maxTam=54,
            etiqueta=_("Zeitnot: alarm sounds when remaining seconds"))
        lyH1 = Colocacion.H()
        lyH1.control(self.lbMinutos).control(self.edMinutos).espacio(30)
        lyH1.control(self.lbSegundos).control(self.edSegundos).relleno()
        lyH2 = Colocacion.H()
        lyH2.control(self.lbMinExtra).control(self.edMinExtra).relleno()
        lyH3 = Colocacion.H()
        lyH3.control(self.lbZeitnot).control(self.edZeitnot).relleno()
        ly = Colocacion.V().otro(lyH1).otro(lyH2).otro(lyH3)
        self.chbTiempo = _label(lyG, _("Time"), ly, siCheck=True)

        gb = Controles.GB(self, "", lyG)
        tab.nuevaTab(gb, _("Time"))

        # TAB Initial moves

        lyG = nuevoG()

        # Posicion
        self.btPosicion = Controles.PB(self, " " * 5 + _("Change") + " " * 5,
                                       self.posicionEditar).ponPlano(False)
        self.fen = ""
        self.btPosicionQuitar = Controles.PB(
            self, "", self.posicionQuitar).ponIcono(Iconos.Motor_No())
        self.btPosicionPegar = Controles.PB(self, "",
                                            self.posicionPegar).ponIcono(
                                                Iconos.Pegar16()).ponToolTip(
                                                    _("Paste FEN position"))
        hbox = Colocacion.H().relleno().control(self.btPosicionQuitar).control(
            self.btPosicion).control(self.btPosicionPegar).relleno()
        _label(lyG, _("Start position"), hbox)

        # Aperturas
        self.btApertura = Controles.PB(self,
                                       " " * 5 + _("Undetermined") + " " * 5,
                                       self.editarApertura).ponPlano(False)
        self.bloqueApertura = None
        self.btAperturasFavoritas = Controles.PB(
            self, "", self.aperturasFavoritas).ponIcono(Iconos.Favoritos())
        self.btAperturasQuitar = Controles.PB(
            self, "", self.aperturasQuitar).ponIcono(Iconos.Motor_No())
        hbox = Colocacion.H().relleno().control(
            self.btAperturasQuitar).control(self.btApertura).control(
                self.btAperturasFavoritas).relleno()
        _label(lyG, _("Opening"), hbox)

        # Libros
        fvar = self.configuracion.ficheroBooks
        self.listaLibros = Books.ListaLibros()
        self.listaLibros.recuperaVar(fvar)
        # Comprobamos que todos esten accesibles
        self.listaLibros.comprueba()
        li = [(x.nombre, x) for x in self.listaLibros.lista]
        libInicial = li[0][1] if li else None
        self.cbBooks = QTUtil2.comboBoxLB(self, li, libInicial)
        self.btNuevoBook = Controles.PB(self, "", self.nuevoBook,
                                        plano=True).ponIcono(Iconos.Mas(),
                                                             tamIcon=16)
        self.chbBookMandatory = Controles.CHB(self, _("Mandatory"), False)
        # Respuesta rival
        li = (
            (_("Selected by the player"), "su"),
            (_("Uniform random"), "au"),
            (_("Proportional random"), "ap"),
            (_("Always the highest percentage"), "mp"),
        )
        self.cbBooksRR = QTUtil2.comboBoxLB(self, li, "mp")
        self.lbBooksRR = Controles.LB2P(self, _("Opponent's move"))
        hbox = Colocacion.H().relleno().control(self.cbBooks).control(
            self.btNuevoBook).control(self.chbBookMandatory).relleno()
        hboxRR = Colocacion.H().relleno().control(self.lbBooksRR).control(
            self.cbBooksRR).relleno()
        hboxV = Colocacion.V().otro(hbox).otro(hboxRR)
        self.chbBook = _label(lyG, _("Book"), hboxV, siCheck=True)

        ly = Colocacion.V().otro(lyG).relleno()

        gb = Controles.GB(self, "", ly)
        tab.nuevaTab(gb, _("Initial moves"))

        layout = Colocacion.V().control(tb).control(tab).relleno().margen(3)

        self.setLayout(layout)

        self.liAperturasFavoritas = []
        self.btAperturasFavoritas.hide()

        dic = Util.recuperaDIC(self.configuracion.ficheroEntMaquina)
        if not dic:
            dic = {}
        self.muestraDic(dic)

        self.ajustesCambiado()
        # self.ayudasCambiado()
        self.ponRival()

        self.recuperarVideo()
Example #19
0
    def __init__(self, wParent, nombre_torneo):

        torneo = self.torneo = Tournament.Tournament(nombre_torneo)

        titulo = nombre_torneo
        icono = Iconos.Torneos()
        extparam = "untorneo_v1"
        QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)

        self.configuracion = Code.configuracion

        # Datos

        self.liEnActual = []
        self.xjugar = None
        self.liResult = None
        self.last_change = Util.today()
        self.li_results = []

        # Toolbar
        tb = Controles.TBrutina(self, tamIcon=24)
        tb.new(_("Close"), Iconos.MainMenu(), self.terminar)
        tb.new(_("Launch a worker"), Iconos.Lanzamiento(), self.gm_launch)

        # Tabs
        self.tab = tab = Controles.Tab()

        # Tab-configuracion --------------------------------------------------
        w = QtWidgets.QWidget()

        # Adjudicator
        lb_resign = Controles.LB(
            self, "%s (%s): " %
            (_("Minimum centipawns to assign winner"), _("0=disable")))
        self.ed_resign = Controles.ED(self).tipoInt(
            torneo.resign()).anchoFijo(30)
        bt_resign = Controles.PB(self, "", rutina=self.borra_resign).ponIcono(
            Iconos.Reciclar())

        # Draw-plys
        lbDrawMinPly = Controles.LB(
            self,
            "%s (%s): " % (_("Minimum moves to assign draw"), _("0=disable")))
        self.sbDrawMinPly = Controles.SB(self, torneo.drawMinPly(), 20, 1000)
        # Draw-puntos
        lb_draw_range = Controles.LB(
            self,
            _("Maximum centipawns to assign draw") + ": ")
        self.ed_draw_range = Controles.ED(self).tipoInt(
            torneo.drawRange()).anchoFijo(30)
        bt_draw_range = Controles.PB(
            self, "", rutina=self.borra_draw_range).ponIcono(Iconos.Reciclar())

        # adjudicator
        self.liMotores = self.configuracion.comboMotoresMultiPV10()
        self.cbJmotor, self.lbJmotor = QTUtil2.comboBoxLB(
            self, self.liMotores, torneo.adjudicator(), _("Engine"))
        self.edJtiempo = Controles.ED(self).tipoFloat().ponFloat(
            1.0).anchoFijo(50).ponFloat(torneo.adjudicator_time())
        self.lbJtiempo = Controles.LB2P(self, _("Time in seconds"))
        layout = Colocacion.G()
        layout.controld(self.lbJmotor, 3, 0).control(self.cbJmotor, 3, 1)
        layout.controld(self.lbJtiempo, 4, 0).control(self.edJtiempo, 4, 1)
        self.gbJ = Controles.GB(self, _("Adjudicator"), layout)
        self.gbJ.setCheckable(True)
        self.gbJ.setChecked(torneo.adjudicator_active())

        lbBook = Controles.LB(self, _("Opening book") + ": ")
        fvar = self.configuracion.ficheroBooks
        self.listaLibros = Books.ListaLibros()
        self.listaLibros.restore_pickle(fvar)
        # Comprobamos que todos esten accesibles
        self.listaLibros.comprueba()
        li = [(x.name, x.path) for x in self.listaLibros.lista]
        li.insert(0, ("* " + _("None"), "-"))
        self.cbBooks = Controles.CB(self, li, torneo.book())
        btNuevoBook = Controles.PB(self, "", self.nuevoBook,
                                   plano=False).ponIcono(Iconos.Nuevo(),
                                                         tamIcon=16)
        lyBook = Colocacion.H().control(
            self.cbBooks).control(btNuevoBook).relleno()

        lbBookDepth = Controles.LB(self,
                                   _("Max depth of book (0=Maximum)") + ": ")
        self.sbBookDepth = Controles.SB(self, torneo.bookDepth(), 0, 200)

        # Posicion inicial
        lbFEN = Controles.LB(self, _("Initial position") + ": ")
        self.fen = torneo.fen()
        self.btPosicion = Controles.PB(self, " " * 5 + _("Change") + " " * 5,
                                       self.posicionEditar).ponPlano(False)
        self.btPosicionQuitar = Controles.PB(
            self, "", self.posicionQuitar).ponIcono(Iconos.Motor_No())
        self.btPosicionPegar = (Controles.PB(self, "",
                                             self.posicionPegar).ponIcono(
                                                 Iconos.Pegar16()).ponToolTip(
                                                     _("Paste FEN position")))
        lyFEN = (Colocacion.H().control(self.btPosicionQuitar).control(
            self.btPosicion).control(self.btPosicionPegar).relleno())

        # Norman Pollock
        lbNorman = Controles.LB(
            self,
            '%s(<a href="https://komodochess.com/pub/40H-pgn-utilities">?</a>): '
            % _("Initial position from Norman Pollock openings database"),
        )
        self.chbNorman = Controles.CHB(self, " ", self.torneo.norman())

        # Layout
        layout = Colocacion.G()
        ly_res = Colocacion.H().control(
            self.ed_resign).control(bt_resign).relleno()
        ly_dra = Colocacion.H().control(
            self.ed_draw_range).control(bt_draw_range).relleno()
        layout.controld(lb_resign, 0, 0).otro(ly_res, 0, 1)
        layout.controld(lbDrawMinPly, 1, 0).control(self.sbDrawMinPly, 1, 1)
        layout.controld(lb_draw_range, 2, 0).otro(ly_dra, 2, 1)
        layout.controld(lbBook, 3, 0).otro(lyBook, 3, 1)
        layout.controld(lbBookDepth, 4, 0).control(self.sbBookDepth, 4, 1)
        layout.controld(lbFEN, 5, 0).otro(lyFEN, 5, 1)
        layout.controld(lbNorman, 6, 0).control(self.chbNorman, 6, 1)
        layoutV = Colocacion.V().relleno().otro(layout).control(
            self.gbJ).relleno()
        layoutH = Colocacion.H().relleno().otro(layoutV).relleno()

        # Creamos
        w.setLayout(layoutH)
        tab.nuevaTab(w, _("Configuration"))

        # Tab-engines --------------------------------------------------
        self.splitterEngines = QtWidgets.QSplitter(self)
        self.register_splitter(self.splitterEngines, "engines")
        # TB
        li_acciones = [
            (_("New"), Iconos.TutorialesCrear(), self.enNuevo),
            None,
            (_("Modify"), Iconos.Modificar(), self.enModificar),
            None,
            (_("Remove"), Iconos.Borrar(), self.enBorrar),
            None,
            (_("Copy"), Iconos.Copiar(), self.enCopiar),
            None,
            (_("Import"), Iconos.MasDoc(), self.enImportar),
            None,
        ]
        tbEnA = Controles.TBrutina(self,
                                   li_acciones,
                                   tamIcon=16,
                                   style=QtCore.Qt.ToolButtonTextBesideIcon)

        # Grid engine
        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("NUM", _("N."), 50, centered=True)
        o_columns.nueva("ALIAS", _("Alias"), 209)
        self.gridEnginesAlias = Grid.Grid(self,
                                          o_columns,
                                          siSelecFilas=True,
                                          siSeleccionMultiple=True,
                                          xid=GRID_ALIAS)
        self.register_grid(self.gridEnginesAlias)

        w = QtWidgets.QWidget()
        ly = Colocacion.V().control(self.gridEnginesAlias).margen(0)
        w.setLayout(ly)
        self.splitterEngines.addWidget(w)

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("CAMPO", _("Label"), 200, siDerecha=True)
        o_columns.nueva("VALOR", _("Value"), 286)
        self.gridEnginesValores = Grid.Grid(self,
                                            o_columns,
                                            siSelecFilas=False,
                                            xid=GRID_VALUES)
        self.register_grid(self.gridEnginesValores)

        w = QtWidgets.QWidget()
        ly = Colocacion.V().control(self.gridEnginesValores).margen(0)
        w.setLayout(ly)
        self.splitterEngines.addWidget(w)

        self.splitterEngines.setSizes([250, 520])  # por defecto

        w = QtWidgets.QWidget()
        ly = Colocacion.V().control(tbEnA).control(self.splitterEngines)
        w.setLayout(ly)
        tab.nuevaTab(w, _("Engines"))

        # Creamos

        # Tab-games queued--------------------------------------------------
        w = QtWidgets.QWidget()
        # TB
        li_acciones = [
            (_("New"), Iconos.TutorialesCrear(), self.gm_crear_queued),
            None,
            (_("Remove"), Iconos.Borrar(), self.gm_borrar_queued),
            None,
        ]
        tbEnG = Controles.TBrutina(self,
                                   li_acciones,
                                   tamIcon=16,
                                   style=QtCore.Qt.ToolButtonTextBesideIcon)

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("NUM", _("N."), 50, centered=True)
        o_columns.nueva("WHITE", _("White"), 190, centered=True)
        o_columns.nueva("BLACK", _("Black"), 190, centered=True)
        o_columns.nueva("TIME", _("Time"), 170, centered=True)
        # o_columns.nueva("STATE", _("State"), 190, centered=True)
        self.gridGamesQueued = Grid.Grid(self,
                                         o_columns,
                                         siSelecFilas=True,
                                         siSeleccionMultiple=True,
                                         xid=GRID_GAMES_QUEUED)
        self.register_grid(self.gridGamesQueued)
        # Layout
        layout = Colocacion.V().control(tbEnG).control(self.gridGamesQueued)

        # Creamos
        w.setLayout(layout)
        tab.nuevaTab(w, _("Games queued"))

        # Tab-games terminados--------------------------------------------------
        w = QtWidgets.QWidget()
        # TB
        li_acciones = [
            (_("Remove"), Iconos.Borrar(), self.gm_borrar_finished),
            None,
            (_("Show"), Iconos.PGN(), self.gm_show_finished),
            None,
            (_("Save") + "(%s)" % _("PGN"), Iconos.GrabarComo(),
             self.gm_save_pgn),
            None,
        ]
        tbEnGt = Controles.TBrutina(self,
                                    li_acciones,
                                    tamIcon=16,
                                    style=QtCore.Qt.ToolButtonTextBesideIcon)

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("NUM", _("N."), 50, centered=True)
        o_columns.nueva("WHITE", _("White"), 190, centered=True)
        o_columns.nueva("BLACK", _("Black"), 190, centered=True)
        o_columns.nueva("TIME", _("Time"), 170, centered=True)
        o_columns.nueva("RESULT", _("Result"), 190, centered=True)
        self.gridGamesFinished = Grid.Grid(self,
                                           o_columns,
                                           siSelecFilas=True,
                                           siSeleccionMultiple=True,
                                           xid=GRID_GAMES_FINISHED)
        self.register_grid(self.gridGamesFinished)
        # Layout
        layout = Colocacion.V().control(tbEnGt).control(self.gridGamesFinished)

        # Creamos
        w.setLayout(layout)
        tab.nuevaTab(w, _("Games finished"))

        # Tab-resultado --------------------------------------------------
        w = QtWidgets.QWidget()

        # Grid
        wh = _("W")
        bl = _("B")
        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("NUM", _("N."), 35, centered=True)
        o_columns.nueva("ENGINE", _("Engine"), 120, centered=True)
        o_columns.nueva("SCORE", _("Score") + "%", 50, centered=True)
        o_columns.nueva("WIN", _("Wins"), 50, centered=True)
        o_columns.nueva("DRAW", _("Draws"), 50, centered=True)
        o_columns.nueva("LOST", _("Losses"), 50, centered=True)
        o_columns.nueva("WIN-WHITE",
                        "%s %s" % (wh, _("Wins")),
                        60,
                        centered=True)
        o_columns.nueva("DRAW-WHITE",
                        "%s %s" % (wh, _("Draws")),
                        60,
                        centered=True)
        o_columns.nueva("LOST-WHITE",
                        "%s %s" % (wh, _("Losses")),
                        60,
                        centered=True)
        o_columns.nueva("WIN-BLACK",
                        "%s %s" % (bl, _("Wins")),
                        60,
                        centered=True)
        o_columns.nueva("DRAW-BLACK",
                        "%s %s" % (bl, _("Draws")),
                        60,
                        centered=True)
        o_columns.nueva("LOST-BLACK",
                        "%s %s" % (bl, _("Losses")),
                        60,
                        centered=True)
        o_columns.nueva("GAMES", _("Games"), 50, centered=True)
        self.gridResults = Grid.Grid(self,
                                     o_columns,
                                     siSelecFilas=True,
                                     xid=GRID_RESULTS)
        self.register_grid(self.gridResults)

        self.qtColor = {
            "WHITE": QTUtil.qtColorRGB(255, 250, 227),
            "BLACK": QTUtil.qtColorRGB(221, 255, 221),
            "SCORE": QTUtil.qtColorRGB(170, 170, 170),
        }

        # Layout
        layout = Colocacion.V().control(self.gridResults)

        # Creamos
        w.setLayout(layout)
        tab.nuevaTab(w, _("Results"))

        # Layout
        # tab.setposition("W")
        layout = Colocacion.V().control(tb).espacio(-3).control(tab).margen(2)
        self.setLayout(layout)

        self.restore_video(siTam=True, anchoDefecto=800, altoDefecto=430)

        self.gridEnginesAlias.gotop()

        self.ed_resign.setFocus()

        self.muestraPosicion()

        QtCore.QTimer.singleShot(5000, self.comprueba_cambios)
        self.rotulos_tabs()
Example #20
0
    def __init__(self, procesador, titulo, save_at_end):

        QTVarios.WDialogo.__init__(self, procesador.main_window, titulo, Iconos.Libre(), "entMaquina")

        font = Controles.TipoLetra(puntos=procesador.configuracion.x_menu_points)

        self.save_at_end = save_at_end

        self.setFont(font)

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

        self.personalidades = Personalidades.Personalidades(self, self.configuracion)

        self.motores = SelectEngines.SelectEngines(self.configuracion)

        # Toolbar
        li_acciones = [
            (_("Accept"), Iconos.Aceptar(), self.aceptar),
            None,
            (_("Cancel"), Iconos.Cancelar(), self.cancelar),
            None,
            (_("Configurations"), Iconos.Configurar(), self.configuraciones),
            None,
        ]
        tb = QTVarios.LCTB(self, li_acciones)

        # Tab
        tab = Controles.Tab()
        tab.dispatchChange(self.cambiada_tab)

        self.tab_advanced = 4  # está en la posición 4
        self.tab_advanced_active = (
            False
        )  # Para no tener que leer las opciones uci to_sq que no sean necesarias, afecta a gridNumDatos

        def nueva_tab(layout, titulo):
            ly = Colocacion.V()
            ly.otro(layout)
            ly.relleno()
            w = QtWidgets.QWidget(self)
            w.setLayout(ly)
            w.setFont(font)
            tab.nuevaTab(w, titulo)

        def nuevoG():
            ly_g = Colocacion.G()
            ly_g.filaActual = 0
            ly_g.setMargin(10)
            return ly_g

        gbStyle = """
            QGroupBox {
                font: bold 16px;
                background-color: #F2F2EC;/*qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);*/
                border: 1px solid gray;
                border-radius: 3px;
                padding: 18px;
                margin-top: 5ex; /* leave space at the top for the title */
            }
            QGroupBox::title {
                subcontrol-origin: margin;
                subcontrol-position: top left; /* position at the top center */
                padding: 8px;
                border: 1px solid gray;
             }
        """

        def _label(ly_g, txt, xlayout, rutinaCHB=None, siCheck: object = False):
            groupbox = Controles.GB(self, txt, xlayout)
            if rutinaCHB:
                groupbox.conectar(rutinaCHB)
            elif siCheck:
                groupbox.setCheckable(True)
                groupbox.setChecked(False)

            groupbox.setStyleSheet(gbStyle)
            groupbox.setMinimumWidth(640)
            groupbox.setFont(font)
            ly_g.controlc(groupbox, ly_g.filaActual, 0)
            ly_g.filaActual += 1
            return groupbox

        # ##################################################################################################################################
        # TAB General
        # ##################################################################################################################################

        lyG = nuevoG()

        # # Motores

        # ## Rival
        self.rival = self.procesador.XTutor().confMotor
        self.rivalTipo = SelectEngines.INTERNO
        self.btRival = Controles.PB(self, "", self.cambiaRival, plano=False).ponFuente(font).altoFijo(48)

        lbTiempoSegundosR = Controles.LB2P(self, _("Fixed time in seconds")).ponFuente(font)
        self.edRtiempo = (
            Controles.ED(self).tipoFloat().anchoMaximo(50).ponFuente(font).capturaCambiado(self.cambiadoTiempo)
        )
        bt_cancelar_tiempo = Controles.PB(self, "", rutina=self.cancelar_tiempo).ponIcono(Iconos.S_Cancelar())
        ly_tiempo = Colocacion.H().control(self.edRtiempo).control(bt_cancelar_tiempo).relleno(1)

        lb_depth = Controles.LB2P(self, _("Fixed depth")).ponFuente(font)
        self.edRdepth = Controles.ED(self).tipoInt().anchoMaximo(50).ponFuente(font).capturaCambiado(self.cambiadoDepth)
        bt_cancelar_depth = Controles.PB(self, "", rutina=self.cancelar_depth).ponIcono(Iconos.S_Cancelar())
        ly_depth = Colocacion.H().control(self.edRdepth).control(bt_cancelar_depth).relleno(1)

        ly = Colocacion.G()
        ly.controld(lbTiempoSegundosR, 0, 0).otro(ly_tiempo, 0, 1)
        ly.controld(lb_depth, 1, 0).otro(ly_depth, 1, 1)
        self.gb_thinks = Controles.GB(self, _("Limits of engine thinking"), ly)
        self.gb_thinks.setStyleSheet(
            """
            QGroupBox {
                font: bold %d;
                background-color: #F2F2EC;/*qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);*/
                border: 1px solid gray;
                border-radius: 3px;
                padding: 18px;
                margin-top: 5ex; /* leave space at the top for the title */
            }
            QGroupBox::title {
                subcontrol-position: top center; /* position at the top center */
                padding: 8px;
                border: 1px solid gray;
             }
        """
            % procesador.configuracion.x_menu_points
        )
        lyV = Colocacion.V().espacio(20).control(self.btRival).espacio(20).control(self.gb_thinks)

        _label(lyG, _("Opponent"), lyV)

        # # Color
        self.rbBlancas = Controles.RB(self, "").activa()
        self.rbBlancas.setIcon(Iconos.PeonBlanco())
        self.rbBlancas.setIconSize(QtCore.QSize(32, 32))
        self.rbNegras = Controles.RB(self, "")
        self.rbNegras.setIcon(Iconos.PeonNegro())
        self.rbNegras.setIconSize(QtCore.QSize(32, 32))
        self.rbRandom = Controles.RB(self, _("Random"))
        self.rbRandom.setFont(Controles.TipoLetra(puntos=16))
        hbox = (
            Colocacion.H()
            .relleno()
            .control(self.rbBlancas)
            .espacio(30)
            .control(self.rbNegras)
            .espacio(30)
            .control(self.rbRandom)
            .relleno()
        )
        _label(lyG, _("Side you play with"), hbox)

        nueva_tab(lyG, _("Basic configuration"))

        # ##################################################################################################################################
        # TAB Ayudas
        # ##################################################################################################################################
        self.chbSummary = Controles.CHB(
            self, _("Save a summary when the game is finished in the main comment"), False
        ).ponFuente(font)

        self.chbTakeback = Controles.CHB(
            self, _("Option takeback activated"), True
        ).ponFuente(font)

        # # Tutor
        lbAyudas = Controles.LB2P(self, _("Available hints")).ponFuente(font)
        liAyudas = [(_("Maximum"), 999)]
        for i in range(1, 21):
            liAyudas.append((str(i), i))
        for i in range(25, 51, 5):
            liAyudas.append((str(i), i))
        self.cbAyudas = Controles.CB(self, liAyudas, 999).ponFuente(font)
        self.chbChance = Controles.CHB(self, _("Second chance"), True).ponFuente(font)
        btTutorChange = (
            Controles.PB(self, _("Tutor change"), self.tutorChange, plano=False)
            .ponIcono(Iconos.Tutor(), tamIcon=16)
            .ponFuente(font)
        )

        liThinks = [(_("Nothing"), -1), (_("Score"), 0)]
        for i in range(1, 5):
            liThinks.append(("%d %s" % (i, _("ply") if i == 1 else _("plies")), i))
        liThinks.append((_("All"), 9999))
        lbThoughtTt = Controles.LB(self, _("It is showed") + ":").ponFuente(font)
        self.cbThoughtTt = Controles.CB(self, liThinks, -1).ponFuente(font)

        self.chbContinueTt = Controles.CHB(self, _("The tutor thinks while you think"), True).ponFuente(font)

        lbBoxHeight = Controles.LB2P(self, _("Box height")).ponFuente(font)
        self.sbBoxHeight = Controles.SB(self, 7, 0, 999).tamMaximo(50).ponFuente(font)

        lbArrows = Controles.LB2P(self, _("Arrows with the best moves")).ponFuente(font)
        self.sbArrowsTt = Controles.SB(self, 3, 0, 999).tamMaximo(50).ponFuente(font)

        lyT1 = Colocacion.H().control(lbAyudas).control(self.cbAyudas).relleno()
        lyT1.control(self.chbChance).relleno().control(btTutorChange)
        lyT2 = Colocacion.H().control(self.chbContinueTt).relleno()
        lyT2.control(lbBoxHeight).control(self.sbBoxHeight).relleno()
        lyT3 = Colocacion.H().control(lbThoughtTt).control(self.cbThoughtTt).relleno()
        lyT3.control(lbArrows).control(self.sbArrowsTt)

        ly = Colocacion.V().otro(lyT1).espacio(16).otro(lyT2).otro(lyT3).relleno()

        self.gbTutor = Controles.GB(self, _("Activate the tutor's help"), ly)
        self.gbTutor.setCheckable(True)
        self.gbTutor.setStyleSheet(gbStyle)

        lb = Controles.LB(self, _("It is showed") + ":").ponFuente(font)
        self.cbThoughtOp = Controles.CB(self, liThinks, -1).ponFuente(font)
        lbArrows = Controles.LB2P(self, _("Arrows to show")).ponFuente(font)
        self.sbArrows = Controles.SB(self, 7, 0, 999).tamMaximo(50).ponFuente(font)
        ly = Colocacion.H().control(lb).control(self.cbThoughtOp).relleno()
        ly.control(lbArrows).control(self.sbArrows).relleno()
        gbThoughtOp = Controles.GB(self, _("Opponent's thought information"), ly)
        gbThoughtOp.setStyleSheet(gbStyle)

        ly = Colocacion.V().espacio(16).control(self.gbTutor).control(gbThoughtOp)
        ly.espacio(16).control(self.chbSummary).control(self.chbTakeback).margen(6)

        nueva_tab(ly, _("Help configuration"))

        # ##################################################################################################################################
        # TAB Tiempo
        # ##################################################################################################################################
        lyG = nuevoG()

        self.lbMinutos = Controles.LB(self, _("Total minutes") + ":").ponFuente(font)
        self.edMinutos = Controles.ED(self).tipoFloat(10.0).ponFuente(font).anchoFijo(50)
        self.edSegundos, self.lbSegundos = QTUtil2.spinBoxLB(
            self, 6, -999, 999, maxTam=54, etiqueta=_("Seconds added per move"), fuente=font
        )
        self.edMinExtra, self.lbMinExtra = QTUtil2.spinBoxLB(
            self, 0, -999, 999, maxTam=70, etiqueta=_("Extra minutes for the player"), fuente=font
        )
        self.edZeitnot, self.lbZeitnot = QTUtil2.spinBoxLB(
            self, 0, -999, 999, maxTam=54, etiqueta=_("Zeitnot: alarm sounds when remaining seconds"), fuente=font
        )
        lyH = Colocacion.H()
        lyH.control(self.lbMinutos).control(self.edMinutos).espacio(30)
        lyH.control(self.lbSegundos).control(self.edSegundos).relleno()
        lyH2 = Colocacion.H()
        lyH2.control(self.lbMinExtra).control(self.edMinExtra).relleno()
        lyH3 = Colocacion.H()
        lyH3.control(self.lbZeitnot).control(self.edZeitnot).relleno()
        ly = Colocacion.V().otro(lyH).otro(lyH2).otro(lyH3)
        self.chbTiempo = _label(lyG, _("Activate the time control"), ly, siCheck=True)

        nueva_tab(lyG, _("Time"))

        # ##################################################################################################################################
        # TAB Initial moves
        # ##################################################################################################################################
        lyG = nuevoG()

        # Posicion
        self.btPosicion = (
            Controles.PB(self, " " * 5 + _("Change") + " " * 5, self.posicionEditar).ponPlano(False).ponFuente(font)
        )
        self.fen = ""
        self.btPosicionQuitar = Controles.PB(self, "", self.posicionQuitar).ponIcono(Iconos.Motor_No()).ponFuente(font)
        self.btPosicionPegar = (
            Controles.PB(self, "", self.posicionPegar).ponIcono(Iconos.Pegar16()).ponToolTip(_("Paste FEN position"))
        ).ponFuente(font)
        hbox = (
            Colocacion.H()
            .relleno()
            .control(self.btPosicionQuitar)
            .control(self.btPosicion)
            .control(self.btPosicionPegar)
            .relleno()
        )
        _label(lyG, _("Start position"), hbox)

        # Aperturas
        self.btApertura = (
            Controles.PB(self, " " * 5 + _("Undetermined") + " " * 5, self.editarApertura)
            .ponPlano(False)
            .ponFuente(font)
        )
        self.bloqueApertura = None
        self.btAperturasFavoritas = Controles.PB(self, "", self.aperturasFavoritas).ponIcono(Iconos.Favoritos())
        self.btAperturasQuitar = Controles.PB(self, "", self.aperturasQuitar).ponIcono(Iconos.Motor_No())
        hbox = (
            Colocacion.H()
            .relleno()
            .control(self.btAperturasQuitar)
            .control(self.btApertura)
            .control(self.btAperturasFavoritas)
            .relleno()
        )
        _label(lyG, _("Opening"), hbox)

        # Libros
        fvar = self.configuracion.ficheroBooks
        self.listaLibros = Books.ListaLibros()
        self.listaLibros.restore_pickle(fvar)
        self.listaLibros.comprueba()

        li_books = [(x.name, x) for x in self.listaLibros.lista]
        libInicial = li_books[0][1] if li_books else None

        li_resp_book = [
            (_("Selected by the player"), "su"),
            (_("Uniform random"), "au"),
            (_("Proportional random"), "ap"),
            (_("Always the highest percentage"), "mp"),
        ]

        ## Rival
        self.cbBooksR = QTUtil2.comboBoxLB(self, li_books, libInicial).ponFuente(font)
        self.btNuevoBookR = Controles.PB(self, "", self.nuevoBook, plano=True).ponIcono(Iconos.Mas(), tamIcon=16)
        self.cbBooksRR = QTUtil2.comboBoxLB(self, li_resp_book, "mp").ponFuente(font)
        self.lbDepthBookR = Controles.LB2P(self, _("Max depth")).ponFuente(font)
        self.edDepthBookR = Controles.ED(self).ponFuente(font).tipoInt(0).anchoFijo(30)

        hbox = (
            Colocacion.H()
            .control(self.cbBooksR)
            .control(self.btNuevoBookR)
            .relleno()
            .control(self.cbBooksRR)
            .relleno()
            .control(self.lbDepthBookR)
            .control(self.edDepthBookR)
        )
        self.chbBookR = _label(lyG, "%s: %s" % (_("Activate book"), _("Opponent")), hbox, siCheck=True)

        ## Player
        self.cbBooksP = QTUtil2.comboBoxLB(self, li_books, libInicial).ponFuente(font)
        self.btNuevoBookP = Controles.PB(self, "", self.nuevoBook, plano=True).ponIcono(Iconos.Mas(), tamIcon=16)
        self.lbDepthBookP = Controles.LB2P(self, _("Max depth")).ponFuente(font)
        self.edDepthBookP = Controles.ED(self).ponFuente(font).tipoInt(0).anchoFijo(30)
        hbox = (
            Colocacion.H()
            .control(self.cbBooksP)
            .control(self.btNuevoBookP)
            .relleno()
            .control(self.lbDepthBookP)
            .control(self.edDepthBookP)
        )
        self.chbBookP = _label(
            lyG, "%s: %s" % (_("Activate book"), self.configuracion.nom_player()), hbox, siCheck=True
        )

        nueva_tab(lyG, _("Initial moves"))

        # ##################################################################################################################################
        # TAB avanzada
        # ##################################################################################################################################
        lyG = nuevoG()

        liAjustes = self.personalidades.listaAjustes(True)
        self.cbAjustarRival = (
            Controles.CB(self, liAjustes, ADJUST_BETTER).capturaCambiado(self.ajustesCambiado).ponFuente(font)
        )
        lbAjustarRival = Controles.LB2P(self, _("Set strength")).ponFuente(font)
        self.btAjustarRival = (
            Controles.PB(self, _("Personality"), self.cambiaPersonalidades, plano=True)
            .ponIcono(Iconos.Mas(), tamIcon=16)
            .ponFuente(font)
        )

        # ## Resign
        lbResign = Controles.LB2P(self, _("Resign/draw by engine")).ponFuente(font)
        liResign = (
            (_("Very early"), -100),
            (_("Early"), -300),
            (_("Average"), -500),
            (_("Late"), -800),
            (_("Very late"), -1000),
            (_("Never"), -9999999),
        )
        self.cbResign = Controles.CB(self, liResign, -800).ponFuente(font)

        self.lb_path_engine = Controles.LB(self, "").ponWrap()

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("OPTION", _("UCI option"), 240, centered=True)
        o_columns.nueva("VALUE", _("Value"), 200, centered=True, edicion=Delegados.MultiEditor(self))
        self.grid_uci = Grid.Grid(self, o_columns, siEditable=True)
        self.grid_uci.ponFuente(font)
        self.register_grid(self.grid_uci)

        lyH2 = (
            Colocacion.H().control(lbAjustarRival).control(self.cbAjustarRival).control(self.btAjustarRival).relleno()
        )
        lyH3 = Colocacion.H().control(lbResign).control(self.cbResign).relleno()
        ly = Colocacion.V().otro(lyH2).otro(lyH3).espacio(16).control(self.lb_path_engine).control(self.grid_uci)
        _label(lyG, _("Opponent"), ly)

        nueva_tab(lyG, _("Advanced"))

        layout = Colocacion.V().control(tb).control(tab).relleno().margen(3)

        self.setLayout(layout)

        self.liAperturasFavoritas = []
        self.btAperturasFavoritas.hide()

        dic = Util.restore_pickle(self.configuracion.ficheroEntMaquina)
        if not dic:
            dic = {}
        self.restore_dic(dic)

        self.ajustesCambiado()
        # self.ayudasCambiado()
        self.ponRival()

        self.restore_video()
Example #21
0
    def __init__(self, wowner, gestor, alm, muestraAnalisis):
        titulo = _("Result of analysis")
        icono = Iconos.Estadisticas()
        extparam = "estadisticas"
        QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam)

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

        tabGen = Controles.Tab()

        w = QtGui.QWidget()

        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)
            return oColumnas

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

        lbIndexes = Controles.LB(self, alm.indexesHTML)
        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(lbIndexes).otro(ly0).relleno()
        wIdx = QtGui.QWidget()
        wIdx.setLayout(ly)

        tabGrid = Controles.Tab().ponPosicion("W")
        tabGrid.nuevaTab(gridAll, _("All moves"))
        tabGrid.nuevaTab(gridW, _("White"))
        tabGrid.nuevaTab(gridB, _("Black"))
        tabGrid.nuevaTab(wIdx, _("Indexes"))

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

        layout = Colocacion.H().control(tabGrid).control(
            self.tablero).margen(0)
        w.setLayout(layout)
        tabGen.nuevaTab(w, _("Data"))

        tabGraph = Controles.Tab().ponPosicion("W")
        tabGen.nuevaTab(tabGraph, _("Graphics"))

        tab = Controles.Tab()
        tab.nuevaTab(alm.game, _("Total"))
        tab.nuevaTab(alm.gameDif, _("Lost points"))
        tabGraph.nuevaTab(tab, _("All moves"))

        tab = Controles.Tab()
        tab.nuevaTab(alm.white, _("Total"))
        tab.nuevaTab(alm.whiteDif, _("Lost points"))
        tabGraph.nuevaTab(tab, _("White"))

        tab = Controles.Tab()
        tab.nuevaTab(alm.black, _("Total"))
        tab.nuevaTab(alm.blackDif, _("Lost points"))
        tabGraph.nuevaTab(tab, _("Black"))

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

        self.recuperarVideo(siTam=True, anchoDefecto=960, altoDefecto=600)

        gridAll.gotop()
        gridB.gotop()
        gridW.gotop()
        self.gridBotonIzquierdo(gridAll, 0, None)