示例#1
0
    def recuperarVideo(self,
                       siTam=True,
                       anchoDefecto=None,
                       altoDefecto=None,
                       dicDef=None):
        dic = self.recuperarDicVideo()
        if not dic:
            dic = dicDef
        wE, hE = QTUtil.tamEscritorio()
        if dic:
            wE, hE = QTUtil.tamEscritorio()
            if "_POSICION_" in dic:
                x, y = dic["_POSICION_"].split(",")
                x = int(x)
                y = int(y)
                if not (0 <= x <= (wE - 50)):
                    x = 0
                if not (0 <= y <= (hE - 50)):
                    y = 0
                self.move(x, y)
            for grid in self.liGrids:
                grid.recuperarVideo(dic)
                grid.releerColumnas()
            for sp, name in self.liSplitters:
                k = "SP_%s" % name
                if k in dic:
                    sp.setSizes(dic[k])
            if siTam:
                if "_SIZE_" not in dic:
                    w, h = self.width(), self.height()
                    for k in dic:
                        if k.startswith("_TAMA"):
                            w, h = dic[k].split(",")
                else:
                    w, h = dic["_SIZE_"].split(",")
                w = int(w)
                h = int(h)
                if w > wE:
                    w = wE
                elif w < 20:
                    w = 20
                if h > (hE - 40):
                    h = hE - 40
                elif h < 20:
                    h = 20
                self.resize(w, h)
            return True
        else:
            if anchoDefecto or altoDefecto:
                if anchoDefecto is None:
                    anchoDefecto = self.width()
                if altoDefecto is None:
                    altoDefecto = self.height()
                if anchoDefecto > wE:
                    anchoDefecto = wE
                if altoDefecto > (hE - 40):
                    altoDefecto = hE - 40
                self.resize(anchoDefecto, altoDefecto)

        return False
示例#2
0
    def recuperarVideo(self, siTam=True, anchoDefecto=None, altoDefecto=None):

        dic = self.recuperarDicVideo()
        wE, hE = QTUtil.tamEscritorio()
        if dic:
            wE, hE = QTUtil.tamEscritorio()
            x, y = dic["_POSICION_"].split(",")
            x = int(x)
            y = int(y)
            if not ( 0 <= x <= (wE - 50) ):
                x = 0
            if not ( 0 <= y <= (hE - 50) ):
                y = 0
            self.move(x, y)
            if siTam:
                if "_SIZE_" not in dic:
                    w, h = self.width(),self.height()
                    for k in dic:
                        if k.startswith( "_TAMA" ):
                            w, h = dic[k].split(",")
                else:
                    w, h = dic["_SIZE_"].split(",")
                w = int(w)
                h = int(h)
                if w > wE:
                    w = wE
                elif w < 20:
                    w = 20
                if h > (hE - 40):
                    h = hE - 40
                elif h < 20:
                    h = 20
                self.resize(w, h)
            for grid in self.liGrids:
                grid.recuperarVideo(dic)
                grid.ponAnchosColumnas()
            for sp, name in self.liSplitters:
                k = "SP_%s" % name
                if k in dic:
                    sp.setSizes(dic[k])
            return True
        else:
            if anchoDefecto or altoDefecto:
                if anchoDefecto is None:
                    anchoDefecto = self.width()
                if altoDefecto is None:
                    altoDefecto = self.height()
                if anchoDefecto > wE:
                    anchoDefecto = wE
                if altoDefecto > (hE - 40):
                    altoDefecto = hE - 40
                self.resize(anchoDefecto, altoDefecto)

        return False
示例#3
0
 def restore_video(self, dicVideo):
     if dicVideo:
         wE, hE = QTUtil.tamEscritorio()
         x, y = dicVideo["_POSICION_"].split(",")
         x = int(x)
         y = int(y)
         if not (0 <= x <= (wE - 50)):
             x = 0
         if not (0 <= y <= (hE - 50)):
             y = 0
         self.move(x, y)
         if not ("_SIZE_" in dicVideo):
             w, h = self.width(), self.height()
             for k in dicVideo:
                 if k.startswith("_TAMA"):
                     w, h = dicVideo[k].split(",")
         else:
             w, h = dicVideo["_SIZE_"].split(",")
         w = int(w)
         h = int(h)
         if w > wE:
             w = wE
         elif w < 20:
             w = 20
         if h > hE:
             h = hE
         elif h < 20:
             h = 20
         self.resize(w, h)
