Example #1
0
 def show_anotar(self):
     w = PantallaAnotar.WAnotar(self)
     if w.exec_():
         pc, siblancasabajo = w.resultado
         if pc is None:
             pc = Everest.get_partida_random()
         self.anotar(pc, siblancasabajo)
Example #2
0
    def __init__(self, wowner, configuration, recno):
        expedition = Everest.Expedition(configuration, recno)
        self.li_routes, self.current, svg, label = expedition.gen_routes()

        titulo = _("Everest")
        icono = Iconos.Trekking()
        extparam = "expedition"
        QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam)

        self.selected = False

        wsvg = QtSvg.QSvgWidget()
        wsvg.load(QtCore.QByteArray(svg))
        wsvg.setFixedSize(762, int(762.0 * 520.0 / 1172.0))
        lySVG = Colocacion.H().relleno(1).control(wsvg).relleno(1)

        li_acciones = (
            (_("Climb"), Iconos.Empezar(), self.climb),
            None,
            (_("Close"), Iconos.MainMenu(), self.cancel),
            None,
        )
        tb = Controles.TBrutina(self, li_acciones).vertical()
        if self.current is None:
            tb.setAccionVisible(self.climb, False)

        lyRot = Colocacion.H()
        for elem in label:
            lb_rotulo = Controles.LB(self, elem).align_center()
            lb_rotulo.setStyleSheet(
                "QWidget { border-style: groove; border-width: 2px; border-color: LightSlateGray ;}"
            )
            lb_rotulo.ponTipoLetra(puntos=12, peso=700)
            lyRot.control(lb_rotulo)

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("ROUTE", _("Route"), 240, centered=True)
        o_columns.nueva("GAMES", _("Games"), 80, centered=True)
        o_columns.nueva("DONE", _("Done"), 80, centered=True)
        o_columns.nueva("TIME", _("Time"), 80, centered=True)
        o_columns.nueva("MTIME", _("Average time"), 80, centered=True)
        o_columns.nueva("MPOINTS", _("Av. lost points"), 80, centered=True)
        o_columns.nueva("TRIES", _("Max tries"), 80, centered=True)
        o_columns.nueva("TOLERANCE", _("Tolerance"), 80, centered=True)
        grid = Grid.Grid(self,
                         o_columns,
                         siSelecFilas=True,
                         siSeleccionMultiple=False)
        grid.setMinimumWidth(grid.anchoColumnas() + 20)
        grid.coloresAlternados()

        lyG = Colocacion.V().otro(lyRot).control(grid).margen(0)

        lyR = Colocacion.H().control(tb).otro(lyG).margen(0)

        ly = Colocacion.V().otro(lySVG).otro(lyR).margen(3)

        self.setLayout(ly)

        self.restore_video(siTam=True, anchoDefecto=784, altoDefecto=670)
