def juegaAplazada(self, aplazamiento):
        self.cpu = CPU.CPU(self.main_window)

        type_play = aplazamiento["TIPOJUEGO"]
        is_white = aplazamiento["ISWHITE"]

        if type_play == GT_COMPETITION_WITH_TUTOR:
            categoria = self.configuration.rival.categorias.segun_clave(
                aplazamiento["CATEGORIA"])
            nivel = aplazamiento["LEVEL"]
            puntos = aplazamiento["PUNTOS"]
            self.manager = ManagerCompeticion.ManagerCompeticion(self)
            self.manager.start(categoria, nivel, is_white, puntos,
                               aplazamiento)
        elif type_play == GT_AGAINST_ENGINE:
            if aplazamiento["MODO"] == "Basic":
                self.entrenaMaquina(aplazamiento)
            else:
                self.playPersonAplazada(aplazamiento)
        elif type_play == GT_ELO:
            self.manager = ManagerElo.ManagerElo(self)
            self.manager.start(aplazamiento)
        elif type_play == GT_MICELO:
            self.manager = ManagerMicElo.ManagerMicElo(self)
            self.manager.start(None, 0, 0, aplazamiento)
        elif type_play == GT_ALBUM:
            self.manager = ManagerAlbum.ManagerAlbum(self)
            self.manager.start(None, None, aplazamiento)
        elif type_play == GT_AGAINST_PGN:
            self.read_pgn(sys.argv[1])
        elif type_play in (GT_FICS, GT_FIDE, GT_LICHESS):
            self.manager = ManagerFideFics.ManagerFideFics(self)
            self.manager.selecciona(type_play)
            self.manager.start(aplazamiento["IDGAME"],
                               aplazamiento=aplazamiento)
Beispiel #2
0
 def genEnginesElo(self):
     d = OSEngines.read_engines(Code.folder_engines)
     li = []
     for elo, key, depth in ManagerElo.listaMotoresElo():
         if key in d:
             cm = d[key].clona()
             cm.name = "%d - %s (%s %d)" % (elo, cm.name, _("depth"), depth)
             cm.key = cm.name
             cm.fixed_depth = depth
             cm.elo = elo
             li.append(cm)
     li.sort(key=lambda x: x.elo)
     return li
    def Adjournments(self):
        menu = QTVarios.LCMenu(self.main_window)
        li_Adjournments = Adjournments.Adjournments().list_menu()
        for key, label, tp in li_Adjournments:
            menu.opcion((True, key, tp), label, Iconos.PuntoMagenta())
            menu.addSeparator()
        menu.addSeparator()
        mr = menu.submenu(_("Remove"), Iconos.Borrar())
        for key, label, tp in li_Adjournments:
            mr.opcion((False, key, tp), label, Iconos.Delete())

        resp = menu.lanza()
        if resp:
            si_run, key, tp = resp
            if si_run:
                dic = Adjournments.Adjournments().get(key)

                Adjournments.Adjournments().remove(key)
                if tp == GT_AGAINST_ENGINE:
                    self.manager = ManagerPlayAgainstEngine.ManagerPlayAgainstEngine(
                        self)
                elif tp == GT_ALBUM:
                    self.manager = ManagerAlbum.ManagerAlbum(self)
                elif tp == GT_AGAINST_CHILD_ENGINE:
                    self.manager = ManagerPerson.ManagerPerson(self)
                elif tp == GT_MICELO:
                    self.manager = ManagerMicElo.ManagerMicElo(self)
                elif tp == GT_COMPETITION_WITH_TUTOR:
                    self.manager = ManagerCompeticion.ManagerCompeticion(self)
                elif tp == GT_ELO:
                    self.manager = ManagerElo.ManagerElo(self)
                elif tp == GT_AGAINST_GM:
                    self.manager = ManagerGM.ManagerGM(self)
                elif tp in (GT_FIDE, GT_FICS, GT_LICHESS):
                    self.manager = ManagerFideFics.ManagerFideFics(self)
                    self.manager.selecciona(tp)
                else:
                    return
                self.manager.run_adjourn(dic)
                return

            else:
                Adjournments.Adjournments().remove(key)

            self.test_opcion_Adjournments()
            self.main_window.pon_toolbar(self.li_opciones_inicio, atajos=True)
 def lucaselo(self):
     self.manager = ManagerElo.ManagerElo(self)
     resp = WEngines.select_engine_elo(self.manager,
                                       self.configuration.eloActivo())
     if resp:
         self.manager.start(resp)