def grid_right_button(self, grid, row, column, modificadores): if self.siFilaTotales(row): return alm = self.liMoves[row]["rec"] if not alm or len(alm.LIALMS) < 2: return menu = QTVarios.LCMenu(self) rondo = QTVarios.rondoPuntos() for ralm in alm.LIALMS: menu.opcion(ralm, Game.pv_pgn(None, ralm.PV), rondo.otro()) menu.separador() resp = menu.lanza() if resp: self.actualizaPV(resp.PV)
def player_has_moved(self, from_sq, to_sq, promotion=""): jgSel = self.check_human_move(from_sq, to_sq, promotion) if not jgSel: return False if self.is_guided: pvSel = jgSel.movimiento().lower() pvObj = self.li_pv[self.posPV] li = pvObj.split("-") if li[0] != pvSel: if pvSel in li: pgn = Game.pv_pgn(jgSel.position_before.fen(), pvObj) self.show_mens( _("You have selected one correct move, but the line use %s" ) % pgn) self.put_arrow_sc(pvObj[:2], pvObj[2:4]) self.ayuda(False) else: self.show_error(_("Wrong move")) self.warnings += 1 self.ponWarnings() self.sigueHumano() return False self.posPV += 1 else: fen = self.game.last_position.fen() pv = jgSel.movimiento().lower() b_wdl = self.t4.wdl(fen) m_wdl = self.t4.wdl_move(fen, pv) if b_wdl != m_wdl: self.show_error(_("Wrong move")) self.warnings += 1 self.ponWarnings() self.set_position(self.game.last_position) self.sigueHumano() return False self.move_the_pieces(jgSel.liMovs) self.add_move(jgSel, True) self.error = "" self.play_next_move() return True
def next_task(self): state, task = self.get_task() if state == PLAYING: opening, win = task pgn = Game.pv_pgn(None, opening.pv) litxt = [_("To play a complete game.")] if opening.label: litxt.append(_("With the opening: %s.") % _F(opening.label)) litxt.append(pgn) if win: litxt.append(_("You must win to pass this step.")) else: litxt.append(_("You don't need to win to pass this step.")) return "<br>".join(litxt), "#597272" elif state == ENDING: return _("You must solve an endgame puzzle"), "Brown" else: return _("You must solve tactics puzzles to advance."), "#807C6E"