示例#4
0
 def recuperarVideo(self, dicVideo):
     if dicVideo:
         wE, hE = QTUtil.tamEscritorio()
         x, y = dicVideo["_POSICION_"].split(",")
         x = int(x)
         y = int(y)
         if not ( 0 <= x <= (wE - 50) ):
             x = 0
         if not ( 0 <= y <= (hE - 50) ):
             y = 0
         self.move(x, y)
         if "_SIZE_" not in dicVideo:
             w, h = self.width(),self.height()
             for k in dicVideo:
                 if k.startswith( "_TAMA" ):
                     w, h = dicVideo[k].split(",")
         else:
             w, h = dicVideo["_SIZE_"].split(",")
         w = int(w)
         h = int(h)
         if w > wE:
             w = wE
         elif w < 20:
             w = 20
         if h > hE:
             h = hE
         elif h < 20:
             h = 20
         self.resize(w, h)
示例#5
0
    def recuperarVideo(self):

        if Util.tamFichero(self.ficheroVideo) > 0:
            dic = Util.recuperaDIC(self.ficheroVideo)
            if dic:
                wE, hE = QTUtil.tamEscritorio()
                x, y = dic["_POSICION_"].split(",")
                x = int(x)
                y = int(y)
                if not (0 <= x <= (wE - 50)):
                    x = 0
                if not (0 <= y <= (hE - 50)):
                    y = 0
                self.move(x, y)
                if "_SIZE_" not in dic:
                    w, h = self.width(), self.height()
                    for k in dic:
                        if k.startswith("_TAMA"):
                            w, h = dic[k].split(",")
                else:
                    w, h = dic["_SIZE_"].split(",")
                w = int(w)
                h = int(h)
                if w > wE:
                    w = wE
                elif w < 20:
                    w = 20
                if h > hE:
                    h = hE
                elif h < 20:
                    h = 20
                self.resize(w, h)
                self.siShowTablero = dic.get("SHOW_TABLERO", self.siShowTablero)
                self.nArrows = dic.get("NARROWS", self.nArrows)
                self.siTop = dic.get("SITOP", self.siTop)

                if not self.siShowTablero:
                    if self.siWidgets:
                        self.tablero.hide()
示例#6
0
    def recuperarVideo(self):

        if Util.tamFichero(self.ficheroVideo) > 0:
            dic = Util.recuperaDIC(self.ficheroVideo)
            if dic:
                wE, hE = QTUtil.tamEscritorio()
                x, y = dic["_POSICION_"].split(",")
                x = int(x)
                y = int(y)
                if not ( 0 <= x <= (wE - 50) ):
                    x = 0
                if not ( 0 <= y <= (hE - 50) ):
                    y = 0
                self.move(x, y)
                if "_SIZE_" not in dic:
                    w, h = self.width(),self.height()
                    for k in dic:
                        if k.startswith( "_TAMA" ):
                            w, h = dic[k].split(",")
                else:
                    w, h = dic["_SIZE_"].split(",")
                w = int(w)
                h = int(h)
                if w > wE:
                    w = wE
                elif w < 20:
                    w = 20
                if h > hE:
                    h = hE
                elif h < 20:
                    h = 20
                self.resize(w, h)
                self.siShowTablero = dic.get("SHOW_TABLERO", self.siShowTablero)
                self.nArrows = dic.get("NARROWS", self.nArrows)
                self.siTop = dic.get("SITOP", self.siTop)

                if not self.siShowTablero:
                    if self.siWidgets:
                        self.tablero.hide()