Example #3
0
    def __init__(self, procesador):

        super().__init__(parent=procesador.pantalla,
                         titulo=_("Expeditions to the Everest"),
                         icono=Iconos.Trekking(),
                         extparam="everestBase")

        self.procesador = procesador
        self.configuracion = procesador.configuracion

        self.db = Everest.Expeditions(self.configuracion)

        self.selected = None

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("NAME", _("Expedition"), 120, siCentrado=True)
        oColumnas.nueva("DATE_INIT", _("Start date"), 120, siCentrado=True)
        oColumnas.nueva("DATE_END", _("Final date"), 100, siCentrado=True)
        oColumnas.nueva("NUM_GAMES", _("Games"), 80, siCentrado=True)
        oColumnas.nueva("TIMES", _("Time"), 120, siCentrado=True)
        oColumnas.nueva("TOLERANCE", _("Tolerance"), 90, siCentrado=True)
        oColumnas.nueva("TRIES", _("Tries"), 90, siCentrado=True)
        self.grid = Grid.Grid(self,
                              oColumnas,
                              siSelecFilas=True,
                              siSeleccionMultiple=True)
        self.grid.setMinimumWidth(self.grid.anchoColumnas() + 20)

        liAcciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar),
            None,
            (_("Start"), Iconos.Empezar(), self.start),
            None,
            (_("New"), Iconos.Nuevo(), self.nuevo),
            None,
            (_("Remove"), Iconos.Borrar(), self.borrar),
            None,
        )
        self.tb = Controles.TBrutina(self, liAcciones)

        # Colocamos
        lyTB = Colocacion.H().control(self.tb).margen(0)
        ly = Colocacion.V().otro(lyTB).control(self.grid).margen(3)

        self.setLayout(ly)

        self.registrarGrid(self.grid)
        self.recuperarVideo(siTam=False)

        self.grid.gotop()
    def __init__(self, owner, fichero):
        self.litourneys = Everest.str_file(fichero)
        self.configuracion = owner.configuracion
        titulo = _("New expedition")
        icono = Iconos.Trekking()
        extparam = "newexpedition"
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.selected = None

        # Torneo
        li = [("%s (%d)" % (_F(tourney["TOURNEY"]), len(tourney["GAMES"])), tourney) for tourney in self.litourneys]
        li.sort(key=lambda x:x[0])
        self.cbtourney, lbtourney = QTUtil2.comboBoxLB(self, li, li[0], _("Expedition"))
        btmas = Controles.PB(self, "", self.mas).ponIcono(Iconos.Mas22())
        lytourney = Colocacion.H().control(lbtourney).control(self.cbtourney).control(btmas).relleno(1)

        # tolerance
        self.sbtolerance_min, lbtolerance_min = QTUtil2.spinBoxLB(self, 20, 0, 99999, _("From"))
        self.sbtolerance_min.capturaCambiado(self.tolerance_changed)
        self.sbtolerance_max, lbtolerance_max = QTUtil2.spinBoxLB(self, 1000, 0, 99999, _("To"))
        lbexplanation = Controles.LB(self, _("Maximum lost points for having to repeat active game"))
        ly = Colocacion.H().relleno(2).control(lbtolerance_min).control(self.sbtolerance_min).relleno(1)
        ly.control(lbtolerance_max).control(self.sbtolerance_max).relleno(2)
        layout = Colocacion.V().otro(ly).control(lbexplanation)
        gbtolerance = Controles.GB(self, _("Tolerance"), layout)

        # tries
        self.sbtries_min, lbtries_min = QTUtil2.spinBoxLB(self, 2, 1, 99999, _("From"))
        self.sbtries_min.capturaCambiado(self.tries_changed)
        self.sbtries_max, lbtries_max = QTUtil2.spinBoxLB(self, 15, 1, 99999, _("To"))
        lbexplanation = Controles.LB(self, _("Maximum repetitions to return to the previous game"))
        ly = Colocacion.H().relleno(2).control(lbtries_min).control(self.sbtries_min).relleno(1)
        ly.control(lbtries_max).control(self.sbtries_max).relleno(2)
        layout = Colocacion.V().otro(ly).control(lbexplanation)
        gbtries = Controles.GB(self, _("Tries"), layout)

        # color
        liColors = ((_("Default"), "D"), (_("White"), "W"), (_("Black"), "B"))
        self.cbcolor = Controles.CB(self, liColors, "D")
        layout = Colocacion.H().relleno(1).control(self.cbcolor).relleno(1)
        gbcolor = Controles.GB(self, _("Color"), layout)

        tb = QTVarios.LCTB(self)
        tb.new(_("Accept"), Iconos.Aceptar(), self.aceptar)
        tb.new(_("Cancel"), Iconos.Cancelar(), self.cancelar)

        layout = Colocacion.V().control(tb).otro(lytourney).control(gbtolerance).control(gbtries).control(gbcolor)

        self.setLayout(layout)
Example #5
0
    def __init__(self, procesador):

        QTVarios.WDialogo.__init__(self, procesador.main_window,
                                   _("Expeditions to the Everest"),
                                   Iconos.Trekking(), "everestBase")

        self.procesador = procesador
        self.configuration = procesador.configuration

        self.db = Everest.Expeditions(self.configuration)

        self.selected = None

        o_columns = Columnas.ListaColumnas()
        o_columns.nueva("NAME", _("Expedition"), 120, centered=True)
        o_columns.nueva("DATE_INIT", _("Start date"), 120, centered=True)
        o_columns.nueva("DATE_END", _("Final date"), 100, centered=True)
        o_columns.nueva("NUM_GAMES", _("Games"), 80, centered=True)
        o_columns.nueva("TIMES", _("Time"), 120, centered=True)
        o_columns.nueva("TOLERANCE", _("Tolerance"), 90, centered=True)
        o_columns.nueva("TRIES", _("Tries"), 90, centered=True)
        self.grid = Grid.Grid(self,
                              o_columns,
                              siSelecFilas=True,
                              siSeleccionMultiple=True)
        self.grid.setMinimumWidth(self.grid.anchoColumnas() + 20)

        li_acciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar),
            None,
            (_("Start"), Iconos.Empezar(), self.start),
            None,
            (_("New"), Iconos.Nuevo(), self.nuevo),
            None,
            (_("Remove"), Iconos.Borrar(), self.borrar),
            None,
        )
        self.tb = QTVarios.LCTB(self, li_acciones)

        # Colocamos
        lyTB = Colocacion.H().control(self.tb).margen(0)
        ly = Colocacion.V().otro(lyTB).control(self.grid).margen(3)

        self.setLayout(ly)

        self.register_grid(self.grid)
        self.restore_video(siTam=False)

        self.grid.gotop()
