Esempio n. 1
0
 def acercade(self):
     w = Info.WAbout(self)
     w.exec_()
Esempio n. 2
0
def dameCategoria(wParent, configuracion, procesador):
    rival = configuracion.rival

    menu = QTVarios.LCMenu(wParent)

    menu.opcion(
        None,
        "%s: %d %s" % (_("Total score"), configuracion.puntuacion(), _("pts")),
        Iconos.NuevaPartida())
    menu.separador()
    menu.opcion(None,
                "%s: %s" % (_("Opponent"), rival.rotuloPuntos()),
                Iconos.Motor(),
                siDeshabilitado=False)
    menu.separador()

    # ---------- CATEGORIAS
    ant = 1
    for x in range(6):
        cat = rival.categorias.numero(x)
        txt = cat.nombre()
        nm = cat.nivelHecho

        nh = cat.hecho

        if nm > 0:
            txt += " %s %d" % (_("Level"), nm)
        if nh:
            if "B" in nh:
                txt += " +%s:%d" % (_("White"), nm + 1)
            if "N" in nh:
                txt += " +%s:%d" % (_("Black"), nm + 1)

                # if "B" not in nh:
                # txt += "  ...  %s:%d"%( _( "White" )[0],nm+1)
                # elif "N" not in nh:
                # txt += "  ...  %s:%d"%( _( "Black" )[0],nm+1)
                # else:
                # txt += "  ...  %s:%d"%( _( "White" )[0],nm+1)

        siDesHabilitado = (ant == 0)
        ant = nm
        menu.opcion(str(x), txt, cat.icono(), siDeshabilitado=siDesHabilitado)

    # ----------- RIVAL
    menu.separador()
    menuRival = menu.submenu(_("Change opponent"))

    puntuacion = configuracion.puntuacion()

    icoNo = Iconos.Motor_No()
    icoSi = Iconos.Motor_Si()
    icoActual = Iconos.Motor_Actual()
    grpNo = Iconos.Grupo_No()
    grpSi = Iconos.Grupo_Si()

    for grupo in configuracion.grupos.liGrupos:
        nombre = _X(_("%1 group"), grupo.nombre)
        if grupo.minPuntos > 0:
            nombre += " (+%d %s)" % (grupo.minPuntos, _("pts"))

        siDes = (grupo.minPuntos > puntuacion)
        if siDes:
            icoG = grpNo
            icoM = icoNo
        else:
            icoG = grpSi
            icoM = icoSi
        submenu = menuRival.submenu(nombre, icoG)

        for rv in grupo.liRivales:
            siActual = rv.clave == rival.clave
            ico = icoActual if siActual else icoM
            submenu.opcion("MT_" + rv.clave, rv.rotuloPuntos(), ico, siDes
                           or siActual)
        menuRival.separador()

    # ----------- RIVAL
    menu.separador()
    menu.opcion("ayuda", _("Help"), Iconos.Ayuda())

    cursor = QtGui.QCursor.pos()
    resp = menu.lanza()
    if resp is None:
        return None
    elif resp == "ayuda":
        titulo = _("Competition")
        ancho, alto = QTUtil.tamEscritorio()
        ancho = min(ancho, 700)
        txt = _(
            "<br><b>The aim is to obtain the highest possible score</b> :<ul><li>The current point score is displayed in the title bar.</li><li>To obtain points it is necessary to win on different levels in different categories.</li><li>To overcome a level it is necessary to win against the engine with white and with black.</li><li>The categories are ranked in the order of the following table:</li><ul><li><b>Beginner</b> : 5</li><li><b>Amateur</b> : 10</li><li><b>Master candidate</b> : 20</li><li><b>Master</b> : 40</li><li><b>Grandmaster candidate</b> : 80</li><li><b>Grandmaster</b> : 160</li></ul><li>The score for each game is calculated by multiplying the playing level with the score of the category.</li><li>The engines are divided into groups.</li><li>To be able to play with an opponent of a particular group a minimum point score is required. The required score is shown next to the group label.</li></ul>"
        )
        Info.info(wParent, _("Lucas Chess"), titulo, txt, ancho,
                  Iconos.pmAyudaGR())
        return None

    elif resp.startswith("MT_"):
        procesador.cambiaRival(resp[3:])
        QtGui.QCursor.setPos(cursor)
        procesador.competicion()
        return None
    else:
        categoria = rival.categorias.numero(int(resp))
        return categoria