示例#7
0
    def __init__(self, owner, dbf, dClaves, gestor, estado, siElegir):
        titulo = _("Choose a game to view") if siElegir else _("PGN viewer")
        icono = Iconos.PGN()
        extparam = "pgnelegir"
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.siElegir = siElegir
        self.gestor = gestor
        self.dClaves = dClaves = copy.deepcopy(dClaves)
        self.seHaBorradoAlgo = False  # Para que se haga un touch antiguo al DB y lo regenere la proxima vez
        siRepite = estado is not None
        if siRepite:
            self.estado = estado
        else:
            self.estado = EstadoWpgn()
        self.dbf = dbf
        if siRepite:
            self.estado.recuperaDBF(dbf)
        else:
            self.dbf.leer()

        # Filtro
        self.liFiltro = self.estado.liFiltro if siRepite else []

        # Status bar-> antes que grid porque se actualiza en gridNumDatos
        self.status = QtGui.QStatusBar(self)
        self.status.setFixedHeight(22)

        # Lista
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("numero", _("N."), 50, siCentrado=True)

        def creaCol(clave, rotulo, siCentrado=True):
            tam = max(dClaves[clave], len(rotulo), 11)
            oColumnas.nueva(clave, rotulo, tam * 6, siCentrado=siCentrado)

        # # Claves segun orden estandar
        liBasic = ("EVENT", "SITE", "DATE", "ROUND", "WHITE", "BLACK",
                   "RESULT", "ECO", "FEN", "WHITEELO", "BLACKELO")
        self.liOrdenClaves = [
        ]  # nos servira en el exterior, para paste pgn y para mostrar info
        for clave in liBasic:
            if clave in dClaves:
                rotulo = TrListas.pgnLabel(clave)
                creaCol(clave, rotulo, clave != "EVENT")
                self.liOrdenClaves.append(clave)
        for clave in dClaves:
            if clave.upper() not in liBasic:
                rotulo = TrListas.pgnLabel(clave)
                creaCol(clave.upper(), rotulo, clave != "EVENT")
                self.liOrdenClaves.append(clave.upper())

        dicVideoGrid = self.estado.dicVideoGrid if siRepite else None
        self.grid = Grid.Grid(self,
                              oColumnas,
                              siSelecFilas=True,
                              dicVideo=dicVideoGrid,
                              siSeleccionMultiple=True)

        if siRepite:
            self.grid.goto(self.estado.recno, 0)
        else:
            self.grid.gotop()

        if siRepite:
            self.estado.recuperaWindow(self)
        else:
            n = self.grid.anchoColumnas() + 20
            w, h = QTUtil.tamEscritorio()
            self.resize(min(w * 9 / 10, n), h * 8 / 10)

        # Toolbar
        if siElegir:
            liAcciones = [
                (_("Choose"), Iconos.Aceptar(), self.elegir),
                None,
                (_("Cancel"), Iconos.Cancelar(), self.cancelar),
                None,
                (_("First"), Iconos.Inicio(), self.grid.gotop),
                (_("Last"), Iconos.Final(), self.grid.gobottom),
                None,
                (_("Filter"), Iconos.Filtrar(), self.filtrar),
                None,
            ]
        else:
            liAcciones = [
                (_("Close"), Iconos.MainMenu(), self.cancelar), None,
                (_("View"), Iconos.Ver(), self.elegir), None,
                (_("Edit"), Iconos.Modificar(), self.editar), None,
                (_("Save"), Iconos.Grabar(), self.guardar), None,
                (_("First"), Iconos.Inicio(), self.grid.gotop),
                (_("Last"), Iconos.Final(), self.grid.gobottom), None,
                (_("Filter"), Iconos.Filtrar(), self.filtrar), None,
                (_("Remove"), Iconos.Borrar(), self.borrar), None,
                (_("Utilities"), Iconos.Utilidades(), self.utilidades), None
            ]
        tb = Controles.TBrutina(self, liAcciones)

        # Layout
        layout = Colocacion.V().control(tb).control(self.grid).control(
            self.status).margen(3)
        self.setLayout(layout)

        self.recuperarVideo(siTam=False)
        self.ponStatus()
