def test_opcion_adjourns(self): must_adjourn = len(Adjourns.Adjourns()) > 0 if TB_ADJOURNS in self.li_opciones_inicio: if not must_adjourn: pos = self.li_opciones_inicio.index(TB_ADJOURNS) del self.li_opciones_inicio[pos] else: if must_adjourn: self.li_opciones_inicio.insert(1, TB_ADJOURNS)
def adjourn(self): if QTUtil2.pregunta(self.main_window, _("Do you want to adjourn the game?")): dic = self.save_state() label_menu = "%s %s/%s" % (_("Album"), _F(self.album.name), _F(self.cromo.name)) self.state = ST_ENDGAME with Adjourns.Adjourns() as adj: adj.add(self.game_type, dic, label_menu) adj.si_seguimos(self)
def adjourns(self): menu = QTVarios.LCMenu(self.main_window) li_adjourns = Adjourns.Adjourns().list_menu() for key, label, tp in li_adjourns: menu.opcion((True, key, tp), label, Iconos.PuntoMagenta()) menu.addSeparator() menu.addSeparator() mr = menu.submenu(_("Remove"), Iconos.Borrar()) for key, label, tp in li_adjourns: mr.opcion((False, key, tp), label, Iconos.Delete()) resp = menu.lanza() if resp: si_run, key, tp = resp if si_run: dic = Adjourns.Adjourns().get(key) Adjourns.Adjourns().remove(key) if tp == GT_AGAINST_ENGINE: self.gestor = GestorPlayAgainstEngine.GestorPlayAgainstEngine( self) self.gestor.run_adjourn(dic) elif tp == GT_ALBUM: self.gestor = GestorAlbum.GestorAlbum(self) self.gestor.run_adjourn(dic) elif tp == GT_COMPETITION_WITH_TUTOR: self.gestor = GestorCompeticion.GestorCompeticion(self) self.gestor.run_adjourn(dic) elif tp == GT_ELO: self.gestor = GestorElo.GestorElo(self) self.gestor.run_adjourn(dic) elif tp in (GT_FIDE, GT_FICS, GT_LICHESS): self.gestor = GestorFideFics.GestorFideFics(self) self.gestor.selecciona(tp) self.gestor.run_adjourn(dic) return else: Adjourns.Adjourns().remove(key) self.test_opcion_adjourns() self.main_window.pon_toolbar(self.li_opciones_inicio, atajos=True)
def adjourn(self): if len(self.game) > 0 and QTUtil2.pregunta( self.main_window, _("Do you want to adjourn the game?")): dic = { "IDGAME": self.id_game, "POSJUGADAOBJ": self.posJugadaObj, "GAME_SAVE": self.game.save(), "PUNTOS": self.puntos, } with Adjourns.Adjourns() as adj: adj.add(self.game_type, dic, self._titulo) self.analizaTerminar() adj.si_seguimos(self)
def adjourn(self): if QTUtil2.pregunta(self.main_window, _("Do you want to adjourn the game?")): dic = self.save_state() # se guarda en una bd adjourns dic clave = fecha y hora y tipo label_menu = _("Play against an engine") + ". " + self.xrival.name self.state = ST_ENDGAME self.finalizar() if self.is_analyzing: self.is_analyzing = False self.xtutor.ac_final(-1) with Adjourns.Adjourns() as adj: adj.add(self.game_type, dic, label_menu) adj.si_seguimos(self)
def adjourn(self): if len(self.game) > 0 and QTUtil2.pregunta(self.main_window, _("Do you want to adjourn the game?")): self.state = ST_ENDGAME dic = { "ISWHITE": self.is_human_side_white, "GAME_SAVE": self.game.save(), "CLAVE": self.datosMotor.clave, "DEPTH": self.datosMotor.depth, "PGANA": self.datosMotor.pgana, "PPIERDE": self.datosMotor.ppierde, "PTABLAS": self.datosMotor.ptablas, } label_menu = "%s. %s" % (_("Lucas-Elo"), self.datosMotor.name) if self.datosMotor.depth: label_menu += " - %d" % self.datosMotor.depth with Adjourns.Adjourns() as adj: adj.add(self.game_type, dic, label_menu) adj.si_seguimos(self)