Esempio n. 3
0
def dameCategoria(wParent, configuracion, procesador):
    rival = configuracion.rival

    menu = QTVarios.LCMenu(wParent)

    menu.opcion(None, "%s: %d %s" % (_("Total score"), configuracion.puntuacion(), _("pts")), Iconos.NuevaPartida())
    menu.separador()
    menu.opcion(None, "%s: %s" % (_("Opponent"), rival.rotuloPuntos()), Iconos.Motor(), siDeshabilitado=False)
    menu.separador()

    # ---------- CATEGORIAS
    ant = 1
    for x in range(6):
        cat = rival.categorias.numero(x)
        txt = cat.nombre()
        nm = cat.nivelHecho

        nh = cat.hecho

        if nm > 0:
            txt += " %s %d" % (_("Level"), nm)
        if nh:
            if "B" in nh:
                txt += " +%s:%d" % ( _("White"), nm + 1)
            if "N" in nh:
                txt += " +%s:%d" % ( _("Black"), nm + 1)

                # if "B" not in nh:
                # txt += "  ...  %s:%d"%( _( "White" )[0],nm+1)
                # elif "N" not in nh:
                # txt += "  ...  %s:%d"%( _( "Black" )[0],nm+1)
                # else:
                # txt += "  ...  %s:%d"%( _( "White" )[0],nm+1)

        siDesHabilitado = (ant == 0)
        ant = nm
        menu.opcion(str(x), txt, cat.icono(), siDeshabilitado=siDesHabilitado)

    # ----------- RIVAL
    menu.separador()
    menuRival = menu.submenu(_("Change opponent"))

    puntuacion = configuracion.puntuacion()

    icoNo = Iconos.Motor_No()
    icoSi = Iconos.Motor_Si()
    icoActual = Iconos.Motor_Actual()
    grpNo = Iconos.Grupo_No()
    grpSi = Iconos.Grupo_Si()

    for grupo in configuracion.grupos.liGrupos:
        nombre = _X(_("%1 group"), grupo.nombre)
        if grupo.minPuntos > 0:
            nombre += " (+%d %s)" % (grupo.minPuntos, _("pts") )

        siDes = (grupo.minPuntos > puntuacion)
        if siDes:
            icoG = grpNo
            icoM = icoNo
        else:
            icoG = grpSi
            icoM = icoSi
        submenu = menuRival.submenu(nombre, icoG)

        for rv in grupo.liRivales:
            siActual = rv.clave == rival.clave
            ico = icoActual if siActual else icoM
            submenu.opcion("MT_" + rv.clave, rv.rotuloPuntos(), ico, siDes or siActual)
        menuRival.separador()

    # ----------- RIVAL
    menu.separador()
    menu.opcion("ayuda", _("Help"), Iconos.Ayuda())

    cursor = QtGui.QCursor.pos()
    resp = menu.lanza()
    if resp is None:
        return None
    elif resp == "ayuda":
        titulo = _("Competition")
        ancho, alto = QTUtil.tamEscritorio()
        ancho = min(ancho, 700)
        txt = _("<br><b>The aim is to obtain the highest possible score</b> :<ul><li>The current point score is displayed in the title bar.</li><li>To obtain points it is necessary to win on different levels in different categories.</li><li>To overcome a level it is necessary to win against the engine with white and with black.</li><li>The categories are ranked in the order of the following table:</li><ul><li><b>Beginner</b> : 5</li><li><b>Amateur</b> : 10</li><li><b>Master candidate</b> : 20</li><li><b>Master</b> : 40</li><li><b>Grandmaster candidate</b> : 80</li><li><b>Grandmaster</b> : 160</li></ul><li>The score for each game is calculated by multiplying the playing level with the score of the category.</li><li>The engines are divided into groups.</li><li>To be able to play with an opponent of a particular group a minimum point score is required. The required score is shown next to the group label.</li></ul>")
        Info.info(wParent, _("Lucas Chess"), titulo, txt, ancho, Iconos.pmAyudaGR())
        return None

    elif resp.startswith("MT_"):
        procesador.cambiaRival(resp[3:])
        QtGui.QCursor.setPos(cursor)
        procesador.competicion()
        return None
    else:
        categoria = rival.categorias.numero(int(resp))
        return categoria