示例#8
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
示例#9
0
    def __init__(self, owner, dbf, dClaves, gestor, estado, siElegir):
        titulo = _("Choose a game to view") if siElegir else _("PGN viewer")
        icono = Iconos.PGN()
        extparam = "pgnelegir"
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.siElegir = siElegir
        self.gestor = gestor
        self.dClaves = dClaves = copy.deepcopy(dClaves)
        self.seHaBorradoAlgo = False  # Para que se haga un touch antiguo al DB y lo regenere la proxima vez
        siRepite = estado is not None
        if siRepite:
            self.estado = estado
        else:
            self.estado = EstadoWpgn()
        self.dbf = dbf
        if siRepite:
            self.estado.recuperaDBF(dbf)
        else:
            self.dbf.leer()

        # Filtro
        self.liFiltro = self.estado.liFiltro if siRepite else []

        # Status bar-> antes que grid porque se actualiza en gridNumDatos
        self.status = QtGui.QStatusBar(self)
        self.status.setFixedHeight(22)

        # Lista
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("numero", _("N."), 50, siCentrado=True)

        def creaCol(clave, rotulo, siCentrado=True):
            tam = max(dClaves[clave], len(rotulo), 11)
            oColumnas.nueva(clave, rotulo, tam * 6, siCentrado=siCentrado)

        # # Claves segun orden estandar
        liBasic = ("EVENT", "SITE", "DATE", "ROUND", "WHITE", "BLACK", "RESULT", "ECO", "FEN", "WHITEELO", "BLACKELO" )
        self.liOrdenClaves = []  # nos servira en el exterior, para paste pgn y para mostrar info
        for clave in liBasic:
            if clave in dClaves:
                rotulo = TrListas.pgnLabel(clave)
                creaCol(clave, rotulo, clave != "EVENT")
                self.liOrdenClaves.append(clave)
        for clave in dClaves:
            if clave.upper() not in liBasic:
                rotulo = TrListas.pgnLabel(clave)
                creaCol(clave.upper(), rotulo, clave != "EVENT")
                self.liOrdenClaves.append(clave.upper())

        dicVideoGrid = self.estado.dicVideoGrid if siRepite else None
        self.grid = Grid.Grid(self, oColumnas, siSelecFilas=True, dicVideo=dicVideoGrid, siSeleccionMultiple=True)

        if siRepite:
            self.grid.goto(self.estado.recno, 0)
        else:
            self.grid.gotop()

        if siRepite:
            self.estado.recuperaWindow(self)
        else:
            n = self.grid.anchoColumnas() + 20
            w, h = QTUtil.tamEscritorio()
            self.resize(min(w * 9 / 10, n), h * 8 / 10)

        # Toolbar
        if siElegir:
            liAcciones = [( _("Choose"), Iconos.Aceptar(), self.elegir ), None,
                          ( _("Cancel"), Iconos.Cancelar(), self.cancelar ), None,
                          ( _("First"), Iconos.Inicio(), self.grid.gotop ),
                          ( _("Last"), Iconos.Final(), self.grid.gobottom ), None,
                          ( _("Filter"), Iconos.Filtrar(), self.filtrar ), None,
            ]
        else:
            liAcciones = [
                ( _("Close"), Iconos.MainMenu(), self.cancelar ), None,
                ( _("View"), Iconos.Ver(), self.elegir ), None,
                ( _("Edit"), Iconos.Modificar(), self.editar ), None,
                ( _("Save"), Iconos.Grabar(), self.guardar ), None,
                ( _("First"), Iconos.Inicio(), self.grid.gotop ),
                ( _("Last"), Iconos.Final(), self.grid.gobottom ), None,
                ( _("Filter"), Iconos.Filtrar(), self.filtrar ), None,
                ( _("Remove"), Iconos.Borrar(), self.borrar ), None,
                ( _("Utilities"), Iconos.Utilidades(), self.utilidades ), None
            ]
        tb = Controles.TBrutina(self, liAcciones)

        # Layout
        layout = Colocacion.V().control(tb).control(self.grid).control(self.status).margen(3)
        self.setLayout(layout)

        self.recuperarVideo(siTam=False)
        self.ponStatus()
示例#10
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
示例#11
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