Example #6
0
    def start(self, recno):

        self.expedition = Everest.Expedition(self.configuration, recno)
        self.expedition.run()

        self.dic_analysis = {}

        self.is_competitive = True
        self.resultado = None
        self.human_is_playing = False
        self.analysis = None
        self.comment = None
        self.siAnalizando = False
        self.human_side = self.expedition.is_white
        self.is_engine_side_white = not self.expedition.is_white
        self.gameObj = self.expedition.game
        self.game.set_tags(self.gameObj.li_tags)
        self.numJugadasObj = self.gameObj.num_moves()
        self.posJugadaObj = 0
        self.nombreObj = self.expedition.name

        self.xanalyzer.maximize_multipv()

        self.puntos = 0
        self.vtime = 0.0

        self.book = Opening.OpeningPol(999)

        self.main_window.pon_toolbar((TB_CANCEL, TB_REINIT, TB_CONFIG))

        self.main_window.activaJuego(True, False, siAyudas=False)
        self.remove_hints(True, True)

        self.set_dispatcher(self.player_has_moved)
        self.set_position(self.game.last_position)
        self.put_pieces_bottom(self.human_side)
        self.show_side_indicator(True)
        self.set_label1(self.expedition.label())
        self.set_label2("")

        self.pgnRefresh(True)
        self.ponCapInfoPorDefecto()
        self.check_boards_setposition()

        self.state = ST_PLAYING
        self.play_next_move()
Example #7
0
    def inicio(self, recno):

        self.expedition = Everest.Expedition(self.configuracion, recno)
        self.expedition.run()

        self.dic_analysis = {}

        self.siCompetitivo = True
        self.resultado = None
        self.human_is_playing = False
        self.analysis = None
        self.comment = None
        self.siAnalizando = False
        self.is_human_side_white = self.expedition.is_white
        self.is_engine_side_white = not self.expedition.is_white
        self.partidaObj = self.expedition.game
        self.game.set_tags(self.partidaObj.li_tags)
        self.numJugadasObj = self.partidaObj.num_moves()
        self.posJugadaObj = 0
        self.nombreObj = self.expedition.name

        self.xanalyzer.maximizaMultiPV()

        self.puntos = 0
        self.vtime = 0.0

        self.book = Apertura.AperturaPol(999)

        self.main_window.pon_toolbar((TB_CANCEL, TB_REINIT, TB_CONFIG))

        self.main_window.activaJuego(True, False, siAyudas=False)
        self.quitaAyudas(True, True)

        self.set_dispatcher(self.mueve_humano)
        self.setposition(self.game.last_position)
        self.ponPiezasAbajo(self.is_human_side_white)
        self.mostrarIndicador(True)
        self.ponRotulo1(self.expedition.label())
        self.ponRotulo2("")

        self.pgnRefresh(True)
        self.ponCapInfoPorDefecto()
        self.dgt_setposition()

        self.state = ST_PLAYING
        self.siguiente_jugada()
Example #8
0
    def inicio(self, recno):

        self.expedition = Everest.Expedition(self.configuracion, recno)
        self.expedition.run()

        self.dic_analysis = {}

        self.siCompetitivo = True
        self.resultado = None
        self.siJuegaHumano = False
        self.analisis = None
        self.comentario = None
        self.siAnalizando = False
        self.siJugamosConBlancas = self.expedition.is_white
        self.siRivalConBlancas = not self.expedition.is_white
        self.partidaObj = self.expedition.partida
        self.numJugadasObj = self.partidaObj.numJugadas()
        self.posJugadaObj = 0
        self.nombreObj = self.expedition.nombre

        self.xanalyzer.maximizaMultiPV()

        self.puntos = 0
        self.tiempo = 0.0

        self.book = Apertura.AperturaPol(999)

        self.pantalla.ponToolBar((k_cancelar, k_reiniciar, k_configurar))

        self.pantalla.activaJuego(True, False, siAyudas=False)
        self.quitaAyudas(True, True)

        self.ponMensajero(self.mueveHumano)
        self.ponPosicion(self.partida.ultPosicion)
        self.ponPiezasAbajo(self.siJugamosConBlancas)
        self.mostrarIndicador(True)
        self.ponRotulo1(self.expedition.label())
        self.ponRotulo2("")

        self.pgnRefresh(True)
        self.ponCapInfoPorDefecto()
        self.ponPosicionDGT()

        self.estado = kJugando
        self.siguienteJugada()