Exemplo n.º 1
0
def menuInformacion(procesador):
    liBlog = (
        ("Tactical training with your own blunders",
         "http://lucaschess.blogspot.com.es/2011/11/tactical-training-with-your-own.html"
         ),
        ("Announcements sounds",
         "http://lucaschess.blogspot.com.es/2011/10/announcements-sounds.html"
         ),
        ("Personalities in Game against an engine of your choice",
         "http://lucaschess.blogspot.com.es/2011/09/version-60-beta-1-personalities.html"
         ),
        ("Training favourites and Your daily test",
         "http://lucaschess.blogspot.com.es/2011/09/version-60-dev4-with-favourites-and.html"
         ),
        ("Captured material panel",
         "http://lucaschess.blogspot.com.es/2011/06/version-53-captures-and-more.html"
         ),
        ("Learn openings by repetition",
         "http://lucaschess.blogspot.com.es/2011/06/version-52-standard-openings.html"
         ),
        ("Kibitzers",
         "http://lucaschess.blogspot.com.es/2011/06/version-51-with-kibitzers.html"
         ),
        ("Training mate positions",
         "http://lucaschess.blogspot.com.es/2011/03/new-option-training-mate-positions.html"
         ),
    )

    menu = QTVarios.LCMenu(procesador.pantalla)

    menu.opcion("docs", _("Documents"), Iconos.Ayuda())
    menu.separador()
    menu.opcion("web", _("Homepage"), Iconos.Web())
    menu.separador()
    menu1 = menu.submenu("Fresh news", Iconos.Blog())
    menu1.opcion("blog", "Fresh news", Iconos.Blog())
    menu1.separador()
    for txt, lnk in liBlog:
        menu1.opcion(lnk, txt, Iconos.PuntoAzul())
    menu.separador()
    menu.opcion("mail",
                _("Contact") + " (%s)" % "*****@*****.**", Iconos.Mail())
    menu.separador()
    submenu = menu.submenu(_("Scores"), Iconos.EstrellaAzul())  # EXE
    submenu.opcion("puntuacionPost", _("Post your score"),
                   Iconos.Puntuacion())  # EXE
    submenu.opcion("puntuacionConsulta", _("Check your scores in time"),
                   Iconos.EstrellaAzul())  # EXE
    menu.separador()  # EXE
    if procesador.configuracion.siMain:  # EXE
        menu.opcion("actualiza", _("Search for updates"),
                    Iconos.Actualiza())  # EXE
        menu.separador()  # EXE

    menu.opcion("acercade", _("About"), Iconos.Aplicacion())

    return menu.lanza()
Exemplo n.º 2
0
    def informacion(self):
        liBlog = (
            ("Tactical training with your own blunders",
             "http://lucaschess.blogspot.com.es/2011/11/tactical-training-with-your-own.html"),
            ("Announcements sounds", "http://lucaschess.blogspot.com.es/2011/10/announcements-sounds.html"),
            ("Personalities in Game against an engine of your choice",
             "http://lucaschess.blogspot.com.es/2011/09/version-60-beta-1-personalities.html"),
            ("Training favourites and Your daily test",
             "http://lucaschess.blogspot.com.es/2011/09/version-60-dev4-with-favourites-and.html"),
            (
                "Captured material panel",
                "http://lucaschess.blogspot.com.es/2011/06/version-53-captures-and-more.html"),
            ("Learn openings by repetition",
             "http://lucaschess.blogspot.com.es/2011/06/version-52-standard-openings.html"),
            ("Kibitzers", "http://lucaschess.blogspot.com.es/2011/06/version-51-with-kibitzers.html"),
            ("Training mate positions",
             "http://lucaschess.blogspot.com.es/2011/03/new-option-training-mate-positions.html"),
        )

        menu = QTVarios.LCMenu(self.pantalla)

        menu.opcion("docs", _("Documents"), Iconos.Ayuda())
        menu.separador()
        menu.opcion("web", _("Homepage"), Iconos.Web())
        menu.separador()
        menu1 = menu.submenu("Fresh news", Iconos.Blog())
        menu1.opcion("blog", "Fresh news", Iconos.Blog())
        menu1.separador()
        for txt, lnk in liBlog:
            menu1.opcion(lnk, txt, Iconos.PuntoAzul())
        menu.separador()
        menu.opcion("mail", _("Contact") + " (%s)" % "*****@*****.**", Iconos.Mail())
        menu.separador()

        menu.opcion("acercade", _("About"), Iconos.Aplicacion())

        resp = menu.lanza()
        if resp is None:
            return
        elif resp == "acercade":
            self.acercade()
        elif resp == "docs":
            webbrowser.open("%s/docs" % self.web)
        elif resp == "blog":
            webbrowser.open(self.blog)
        elif resp.startswith("http"):
            webbrowser.open(resp)
        elif resp == "web":
            webbrowser.open("%s/index?lang=%s" % (self.web, self.configuracion.traductor))
        elif resp == "mail":
            webbrowser.open("mailto:[email protected]")
