def new(self): si_expl = len(self.listaOpenings) < 4 if si_expl: QTUtil2.message_bold(self, _("First you must select the initial moves.")) w = PantallaOpenings.WAperturas(self, self.configuracion, None) if w.exec_(): ap = w.resultado() pv = ap.a1h8 if ap else "" name = ap.name if ap else "" else: return if si_expl: QTUtil2.message_bold( self, _("Secondly you have to choose a name for this opening studio." )) name = self.get_nombre(name) if name: file = self.listaOpenings.select_filename(name) self.listaOpenings.new(file, pv, name) self.resultado = self.listaOpenings[-1] self.save_video() self.accept()
def importarApertura(self, game): game.assign_opening() w = PantallaOpenings.WAperturas(self, self.configuracion, game.opening) if w.exec_(): ap = w.resultado() game = Game.Game() game.read_pv(ap.a1h8) self.addPartida(game)
def editarApertura(self): self.btApertura.setDisabled(True) # Puede tardar bastante vtime me = QTUtil2.unMomento(self) w = PantallaOpenings.WAperturas(self, self.configuracion, self.bloqueApertura) me.final() self.btApertura.setDisabled(False) if w.exec_(): self.bloqueApertura = w.resultado() self.muestraApertura()
def opening(): me = QTUtil2.unMomento(self) import Code.Openings.PantallaOpenings as PantallaAperturas w = PantallaAperturas.WAperturas(self, self.configuracion, self.last_opening) me.final() if w.exec_(): self.last_opening = ap = w.resultado() pv = getattr(ap, "a1h8", "") self.dbGames.filterPV(pv) self.numJugada = pv.count(" ") refresh()
def aperturaspers(self): w = PantallaOpenings.AperturasPersonales(self) w.exec_()
def configurarGS(self): mt = _("Engine").lower() mt = _X(_("Disable %1"), mt) if self.play_against_engine else _X( _("Enable %1"), mt) sep = (None, None, None) liMasOpciones = [ ("rotacion", _("Auto-rotate board"), Iconos.JS_Rotacion()), sep, ("opening", _("Opening"), Iconos.Apertura()), sep, ("position", _("Edit start position"), Iconos.Datos()), sep, ("pasteposicion", _("Paste FEN position"), Iconos.Pegar16()), sep, ("leerpgn", _("Read PGN"), Iconos.PGN_Importar()), sep, ("pastepgn", _("Paste PGN"), Iconos.Pegar16()), sep, ("engine", mt, Iconos.Motores()), sep, ("voyager", _("Voyager 2"), Iconos.Voyager1()), ] resp = self.configurar(liMasOpciones, siCambioTutor=True, siSonidos=True) if resp == "rotacion": self.auto_rotate = not self.auto_rotate is_white = self.game.last_position.is_white if self.auto_rotate: if is_white != self.tablero.is_white_bottom: self.tablero.rotaTablero() elif resp == "opening": me = self.unMomento() w = PantallaOpenings.WAperturas(self.main_window, self.configuracion, self.bloqueApertura) me.final() if w.exec_(): self.bloqueApertura = w.resultado() self.xfichero = None self.xpgn = None self.xjugadaInicial = None self.reiniciar() elif resp == "position": self.startPosition() elif resp == "pasteposicion": texto = QTUtil.traePortapapeles() if texto: cp = Position.Position() try: cp.read_fen(str(texto)) self.xfichero = None self.xpgn = None self.xjugadaInicial = None self.new_game() self.game.set_position(first_position=cp) self.bloqueApertura = None self.reiniciar() except: pass elif resp == "leerpgn": self.leerpgn() elif resp == "pastepgn": texto = QTUtil.traePortapapeles() if texto: ok, game = Game.pgn_game(texto) if not ok: QTUtil2.message_error( self.main_window, _("The text from the clipboard does not contain a chess game in PGN format" )) return self.xfichero = None self.xpgn = None self.xjugadaInicial = None self.bloqueApertura = None dic = self.creaDic() dic["GAME"] = game.save() dic["WHITEBOTTOM"] = game.last_position.is_white self.reiniciar(dic) elif resp == "engine": self.ponRotulo1("") if self.play_against_engine: if self.xrival: self.xrival.terminar() self.xrival = None self.play_against_engine = False else: self.cambioRival() elif resp == "voyager": ptxt = Voyager.voyagerPartida(self.main_window, self.game) if ptxt: self.xfichero = None self.xpgn = None self.xjugadaInicial = None dic = self.creaDic() dic["GAME"] = ptxt.save() dic["WHITEBOTTOM"] = self.tablero.is_white_bottom self.reiniciar(dic)