Exemplo n.º 1
0
    def start_with_user(self, user):
        self.user = user

        self.li_opciones_inicio = [
            TB_QUIT, TB_PLAY, TB_TRAIN, TB_COMPETE, TB_TOOLS, TB_OPTIONS,
            TB_INFORMATION
        ]  # Lo incluimos aqui porque sino no lo lee, en caso de aplazada

        self.configuration = Configuration.Configuration(user)
        self.configuration.start()
        Code.configuration = self.configuration
        Code.procesador = self
        OpeningsStd.reset()

        # Tras crear configuración miramos si hay Adjournments
        self.test_opcion_Adjournments()

        Code.todasPiezas = Piezas.TodasPiezas()

        self.manager = None

        self.siPrimeraVez = True
        self.siPresentacion = False  # si esta funcionando la presentacion

        self.posicionInicial = Position.Position()
        self.posicionInicial.set_pos_initial()

        self.xrival = None
        self.xtutor = None  # creaTutor lo usa asi que hay que definirlo antes
        self.xanalyzer = None  # cuando se juega ManagerEntMaq y el tutor danzando a toda maquina,
        # se necesita otro diferente
        self.replay = None
        self.replayBeep = None
Exemplo n.º 2
0
    def procesa(self, orden):
        key = orden.key
        if key == KIBRUN_CONFIGURATION:
            user = orden.dv["USER"]
            self.configuration = Configuration.Configuration(user)
            self.configuration.lee()
            self.configuration.leeConfBoards()
            Code.configuration = self.configuration
            OpeningsStd.reset()

            kibitzers = Kibitzers.Kibitzers()
            self.numkibitzer = kibitzers.number(orden.dv["HUELLA"])
            self.kibitzer = kibitzers.kibitzer(self.numkibitzer)
            prioridad = self.kibitzer.prioridad

            priorities = Priorities.priorities

            if prioridad != priorities.normal:
                self.prioridad = priorities.value(prioridad)
            else:
                self.prioridad = None

            self.titulo = self.kibitzer.name

            self.key_video = "Kibitzers%s" % self.kibitzer.huella
            self.dic_video = self.configuration.restore_video(self.key_video)

            self.tipo = self.kibitzer.tipo
            self.lanzaVentana()

        elif key == KIBRUN_GAME:
            game = Game.Game()
            game.restore(orden.dv["GAME"])
            if self.kibitzer.pointofview == KIB_BEFORE_MOVE:
                game.anulaSoloUltimoMovimiento()
            if self.tipo == KIB_THREATS:
                last_position = game.last_position
                last_position.is_white = not last_position.is_white
                game_thread = Game.Game(ini_posicion=last_position)
                self.ventana.orden_game(game_thread)
            else:
                self.ventana.orden_game(game)

        elif key == KIBRUN_STOP:
            self.ventana.stop()

        elif key == KIBRUN_CLOSE:
            self.ipc.close()
            self.ventana.finalizar()
            self.ventana.reject()
Exemplo n.º 3
0
def run(user, file_tournament, file_work):
    sys.stderr = Util.Log("./bug.tournaments")

    app = QtWidgets.QApplication([])

    configuration = Configuration.Configuration(user)
    configuration.lee()
    configuration.leeConfBoards()
    configuration.releeTRA()
    Code.configuration = configuration
    OpeningsStd.reset()
    Code.todasPiezas = Piezas.TodasPiezas()

    app.setStyle(QtWidgets.QStyleFactory.create(configuration.x_style))
    QtWidgets.QApplication.setPalette(QtWidgets.QApplication.style().standardPalette())

    w = WTournamentRun.WTournamentRun(file_tournament, file_work)
    w.show()
    w.busca_trabajo()
Exemplo n.º 4
0
    def resultado(self):
        if len(self.game) == 0:
            return None
        ap = self.game.opening
        if ap is None:
            ap = OpeningsStd.OpeningsStd(_("Unknown"))
            ap.a1h8 = self.game.pv()
        else:
            if not self.game.last_jg().in_the_opening:
                p = Game.Game()
                p.read_pv(ap.a1h8)
                ap.a1h8 = self.game.pv()
                ap.trNombre += " + %s" % (self.game.pgn_translated()[len(p.pgn_translated()) + 1:],)

        ap.pgn = self.game.pgn_translated()
        return ap
Exemplo n.º 5
0
 def leeBloques(self, li_pv):
     li = []
     for pv in li_pv:
         p = Game.Game()
         p.read_pv(pv)
         p.assign_opening()
         ap = p.opening
         if ap is None:
             ap = OpeningsStd.OpeningsStd(_("Unknown"))
             ap.a1h8 = pv
         else:
             ap.a1h8 = pv
             ap.pgn = ap.pgn.replace(". ", ".")
             nap = len(ap.pgn)
             pgn_translated = p.pgn_translated()
             if len(pgn_translated) > nap:
                 ap.trNombre += " + %s" % (pgn_translated[nap + 1:],)
         ap.pgn = p.pgn_translated()
         li.append(ap)
     return li