Exemplo n.º 3
0
def menuInformacion(procesador):
    menu = QTVarios.LCMenu(procesador.main_window)

    menu.opcion("docs", _("Documents"), Iconos.Ayuda())
    menu.separador()
    menu.opcion("web", _("Homepage"), Iconos.Web())
    menu.separador()
    menu.opcion("blog", "Fresh news", Iconos.Blog())
    menu.separador()
    menu.opcion("mail", _("Contact") + " (%s)" % "*****@*****.**", Iconos.Mail())
    menu.separador()
    if procesador.configuration.is_main:
        menu.opcion("actualiza", _("Check for updates"), Iconos.Actualiza())
        menu.separador()

    menu.opcion("acercade", _("About"), Iconos.Aplicacion64())

    return menu.lanza()
Exemplo n.º 4
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
Exemplo n.º 5
0
def dameCategoria(w_parent, configuration, procesador):
    dbm = CompetitionWithTutor.DBManagerCWT()
    rival_key = dbm.get_current_rival_key()
    li_grupos = dbm.grupos.liGrupos

    categorias = dbm.get_categorias_rival(rival_key)

    rival = configuration.buscaRival(rival_key)

    menu = QTVarios.LCMenu(w_parent)

    menu.opcion(None,
                "%s: %d %s" % (_("Total score"), dbm.puntuacion(), _("pts")),
                Iconos.NuevaPartida())
    menu.separador()
    menu.opcion(None,
                "%s: %s [%d %s]" %
                (_("Opponent"), rival.name, categorias.puntuacion(), _("pts")),
                Iconos.Motor(),
                is_disabled=False)
    menu.separador()

    # ---------- CATEGORIAS
    ant = 1
    for x in range(6):
        cat = categorias.number(x)
        txt = cat.name()
        nm = cat.level_done

        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 not ("B" in nh):
                # txt += "  ...  %s:%d"%( _( "White" )[0],nm+1)
                # elif not("N" in nh):
                # txt += "  ...  %s:%d"%( _( "Black" )[0],nm+1)
                # else:
                # txt += "  ...  %s:%d"%( _( "White" )[0],nm+1)

        siset_disabled = ant == 0
        ant = nm
        menu.opcion(str(x), txt, cat.icono(), is_disabled=siset_disabled)

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

    puntuacion = categorias.puntuacion()

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

    for grupo in li_grupos:
        name = _X(_("%1 group"), grupo.name)
        if grupo.minPuntos > 0:
            name += " (+%d %s)" % (grupo.minPuntos, _("pts"))

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

        for rv in grupo.li_rivales:
            siActual = rv.key == rival.key
            ico = icoActual if siActual else icoM
            submenu.opcion(
                "MT_" + rv.key, "%s: [%d %s]" %
                (rv.name, dbm.get_puntos_rival(rv.key), _("pts")), 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>Candidate Master</b> : 20</li><li><b>Master</b> : 40</li><li><b>International Master</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>"
        )
        About.info(w_parent, Code.lucas_chess, titulo, txt, ancho,
                   Iconos.pmAyudaGR())
        return None

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