def ponReloj(self): if (not self.siPrimeraJugadaHecha) or self.estado != kJugando: return def mira(siBlancas): ot = self.tiempo[siBlancas] eti, eti2 = ot.etiquetaDif2() if eti: if siBlancas: self.pantalla.ponRelojBlancas(eti, eti2) else: self.pantalla.ponRelojNegras(eti, eti2) if ot.siAgotado(): siJugador = self.siJugamosConBlancas == siBlancas self.ponResultado(kGanaRivalTiempo if siJugador else kGanamosTiempo) return False return True if VarGen.dgt: DGT.writeClocks(self.tiempo[True].etiquetaDGT(), self.tiempo[False].etiquetaDGT()) if self.siJuegaHumano: siBlancas = self.siJugamosConBlancas else: siBlancas = not self.siJugamosConBlancas mira(siBlancas)
def ponReloj(self): if (not self.siTiempo) or \ (not self.siPrimeraJugadaHecha) or \ self.estado != kJugando: return def mira(siBlancas): ot = self.tiempo[siBlancas] eti, eti2 = ot.etiquetaDif2() if eti: if siBlancas: self.pantalla.ponRelojBlancas(eti, eti2) else: self.pantalla.ponRelojNegras(eti, eti2) siJugador = self.siJugamosConBlancas == siBlancas if ot.siAgotado(): if siJugador and QTUtil2.pregunta( self.pantalla, _X(_("%1 has won on time."), self.xrival.nombre) + "\n\n" + _("Add time and keep playing?")): minX = PantallaEntMaq.dameMinutosExtra(self.pantalla) if minX: ot.ponSegExtra(minX * 60) return True self.ponResultado( kGanaRivalTiempo if siJugador else kGanamosTiempo) return False elif siJugador and ot.isZeitnot(): self.beepZeitnot() return True if VarGen.dgt: DGT.writeClocks(self.tiempo[True].etiquetaDGT(), self.tiempo[False].etiquetaDGT()) if self.siJuegaHumano: siBlancas = self.siJugamosConBlancas else: siBlancas = not self.siJugamosConBlancas mira(siBlancas)
def ponReloj(self): if (not self.siTiempo) or \ (not self.siPrimeraJugadaHecha) or \ self.estado != kJugando: return def mira(siBlancas): ot = self.tiempo[siBlancas] eti, eti2 = ot.etiquetaDif2() if eti: if siBlancas: self.pantalla.ponRelojBlancas(eti, eti2) else: self.pantalla.ponRelojNegras(eti, eti2) siJugador = self.siJugamosConBlancas == siBlancas if ot.siAgotado(): if siJugador and QTUtil2.pregunta(self.pantalla, _X(_("%1 has won on time."), self.xrival.nombre) + "\n\n" + _( "Add time and keep playing?")): minX = PantallaEntMaq.dameMinutosExtra(self.pantalla) if minX: ot.ponSegExtra(minX * 60) return True self.ponResultado(kGanaRivalTiempo if siJugador else kGanamosTiempo) return False elif siJugador and ot.isZeitnot(): self.beepZeitnot() return True if VarGen.dgt: DGT.writeClocks(self.tiempo[True].etiquetaDGT(), self.tiempo[False].etiquetaDGT()) if self.siJuegaHumano: siBlancas = self.siJugamosConBlancas else: siBlancas = not self.siJugamosConBlancas mira(siBlancas)
def set_clock(self): if self.state == ST_ENDGAME: self.main_window.stop_clock() return if self.state != ST_PLAYING: return if self.human_is_playing: if self.thoughtTt > -1 and self.is_analyzing: mrm = self.xtutor.ac_estado() if mrm: rm = mrm.mejorMov() if self.nArrowsTt > 0: self.showPV(rm.pv, self.nArrowsTt) self.show_dispatch(self.thoughtTt, rm) elif self.thoughtOp > -1: rm = self.xrival.current_rm() if rm: if self.nArrows: self.showPV(rm.pv, self.nArrows) self.show_dispatch(self.thoughtOp, rm) if not self.siTiempo: return def mira(xis_white): ot = self.vtime[xis_white] eti, eti2 = ot.etiquetaDif2() if eti: if xis_white: self.main_window.ponRelojBlancas(eti, eti2) else: self.main_window.ponRelojNegras(eti, eti2) siJugador = self.human_side == xis_white if ot.siAgotado(): if siJugador and QTUtil2.pregunta( self.main_window, _X(_("%1 has won on time."), self.xrival.name) + "\n\n" + _("Add time and keep playing?"), ): minX = WPlayAgainstEngine.dameMinutosExtra( self.main_window) if minX: ot.ponSegExtra(minX * 60) return self.game.set_termination( TERMINATION_WIN_ON_TIME, RESULT_WIN_BLACK if xis_white else RESULT_WIN_WHITE) self.state = ST_ENDGAME # necesario que esté antes de reloj_stop para no entrar en bucle self.reloj_stop(siJugador) self.muestra_resultado() return elif siJugador and ot.isZeitnot(): self.beepZeitnot() return if Code.dgt: DGT.writeClocks(self.vtime[True].etiquetaDGT(), self.vtime[False].etiquetaDGT()) if self.human_is_playing: is_white = self.human_side else: is_white = not self.human_side mira(is_white)
def opciones(parent, configuracion): separador = (None, None) # Datos generales liGen = [separador] # # Nombre del jugador liGen.append((_("Player's name") + ":", configuracion.jugador)) # # Estilo liGen.append((_("Window style") + ":", configuracion.estilos())) liTraducciones = configuracion.listaTraducciones() trActual = configuracion.traductor if configuracion.traductor else "en" li = [trActual] for k, trad, porc, author in liTraducciones: rotulo = "%s" % trad if int(porc) < 90: rotulo += " (%s%%)"%porc li.append((k, rotulo)) liGen.append((_("Language") + ":", li)) liGen.append(separador) liGen.append((_("Check for updates at startup") + ":", configuracion.checkforupdate)) # Engines liEng = [separador] liMedidas = [configuracion.centipawns, (True, "%s = 100 %s -> 64, 19, -19, +23, -120, +130" % (_("One pawn"), _("points"))), (False, "%s = 1.00 %s -> 0.64, 0.19, -0.19, +0.23, -1.20, +1.30" % (_("One pawn"), _("points")))] liEng.append((_("By showing scores from the engines") + ":", liMedidas)) liEng.append(separador) liEng.append((_("OS 64bits BMI2 compatible") + ":", configuracion.bmi2)) liEng.append(separador) liEng.append((_("Do not work in background when possible") + ":", configuracion.notbackground)) # Aspect liAsp = [] liAsp.append((_("By default") + ":", False)) liAsp.append(separador) ## font general liAsp.append((FormLayout.FontCombobox(_("Font")), configuracion.familia)) liAsp.append(separador) ## Menus liAsp.append((None, _("Menus") + ":")) liAsp.append((FormLayout.Spinbox(_("Font size"), 5, 64, 60), configuracion.puntosMenu)) liAsp.append((_("Bold") + ":", configuracion.boldMenu)) ## Toolbars liAsp.append(separador) liAsp.append((None, _("Toolbars") + ":")) liAsp.append((FormLayout.Spinbox(_("Font size"), 5, 64, 60), configuracion.puntosTB)) liAsp.append((_("Bold") + ":", configuracion.boldTB)) li = ( (_("Only display the icon"), QtCore.Qt.ToolButtonIconOnly), (_("Only display the text"), QtCore.Qt.ToolButtonTextOnly), (_("The text appears beside the icon"), QtCore.Qt.ToolButtonTextBesideIcon), (_("The text appears under the icon"), QtCore.Qt.ToolButtonTextUnderIcon) ) config = FormLayout.Combobox(_("Icons"), li) liAsp.append((config, configuracion.iconsTB)) ## PGN table liAsp.append(separador) liAsp.append((None, _("PGN table") + ":")) liAsp.append((FormLayout.Spinbox(_("Width"), 283, 1000, 70), configuracion.anchoPGN)) liAsp.append((FormLayout.Spinbox(_("Height of each row"), 18, 99, 40), configuracion.altoFilaPGN)) liAsp.append((FormLayout.Spinbox(_("Font size"), 10, 99, 40), configuracion.puntosPGN)) liAsp.append((_("PGN always in English") + ":", configuracion.siNomPiezasEN)) liAsp.append((_("PGN with figurines") + ":", configuracion.figurinesPGN)) liAsp.append(separador) liAsp.append((FormLayout.Spinbox(_("Font size of information labels"), 8, 30, 40), configuracion.tamFontRotulos)) # Sonidos liSon = [separador] liSon.append(separador) # Si a_adimos sonido tras cada jugada liSon.append((_("Beep after opponent's move") + ":", configuracion.siSuenaBeep)) liSon.append(separador) liSon.append((None, _("Sound on in") + ":")) liSon.append((_("Results") + ":", configuracion.siSuenaResultados)) liSon.append((_("Rival moves") + ":", configuracion.siSuenaJugada)) liSon.append(separador) liSon.append((_("Activate sounds with our moves") + ":", configuracion.siSuenaNuestro)) liSon.append(separador) # Tutor liTT = [separador] liTT.append((_("Engine") + ":", configuracion.ayudaCambioTutor())) liTT.append((_("Duration of tutor analysis (secs)") + ":", float(configuracion.tiempoTutor / 1000.0))) li = [(_("Maximum"), 0)] for x in (1, 3, 5, 10, 15, 20, 30, 40, 50, 75, 100, 150, 200): li.append((str(x), x)) config = FormLayout.Combobox(_("Number of moves evaluated by engine(MultiPV)"), li) liTT.append((config, configuracion.tutorMultiPV)) liTT.append(separador) liTT.append((_("Tutor enabled"), configuracion.tutorActivoPorDefecto)) liTT.append(separador) liTT.append((None, _("Sensitivity"))) liTT.append((FormLayout.Spinbox(_("Minimum difference in points"), 0, 1000, 70), configuracion.tutorDifPts)) liTT.append((FormLayout.Spinbox(_("Minimum difference in %"), 0, 1000, 70), configuracion.tutorDifPorc)) # Modo no competitivo liNC = [separador] liNC.append((FormLayout.Spinbox(_("Lucas-Elo"), 0, 3200, 70), configuracion.eloNC)) liNC.append((FormLayout.Spinbox(_("Tourney-Elo"), 0, 3200, 70), configuracion.micheloNC)) liNC.append((FormLayout.Spinbox(_("Fics-Elo"), 0, 3200, 70), configuracion.ficsNC)) liNC.append((FormLayout.Spinbox(_("Fide-Elo"), 0, 3200, 70), configuracion.fideNC)) # Salvado automatico liSA = [separador] config = FormLayout.Fichero(_("Autosave to a PGN file"), "pgn", True) liSA.append((config, configuracion.salvarFichero)) liSA.append((_("Won games") + ":", configuracion.salvarGanados)) liSA.append((_("Lost/Drawn games") + ":", configuracion.salvarPerdidos)) liSA.append((_("Unfinished games") + ":", configuracion.salvarAbandonados)) liSA.append(separador) liSA.append((_("Save as variant tutor's suggestion") + ":", configuracion.guardarVariantesTutor)) liSA.append(separador) config = FormLayout.Fichero(_("Autosave to a CSV file moves played"), "csv", True) liSA.append((config, configuracion.salvarCSV)) # Boards liT = [separador] # Mostrando el tutor # kTutorH, kTutorH2_1, kTutorH1_2, kTutorV liPosTutor = [configuracion.vistaTutor, (kTutorH, _("Horizontal")), (kTutorH2_1, _("Horizontal") + " 2+1"), (kTutorH1_2, _("Horizontal") + " 1+2"), (kTutorV, _("Vertical"))] liT.append((_("Tutor boards position") + ":", liPosTutor)) liT.append(separador) liT.append((_("Visual effects") + ":", configuracion.efectosVisuales)) drap = {1: 100, 2: 150, 3: 200, 4: 250, 5: 300, 6: 350, 7: 400, 8: 450, 9: 500} drapV = {} for x in drap: drapV[drap[x]] = x liT.append((FormLayout.Dial("%s (%s=1)" % (_("Speed"), _("Default")), 1, len(drap), siporc=False), drapV.get(configuracion.rapidezMovPiezas, 100))) liT.append(separador) liMouseSH = [configuracion.siAtajosRaton, (False, _("Type fixed: you must always indicate origin and destination")), (True, _("Type predictive: program tries to guess your intention"))] liT.append((_("Mouse shortcuts") + ":", liMouseSH)) liT.append((_("Show candidates") + ":", configuracion.showCandidates)) liT.append((_("Show arrows of variants") + ":", configuracion.showVariantes)) liT.append(separador) liT.append((_("Show cursor when engine is thinking") + ":", configuracion.cursorThinking)) liT.append(separador) liT.append((_("Enable captured material window by default") + ":", configuracion.siActivarCapturas)) liMat = [configuracion.tipoMaterial, ("D", _("Difference material")), ("C", _("Captured material at beginning")), ("M", _("Material advantage"))] liT.append((_("Show material") + ":", liMat)) liT.append(separador) liT.append((_("Enable information panel by default") + ":", configuracion.siActivarInformacion)) liT.append(separador) liT.append((_X(_("Enable %1"), _("DGT board")) + ":", configuracion.siDGT)) liT.append(separador) # liT.append((FormLayout.Dial(_("Opacity of tool icon"), 1, 9, siporc=False), configuracion.opacityToolBoard)) liT.append((_("Show configuration icon"), configuracion.opacityToolBoard > 6)) liPos = [configuracion.positionToolBoard, ("B", _("Bottom")), ("T", _("Top"))] liT.append((_("Configuration icon position" + ":"), liPos)) liT.append(separador) lista = [] lista.append((liGen, _("General"), "")) lista.append((liSon, _("Sounds"), "")) lista.append((liTT, _("Tutor"), "")) lista.append((liT, _("Boards"), "")) lista.append((liEng, _("Engines"), "")) lista.append((liAsp, _("Appearance"), "")) lista.append((liSA, _("Autosave"), "")) lista.append((liNC, _("Non competitive mode"), "")) # Editamos resultado = FormLayout.fedit(lista, title=_("Configuration"), parent=parent, anchoMinimo=640, icon=Iconos.Opciones()) if resultado: accion, resp = resultado liGen, liSon, liTT, liT, liEng, liAsp, liSA, liNC = resp (configuracion.jugador, configuracion.estilo, configuracion.traductor, configuracion.checkforupdate) = liGen porDefecto = liAsp[0] if porDefecto: liAsp = "", 11, False, 11, False, QtCore.Qt.ToolButtonTextUnderIcon, 283, 22, 10, False, True, 10 else: del liAsp[0] (configuracion.familia, configuracion.puntosMenu, configuracion.boldMenu, configuracion.puntosTB, configuracion.boldTB, configuracion.iconsTB, configuracion.anchoPGN, configuracion.altoFilaPGN, configuracion.puntosPGN, configuracion.siNomPiezasEN, configuracion.figurinesPGN, configuracion.tamFontRotulos) = liAsp if configuracion.familia == "System": configuracion.familia = "" (configuracion.siSuenaBeep, configuracion.siSuenaResultados, configuracion.siSuenaJugada, configuracion.siSuenaNuestro) = liSon (configuracion.tutor.clave, tiempoTutor, configuracion.tutorMultiPV, configuracion.tutorActivoPorDefecto, configuracion.tutorDifPts, configuracion.tutorDifPorc) = liTT configuracion.tiempoTutor = int(tiempoTutor * 1000) (configuracion.eloNC, configuracion.micheloNC, configuracion.ficsNC, configuracion.fideNC) = liNC (configuracion.centipawns, configuracion.bmi2, configuracion.notbackground) = liEng (configuracion.vistaTutor, configuracion.efectosVisuales, rapidezMovPiezas, configuracion.siAtajosRaton, configuracion.showCandidates, configuracion.showVariantes, configuracion.cursorThinking, configuracion.siActivarCapturas, configuracion.tipoMaterial, configuracion.siActivarInformacion, siDGT, toolIcon, configuracion.positionToolBoard) = liT configuracion.opacityToolBoard = 10 if toolIcon else 1 configuracion.rapidezMovPiezas = drap[rapidezMovPiezas] if configuracion.siDGT != siDGT: if siDGT: DGT.ponON() configuracion.siDGT = siDGT (configuracion.salvarFichero, configuracion.salvarGanados, configuracion.salvarPerdidos, configuracion.salvarAbandonados, configuracion.guardarVariantesTutor, configuracion.salvarCSV) = liSA configuracion.salvarCSV = Util.dirRelativo(configuracion.salvarCSV) return True else: return False
def procesosFinales(self): if Code.dgt: DGT.desactivar() self.board.cierraGuion() self.board.terminar()
def desactivarDGT(self): if Code.dgt: DGT.desactivar()
def opciones(parent, configuracion): form = FormLayout.FormLayout(parent, _("Configuration"), Iconos.Opciones(), anchoMinimo=640) # Datos generales ############################################################################################## form.separador() form.edit(_("Player's name"), configuracion.x_player) form.separador() form.combobox(_("Window style"), configuracion.estilos(), configuracion.x_style) form.separador() liTraducciones = configuracion.list_translations() trActual = configuracion.translator() li = [] for k, trad, porc, author in liTraducciones: rotulo = "%s" % trad if int(porc) < 90: rotulo += " (%s%%)" % porc li.append((rotulo, k)) form.combobox(_("Language"), li, trActual) form.separador() li = [ (_("Play against an engine"), MENU_PLAY_ANY_ENGINE), (_("Opponents for young players"), MENU_PLAY_YOUNG_PLAYERS), (_("Both"), MENU_PLAY_BOTH), ] form.combobox(_("Menu Play"), li, configuracion.x_menu_play) form.separador() form.checkbox(_("Check for updates at startup"), configuracion.x_check_for_update) form.add_tab(_("General")) # Sonidos ######################################################################################################## form.separador() form.checkbox(_("Beep after opponent's move"), configuracion.x_sound_beep) form.separador() form.apart(_("Sound on in")) form.checkbox(_("Results"), configuracion.x_sound_results) form.checkbox(_("Rival moves"), configuracion.x_sound_move) form.separador() form.checkbox(_("Activate sounds with our moves") + ":", configuracion.x_sound_our) form.add_tab(_("Sounds")) # Tutor ########################################################################################################## form.separador() form.combobox(_("Engine"), configuracion.listaCambioTutor(), configuracion.tutor.clave) form.float(_("Duration of tutor analysis (secs)"), float(configuracion.x_tutor_mstime / 1000.0)) form.spinbox(_("Depth"), 0, 40, 100, configuracion.x_tutor_depth) form.spinbox(_("Number of moves evaluated by engine(MultiPV)"), 0, 512, 100, configuracion.x_tutor_multipv) form.separador() form.checkbox(_("Tutor enabled"), configuracion.x_default_tutor_active) liPosTutor = [ (_("Horizontal"), POS_TUTOR_HORIZONTAL), (_("Horizontal") + " 2+1", POS_TUTOR_HORIZONTAL_2_1), (_("Horizontal") + " 1+2", POS_TUTOR_HORIZONTAL_1_2), (_("Vertical"), POS_TUTOR_VERTICAL), ] form.combobox(_("Tutor boards position"), liPosTutor, configuracion.x_tutor_view) form.separador() form.separador() form.apart(_("Sensitivity")) form.spinbox(_("Minimum difference in centipawns"), 0, 1000, 70, configuracion.x_tutor_difpoints) form.spinbox(_("Minimum difference in %"), 0, 1000, 70, configuracion.x_tutor_difporc) form.add_tab(_("Tutor")) # Engines ##################################################################################################### form.separador() form.checkbox(_("Work in the background, when possible"), not configuracion.x_engine_notbackground) form.separador() form.checkbox("%s -> %s:" % (_("Save engines log"), "UserData/EngineLogs"), configuracion.x_log_engines) form.separador() form.folder(_("Gaviota Tablebases"), configuracion.x_carpeta_gaviota, configuracion.carpeta_gaviota_defecto()) form.separador() form.add_tab(_("Engines")) # Boards ######################################################################################################### form.separador() form.checkbox(_("Visual effects"), configuracion.x_show_effects) drap = {1: 100, 2: 150, 3: 200, 4: 250, 5: 300, 6: 350, 7: 400, 8: 450, 9: 500} drapV = {} for x in drap: drapV[drap[x]] = x form.dial( "%s (%s=1)" % (_("Speed"), _("Default")), 1, len(drap), drapV.get(configuracion.x_pieces_speed, 100), siporc=False, ) form.separador() liMouseSH = [ (_("Type fixed: you must always indicate origin and destination"), False), (_("Type predictive: program tries to guess your intention"), True), ] form.combobox(_("Mouse shortcuts"), liMouseSH, configuracion.x_mouse_shortcuts) form.checkbox(_("Show candidates"), configuracion.x_show_candidates) form.checkbox(_("Always promote to queen\nALT key allows to change"), configuracion.x_autopromotion_q) form.checkbox(_("Show cursor when engine is thinking"), configuracion.x_cursor_thinking) form.separador() form.checkbox(_("Enable captured material window by default"), configuracion.x_captures_activate) # liMat = [ # (_("Difference material"), "D"), # (_("Captured material at beginning"), "C"), # (_("Material advantage"), "M"), # ] # form.combobox(_("Show material"), liMat, configuracion.x_capture_option) form.separador() form.checkbox(_("Enable information panel by default"), configuracion.x_info_activate) form.separador() liDB = [(_("None"), ""), (_("DGT"), "DGT"), (_("Novag UCB") + " - %s" % _("developed by Graham O'Neill"), "Novag UCB")] form.combobox(_("Digital board"), liDB, configuracion.x_digital_board) form.separador() form.checkbox(_("Show configuracion icon"), configuracion.x_opacity_tool_board > 6) liPos = [(_("Bottom"), "B"), (_("Top"), "T")] form.combobox(_("Configuration icon position"), liPos, configuracion.x_position_tool_board) form.separador() form.checkbox(_("Show icon when position has graphic information"), configuracion.x_director_icon) form.separador() form.checkbox(_("Live graphics with the right mouse button"), configuracion.x_direct_graphics) form.add_tab(_("Boards")) # Aspect ######################################################################################################## form.checkbox(_("By default"), False) form.separador() form.font(_("Font"), configuracion.x_font_family) form.apart(_("Menus")) form.spinbox(_("Font size"), 5, 64, 60, configuracion.x_menu_points) form.checkbox(_("Bold"), configuracion.x_menu_bold) form.separador() form.apart(_("Toolbars")) form.spinbox(_("Font size"), 5, 64, 60, configuracion.x_tb_fontpoints) form.checkbox(_("Bold"), configuracion.x_tb_bold) li = ( (_("Only display the icon"), QtCore.Qt.ToolButtonIconOnly), (_("Only display the text"), QtCore.Qt.ToolButtonTextOnly), (_("The text appears beside the icon"), QtCore.Qt.ToolButtonTextBesideIcon), (_("The text appears under the icon"), QtCore.Qt.ToolButtonTextUnderIcon), ) form.combobox(_("Icons"), li, configuracion.tipoIconos()) form.separador() form.apart(_("PGN table")) form.spinbox(_("Width"), 283, 1000, 70, configuracion.x_pgn_width) form.spinbox(_("Height of each row"), 18, 99, 70, configuracion.x_pgn_rowheight) form.spinbox(_("Font size"), 10, 99, 70, configuracion.x_pgn_fontpoints) form.checkbox(_("PGN always in English"), configuracion.x_pgn_english) form.checkbox(_("PGN with figurines"), configuracion.x_pgn_withfigurines) form.separador() form.spinbox(_("Font size of information labels"), 8, 30, 70, configuracion.x_sizefont_infolabels) form.add_tab(_("Appearance")) # Perfomance #################################################################################################### perf = configuracion.perfomance def d(num): return " (%s %d)" % (_("default"), num) form.separador() form.apart(_("Bad moves: lost points to consider a move as bad")) form.spinbox(_("Bad move") + d(90), 20, 1000, 60, perf.bad_lostp) form.spinbox(_("Very bad move") + d(200), 50, 1000, 60, perf.very_bad_lostp) form.separador() form.spinbox(_("Degree of effect of bad moves on the game elo") + d(2), 0, 5, 40, perf.bad_factor) form.separador() form.apart(_("Good moves: minimum depth required by the engine to discover the move")) form.spinbox(_("Good move") + d(3), 2, 20, 40, perf.good_depth) form.spinbox(_("Very good move") + d(6), 3, 20, 40, perf.very_good_depth) form.add_tab(_("Performance")) # Salvado automatico ############################################################################################# form.separador() form.file(_("Autosave to a PGN file"), "pgn", True, configuracion.pgn_folder()) form.checkbox(_("Won games"), configuracion.x_save_won) form.checkbox(_("Lost/Drawn games"), configuracion.x_save_lost) form.checkbox(_("Unfinished games"), configuracion.x_save_unfinished) form.separador() form.checkbox(_("Save as variation tutor's suggestion"), configuracion.x_save_tutor_variations) form.separador() form.file(_("Autosave to a CSV file moves played"), "csv", True, configuracion.x_save_csv) form.add_tab(_("Autosave")) # Modo no competitivo ############################################################################################ form.separador() form.spinbox(_("Lucas-Elo"), 0, 3200, 70, configuracion.x_elo) form.separador() form.spinbox(_("Tourney-Elo"), 0, 3200, 70, configuracion.x_michelo) form.separador() form.spinbox(_("Fics-Elo"), 0, 3200, 70, configuracion.x_fics) form.separador() form.spinbox(_("Fide-Elo"), 0, 3200, 70, configuracion.x_fide) form.separador() form.spinbox(_("Lichess-Elo"), 0, 3200, 70, configuracion.x_lichess) form.add_tab(_("Change elos")) resultado = form.run() if resultado: accion, resp = resultado liGen, liSon, liTT, liEng, liB, liAsp, liPR, liSA, liNC = resp ( configuracion.x_player, configuracion.x_style, translator, configuracion.x_menu_play, configuracion.x_check_for_update, ) = liGen configuracion.set_translator(translator) porDefecto = liAsp[0] if porDefecto: liAsp = "", 11, False, 11, False, QtCore.Qt.ToolButtonTextUnderIcon, 283, 22, 10, False, True, 10 else: del liAsp[0] ( configuracion.x_font_family, configuracion.x_menu_points, configuracion.x_menu_bold, configuracion.x_tb_fontpoints, configuracion.x_tb_bold, qt_iconstb, configuracion.x_pgn_width, configuracion.x_pgn_rowheight, configuracion.x_pgn_fontpoints, configuracion.x_pgn_english, configuracion.x_pgn_withfigurines, configuracion.x_sizefont_infolabels, ) = liAsp if configuracion.x_font_family == "System": configuracion.x_font_family = "" configuracion.set_tipoIconos(qt_iconstb) ( configuracion.x_sound_beep, configuracion.x_sound_results, configuracion.x_sound_move, configuracion.x_sound_our, ) = liSon ( configuracion.x_tutor_clave, tiempoTutor, configuracion.x_tutor_depth, configuracion.x_tutor_multipv, configuracion.x_default_tutor_active, configuracion.x_tutor_view, configuracion.x_tutor_difpoints, configuracion.x_tutor_difporc, ) = liTT configuracion.x_tutor_mstime = int(tiempoTutor * 1000) ( configuracion.x_elo, configuracion.x_michelo, configuracion.x_fics, configuracion.x_fide, configuracion.x_lichess, ) = liNC (workinbackground, configuracion.x_log_engines, configuracion.x_carpeta_gaviota) = liEng configuracion.x_engine_notbackground = not workinbackground ( configuracion.x_show_effects, rapidezMovPiezas, configuracion.x_mouse_shortcuts, configuracion.x_show_candidates, configuracion.x_autopromotion_q, configuracion.x_cursor_thinking, configuracion.x_captures_activate, # configuracion.x_capture_option, configuracion.x_info_activate, dboard, toolIcon, configuracion.x_position_tool_board, configuracion.x_director_icon, configuracion.x_direct_graphics, ) = liB configuracion.x_opacity_tool_board = 10 if toolIcon else 1 configuracion.x_pieces_speed = drap[rapidezMovPiezas] if configuracion.x_digital_board != dboard: if dboard: DGT.ponON() configuracion.x_digital_board = dboard perf.bad_lostp, perf.very_bad_lostp, perf.bad_factor, perf.good_depth, perf.very_good_depth = liPR perf.very_bad_factor = perf.bad_factor * 4 ( configuracion.x_save_pgn, configuracion.x_save_won, configuracion.x_save_lost, configuracion.x_save_unfinished, configuracion.x_save_tutor_variations, configuracion.x_save_csv, ) = liSA configuracion.x_save_csv = Util.dirRelativo(configuracion.x_save_csv) return True else: return False
def __init__(self, procesador, titulo, direct_option): QTVarios.WDialogo.__init__(self, procesador.main_window, titulo, Iconos.Libre(), "entMaquina") font = Controles.TipoLetra(puntos=procesador.configuration.x_menu_points) self.direct_option = direct_option self.setFont(font) self.configuration = procesador.configuration self.procesador = procesador self.personalidades = Personalities.Personalities(self, self.configuration) self.motores = SelectEngines.SelectEngines(self.configuration) fvar = self.configuration.file_books self.list_books = Books.ListBooks() self.list_books.restore_pickle(fvar) self.list_books.check() li_books = [(x.name, x) for x in self.list_books.lista] # Toolbar li_acciones = [ (_("Accept"), Iconos.Aceptar(), self.aceptar), None, (_("Cancel"), Iconos.Cancelar(), self.cancelar), None, (_("Configurations"), Iconos.Configurar(), self.configurations), None, ] tb = QTVarios.LCTB(self, li_acciones) # Tab tab = Controles.Tab() tab.dispatchChange(self.cambiada_tab) self.tab_advanced = 4 # está en la posición 4 self.tab_advanced_active = False # Para no tener que leer las options uci to_sq que no sean necesarias, afecta a gridNumDatos def nueva_tab(layout, titulo): ly = Colocacion.V() ly.otro(layout) ly.relleno() w = QtWidgets.QWidget(self) w.setLayout(ly) w.setFont(font) tab.nuevaTab(w, titulo) def nuevoG(): ly_g = Colocacion.G() ly_g.filaActual = 0 ly_g.margen(10) return ly_g gb_style = Common.gb_style() def _label(ly_g, txt, xlayout, rutinaCHB=None, siCheck: object = False): groupbox = Controles.GB(self, txt, xlayout) if rutinaCHB: groupbox.to_connect(rutinaCHB) elif siCheck: groupbox.setCheckable(True) groupbox.setChecked(False) groupbox.setStyleSheet(gb_style) groupbox.setMinimumWidth(640) groupbox.setFont(font) ly_g.controlc(groupbox, ly_g.filaActual, 0) ly_g.filaActual += 1 return groupbox # ################################################################################################################################## # TAB General # ################################################################################################################################## lyG = nuevoG() # # Motores # ## Rival self.rival = self.configuration.x_rival_inicial self.rivalTipo = SelectEngines.INTERNO self.btRival = Controles.PB(self, "", self.cambiaRival, plano=False).ponFuente(font).altoFijo(48) lbTiempoSegundosR = Controles.LB2P(self, _("Fixed time in seconds")).ponFuente(font) self.edRtiempo = Controles.ED(self).tipoFloat().anchoMaximo(50).ponFuente(font).capture_changes(self.change_time) bt_cancelar_tiempo = Controles.PB(self, "", rutina=self.cancelar_tiempo).ponIcono(Iconos.S_Cancelar()) ly_tiempo = Colocacion.H().control(self.edRtiempo).control(bt_cancelar_tiempo).relleno(1) lb_depth = Controles.LB2P(self, _("Fixed depth")).ponFuente(font) self.edRdepth = Controles.ED(self).tipoInt().anchoMaximo(50).ponFuente(font).capture_changes(self.change_depth) bt_cancelar_depth = Controles.PB(self, "", rutina=self.cancelar_depth).ponIcono(Iconos.S_Cancelar()) ly_depth = Colocacion.H().control(self.edRdepth).control(bt_cancelar_depth).relleno(1) ly = Colocacion.G() ly.controld(lbTiempoSegundosR, 0, 0).otro(ly_tiempo, 0, 1) ly.controld(lb_depth, 1, 0).otro(ly_depth, 1, 1) self.gb_thinks = Controles.GB(self, _("Limits of engine thinking"), ly) self.gb_thinks.setStyleSheet( """ QGroupBox { font: bold %d; background-color: #F2F2EC;/*qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);*/ border: 1px solid gray; border-radius: 3px; padding: 18px; margin-top: 5ex; /* leave space at the top for the title */ } QGroupBox::title { subcontrol-position: top center; /* position at the top center */ padding: 8px; border: 1px solid gray; } """ % procesador.configuration.x_menu_points ) lyV = Colocacion.V().espacio(20).control(self.btRival).espacio(20).control(self.gb_thinks) _label(lyG, _("Opponent"), lyV) # # Side self.rb_white = Controles.RB(self, "").activa() self.rb_white.setIcon(Iconos.PeonBlanco()) self.rb_white.setIconSize(QtCore.QSize(32, 32)) self.rb_black = Controles.RB(self, "") self.rb_black.setIcon(Iconos.PeonNegro()) self.rb_black.setIconSize(QtCore.QSize(32, 32)) self.rbRandom = Controles.RB(self, _("Random")) self.rbRandom.setFont(Controles.TipoLetra(puntos=14)) hbox = ( Colocacion.H().relleno().control(self.rb_white).espacio(30).control(self.rb_black).espacio(30).control(self.rbRandom).relleno() ) _label(lyG, _("Side you play with"), hbox) if self.configuration.x_digital_board: self.chb_dgt = Controles.CHB(self, "%s: %s" % (_("Activate board"), self.configuration.x_digital_board), DGT.siON()).ponFuente( Controles.TipoLetra(puntos=14) ) lyH = Colocacion.H().control(self.chb_dgt) _label(lyG, "", lyH) nueva_tab(lyG, _("Basic configuration")) # ################################################################################################################################## # TAB Ayudas # ################################################################################################################################## self.chbSummary = Controles.CHB(self, _("Save a summary when the game is finished in the main comment"), False).ponFuente(font) self.chbTakeback = Controles.CHB(self, _("Option takeback activated"), True).ponFuente(font) # # Tutor lbAyudas = Controles.LB2P(self, _("Available hints")).ponFuente(font) liAyudas = [(_("Maximum"), 999)] for i in range(1, 21): liAyudas.append((str(i), i)) for i in range(25, 51, 5): liAyudas.append((str(i), i)) self.cbAyudas = Controles.CB(self, liAyudas, 999).ponFuente(font) self.chbChance = Controles.CHB(self, _("Second chance"), True).ponFuente(font) btTutorChange = ( Controles.PB(self, _("Tutor change"), self.tutorChange, plano=False).ponIcono(Iconos.Tutor(), icon_size=16).ponFuente(font) ) liThinks = [(_("Nothing"), -1), (_("Score"), 0)] for i in range(1, 5): liThinks.append(("%d %s" % (i, _("ply") if i == 1 else _("plies")), i)) liThinks.append((_("All"), 9999)) lbThoughtTt = Controles.LB(self, _("It is showed") + ":").ponFuente(font) self.cbThoughtTt = Controles.CB(self, liThinks, -1).ponFuente(font) lbArrows = Controles.LB2P(self, _("Arrows with the best moves")).ponFuente(font) self.sbArrowsTt = Controles.SB(self, 0, 0, 999).tamMaximo(50).ponFuente(font) lyT1 = Colocacion.H().control(lbAyudas).control(self.cbAyudas).relleno() lyT1.control(self.chbChance).relleno().control(btTutorChange) lyT3 = Colocacion.H().control(lbThoughtTt).control(self.cbThoughtTt).relleno() lyT3.control(lbArrows).control(self.sbArrowsTt) ly = Colocacion.V().otro(lyT1).espacio(16).otro(lyT3).relleno() self.gbTutor = Controles.GB(self, _("Activate the tutor's help"), ly) self.gbTutor.setCheckable(True) self.gbTutor.setStyleSheet(gb_style) lb = Controles.LB(self, _("It is showed") + ":").ponFuente(font) self.cbThoughtOp = Controles.CB(self, liThinks, -1).ponFuente(font) lbArrows = Controles.LB2P(self, _("Arrows to show")).ponFuente(font) self.sbArrows = Controles.SB(self, 0, 0, 999).tamMaximo(50).ponFuente(font) ly = Colocacion.H().control(lb).control(self.cbThoughtOp).relleno() ly.control(lbArrows).control(self.sbArrows) gbThoughtOp = Controles.GB(self, _("Opponent's thought information"), ly) gbThoughtOp.setStyleSheet(gb_style) self.lbBoxHeight = Controles.LB2P(self, '%s ("%s")' % (_("Box height"), _("It is showed"))).ponFuente(font) self.sbBoxHeight = Controles.SB(self, 0, 0, 999).tamMaximo(50).ponFuente(font) lyBox = Colocacion.H().control(self.lbBoxHeight).control(self.sbBoxHeight).relleno() ly = Colocacion.V().espacio(16).control(self.gbTutor).control(gbThoughtOp) ly.espacio(16).otro(lyBox).control(self.chbSummary).control(self.chbTakeback).margen(6) nueva_tab(ly, _("Help configuration")) # ################################################################################################################################## # TAB Tiempo # ################################################################################################################################## lyG = nuevoG() self.lbMinutos = Controles.LB(self, _("Total minutes") + ":").ponFuente(font) self.edMinutos = Controles.ED(self).tipoFloat(10.0).ponFuente(font).anchoFijo(50) self.edSegundos, self.lbSegundos = QTUtil2.spinBoxLB( self, 6, -999, 999, maxTam=54, etiqueta=_("Seconds added per move"), fuente=font ) self.edMinExtra, self.lbMinExtra = QTUtil2.spinBoxLB( self, 0, -999, 999, maxTam=70, etiqueta=_("Extra minutes for the player"), fuente=font ) self.edZeitnot, self.lbZeitnot = QTUtil2.spinBoxLB( self, 0, -999, 999, maxTam=54, etiqueta=_("Zeitnot: alarm sounds when remaining seconds"), fuente=font ) lyH = Colocacion.H() lyH.control(self.lbMinutos).control(self.edMinutos).espacio(30) lyH.control(self.lbSegundos).control(self.edSegundos).relleno() lyH2 = Colocacion.H() lyH2.control(self.lbMinExtra).control(self.edMinExtra).relleno() lyH3 = Colocacion.H() lyH3.control(self.lbZeitnot).control(self.edZeitnot).relleno() ly = Colocacion.V().otro(lyH).otro(lyH2).otro(lyH3) self.chbTiempo = _label(lyG, _("Activate the time control"), ly, siCheck=True) nueva_tab(lyG, _("Time")) # ################################################################################################################################## # TAB Initial moves # ################################################################################################################################## lyG = nuevoG() # Posicion self.btPosicion = Controles.PB(self, " " * 5 + _("Change") + " " * 5, self.posicionEditar).ponPlano(False).ponFuente(font) self.fen = "" self.btPosicionQuitar = Controles.PB(self, "", self.posicionQuitar).ponIcono(Iconos.Motor_No()).ponFuente(font) self.btPosicionPegar = ( Controles.PB(self, "", self.posicionPegar).ponIcono(Iconos.Pegar16()).ponToolTip(_("Paste FEN position")) ).ponFuente(font) hbox = Colocacion.H().relleno().control(self.btPosicionQuitar).control(self.btPosicion).control(self.btPosicionPegar).relleno() _label(lyG, _("Start position"), hbox) # Openings self.btOpening = Controles.PB(self, " " * 5 + _("Undetermined") + " " * 5, self.editOpening).ponPlano(False).ponFuente(font) self.opening_block = None self.btOpeningsFavoritas = Controles.PB(self, "", self.preferred_openings).ponIcono(Iconos.Favoritos()) self.btOpeningsQuitar = Controles.PB(self, "", self.aperturasQuitar).ponIcono(Iconos.Motor_No()) hbox = Colocacion.H().relleno().control(self.btOpeningsQuitar).control(self.btOpening).control(self.btOpeningsFavoritas).relleno() _label(lyG, _("Opening"), hbox) # Libros libInicial = li_books[0][1] if li_books else None li_resp_book = [ (_("Selected by the player"), "su"), (_("Uniform random"), "au"), (_("Proportional random"), "ap"), (_("Always the highest percentage"), "mp"), ] ## Rival self.cbBooksR = QTUtil2.comboBoxLB(self, li_books, libInicial).ponFuente(font) self.btNuevoBookR = Controles.PB(self, "", self.nuevoBook, plano=True).ponIcono(Iconos.Mas(), icon_size=16) self.cbBooksRR = QTUtil2.comboBoxLB(self, li_resp_book, "mp").ponFuente(font) self.lbDepthBookR = Controles.LB2P(self, _("Max depth")).ponFuente(font) self.edDepthBookR = Controles.ED(self).ponFuente(font).tipoInt(0).anchoFijo(30) hbox = ( Colocacion.H() .control(self.cbBooksR) .control(self.btNuevoBookR) .relleno() .control(self.cbBooksRR) .relleno() .control(self.lbDepthBookR) .control(self.edDepthBookR) ) self.chbBookR = _label(lyG, "%s: %s" % (_("Activate book"), _("Opponent")), hbox, siCheck=True) ## Player self.cbBooksP = QTUtil2.comboBoxLB(self, li_books, libInicial).ponFuente(font) self.btNuevoBookP = Controles.PB(self, "", self.nuevoBook, plano=True).ponIcono(Iconos.Mas(), icon_size=16) self.lbDepthBookP = Controles.LB2P(self, _("Max depth")).ponFuente(font) self.edDepthBookP = Controles.ED(self).ponFuente(font).tipoInt(0).anchoFijo(30) hbox = ( Colocacion.H().control(self.cbBooksP).control(self.btNuevoBookP).relleno().control(self.lbDepthBookP).control(self.edDepthBookP) ) self.chbBookP = _label(lyG, "%s: %s" % (_("Activate book"), self.configuration.nom_player()), hbox, siCheck=True) nueva_tab(lyG, _("Initial moves")) # ################################################################################################################################## # TAB avanzada # ################################################################################################################################## lyG = nuevoG() liAjustes = self.personalidades.listaAjustes(True) self.cbAjustarRival = Controles.CB(self, liAjustes, ADJUST_BETTER).capture_changes(self.ajustesCambiado).ponFuente(font) lbAjustarRival = Controles.LB2P(self, _("Set strength")).ponFuente(font) self.btAjustarRival = ( Controles.PB(self, _("Personality"), self.cambiaPersonalidades, plano=True).ponIcono(Iconos.Mas(), icon_size=16).ponFuente(font) ) # ## Resign lbResign = Controles.LB2P(self, _("Resign/draw by engine")).ponFuente(font) liResign = ( (_("Very early"), -100), (_("Early"), -300), (_("Average"), -500), (_("Late"), -800), (_("Very late"), -1000), (_("Never"), -9999999), ) self.cbResign = Controles.CB(self, liResign, -800).ponFuente(font) self.lb_path_engine = Controles.LB(self, "").set_wrap() o_columns = Columnas.ListaColumnas() o_columns.nueva("OPTION", _("UCI option"), 240, centered=True) o_columns.nueva("VALUE", _("Value"), 200, centered=True, edicion=Delegados.MultiEditor(self)) self.grid_uci = Grid.Grid(self, o_columns, siEditable=True) self.grid_uci.ponFuente(font) self.register_grid(self.grid_uci) lyH2 = Colocacion.H().control(lbAjustarRival).control(self.cbAjustarRival).control(self.btAjustarRival).relleno() lyH3 = Colocacion.H().control(lbResign).control(self.cbResign).relleno() ly = Colocacion.V().otro(lyH2).otro(lyH3).espacio(16).control(self.lb_path_engine).control(self.grid_uci) _label(lyG, _("Opponent"), ly) nueva_tab(lyG, _("Advanced")) layout = Colocacion.V().control(tb).control(tab).relleno().margen(3) self.setLayout(layout) self.li_preferred_openings = [] self.btOpeningsFavoritas.hide() file = self.configuration.ficheroEntMaquina if self.direct_option else self.configuration.ficheroEntMaquinaPlay if not os.path.isfile(file): file = self.configuration.ficheroEntMaquina dic = Util.restore_pickle(file) if not dic: dic = {} self.restore_dic(dic) self.ajustesCambiado() # self.ayudasCambiado() self.ponRival() self.restore_video()
def options(parent, configuration): form = FormLayout.FormLayout(parent, _("Configuration"), Iconos.Opciones(), anchoMinimo=640) # Datos generales ############################################################################################## form.separador() form.edit(_("Player's name"), configuration.x_player) form.separador() form.combobox(_("Window style"), configuration.estilos(), configuration.x_style) form.separador() li_traducciones = configuration.list_translations() tr_actual = configuration.translator() li = [] for k, trad, porc, author in li_traducciones: label = "%s" % trad if int(porc) < 90: label += " (%s%%)" % porc li.append((label, k)) form.combobox(_("Language"), li, tr_actual) form.separador() li = [ (_("Play against an engine"), MENU_PLAY_ANY_ENGINE), (_("Opponents for young players"), MENU_PLAY_YOUNG_PLAYERS), (_("Both"), MENU_PLAY_BOTH), ] form.combobox(_("Menu Play"), li, configuration.x_menu_play) form.separador() if Code.is_windows: form.checkbox(_("Show the option to import from version 11"), configuration.x_show_version11) form.separador() form.checkbox(_("Check for updates at startup"), configuration.x_check_for_update) form.add_tab(_("General")) # Sonidos ######################################################################################################## form.separador() form.checkbox(_("Beep after opponent's move"), configuration.x_sound_beep) form.separador() form.apart(_("Sound on in")) form.checkbox(_("Results"), configuration.x_sound_results) form.checkbox(_("Rival moves"), configuration.x_sound_move) form.separador() form.checkbox(_("Activate sounds with our moves"), configuration.x_sound_our) form.add_tab(_("Sounds")) # Tutor ########################################################################################################## form.separador() form.combobox(_("Engine"), configuration.listaCambioTutor(), configuration.tutor.key) form.float(_("Duration of tutor analysis (secs)"), float(configuration.x_tutor_mstime / 1000.0)) form.spinbox(_("Depth"), 0, 40, 100, configuration.x_tutor_depth) form.spinbox(_("Number of moves evaluated by engine(MultiPV)"), 0, 512, 100, configuration.x_tutor_multipv) form.separador() form.checkbox(_("Disabled at the beginning of the game"), not configuration.x_default_tutor_active) li_pos_tutor = [ (_("Horizontal"), POS_TUTOR_HORIZONTAL), (_("Horizontal") + " 2+1", POS_TUTOR_HORIZONTAL_2_1), (_("Horizontal") + " 1+2", POS_TUTOR_HORIZONTAL_1_2), (_("Vertical"), POS_TUTOR_VERTICAL), ] form.combobox(_("Tutor boards position"), li_pos_tutor, configuration.x_tutor_view) form.separador() form.checkbox(_("Work in the background, when possible"), not configuration.x_engine_notbackground) form.separador() form.separador() form.apart(_("Sensitivity")) form.spinbox(_("Minimum difference in centipawns"), 0, 1000, 70, configuration.x_tutor_difpoints) form.spinbox(_("Minimum difference in %"), 0, 1000, 70, configuration.x_tutor_difporc) form.separador() form.separador() form.folder(_("Gaviota Tablebases"), configuration.x_carpeta_gaviota, configuration.carpeta_gaviota_defecto()) form.separador() form.add_tab(_("Tutor")) # Boards ######################################################################################################### form.separador() form.checkbox(_("Visual effects"), configuration.x_show_effects) drap = { 1: 100, 2: 150, 3: 200, 4: 250, 5: 300, 6: 350, 7: 400, 8: 450, 9: 500 } drap_v = {} for x in drap: drap_v[drap[x]] = x form.dial( "%s (%s=1)" % (_("Speed"), _("Default")), 1, len(drap), drap_v.get(configuration.x_pieces_speed, 100), siporc=False, ) form.separador() li_mouse_sh = [ (_("Type fixed: you must always indicate origin and destination"), False), (_("Type predictive: program tries to guess your intention"), True), ] form.combobox(_("Mouse shortcuts"), li_mouse_sh, configuration.x_mouse_shortcuts) form.checkbox(_("Show candidates"), configuration.x_show_candidates) form.checkbox(_("Always promote to queen\nALT key allows to change"), configuration.x_autopromotion_q) form.checkbox(_("Show cursor when engine is thinking"), configuration.x_cursor_thinking) form.separador() x = " - %s Graham O'Neill (https://goneill.co.nz)" % _("developed by") if Code.is_windows: li_db = [ (_("None"), ""), (_("DGT"), "DGT"), (_("DGT Alternate") + x, "DGT-gon"), (_("Certabo") + x, "Certabo"), (_("Millennium") + x, "Millennium"), (_("Novag Citrine") + x, "Citrine"), (_("Novag UCB") + x, "Novag UCB"), ] else: li_db = [ (_("None"), ""), (_("DGT") + x, "DGT-gon"), (_("Certabo") + x, "Certabo"), ("%s (%s) %s" % (_("Certabo"), _("Bluetooth"), x), "CertaboBT"), (_("Millennium") + x, "Millennium"), (_("Novag Citrine") + x, "Citrine"), (_("Novag UCB") + x, "Novag UCB"), ] form.combobox(_("Digital board"), li_db, configuration.x_digital_board) form.separador() form.checkbox(_("Show configuration icon"), configuration.x_opacity_tool_board > 6) li_pos = [(_("Bottom"), "B"), (_("Top"), "T")] form.combobox(_("Configuration icon position"), li_pos, configuration.x_position_tool_board) form.separador() form.checkbox(_("Show icon when position has graphic information"), configuration.x_director_icon) form.separador() form.checkbox(_("Live graphics with the right mouse button"), configuration.x_direct_graphics) form.add_tab(_("Boards")) # Aspect ######################################################################################################## form.checkbox(_("By default"), False) form.separador() form.font(_("Font"), configuration.x_font_family) form.apart(_("Menus")) form.spinbox(_("Font size"), 3, 64, 60, configuration.x_menu_points) form.checkbox(_("Bold"), configuration.x_menu_bold) form.separador() form.apart(_("Toolbars")) form.spinbox(_("Font size"), 3, 64, 60, configuration.x_tb_fontpoints) form.checkbox(_("Bold"), configuration.x_tb_bold) li = ( (_("Only display the icon"), QtCore.Qt.ToolButtonIconOnly), (_("Only display the text"), QtCore.Qt.ToolButtonTextOnly), (_("The text appears beside the icon"), QtCore.Qt.ToolButtonTextBesideIcon), (_("The text appears under the icon"), QtCore.Qt.ToolButtonTextUnderIcon), ) form.combobox(_("Icons"), li, configuration.tipoIconos()) form.separador() form.apart(_("PGN table")) form.spinbox(_("Width"), 283, 1000, 70, configuration.x_pgn_width) form.spinbox(_("Height of each row"), 18, 99, 70, configuration.x_pgn_rowheight) form.spinbox(_("Font size"), 3, 99, 70, configuration.x_pgn_fontpoints) form.checkbox(_("PGN always in English"), configuration.x_pgn_english) form.checkbox(_("PGN with figurines"), configuration.x_pgn_withfigurines) form.separador() form.checkbox(_("Enable captured material window by default"), configuration.x_captures_activate) form.checkbox(_("Enable information panel by default"), configuration.x_info_activate) form.separador() form.spinbox(_("Font size of information labels"), 3, 30, 70, configuration.x_sizefont_infolabels) form.add_tab(_("Appearance")) # Perfomance #################################################################################################### perf = configuration.perfomance def d(num): return " (%s %d)" % (_("default"), num) form.separador() form.apart(_("Bad moves: lost centipawns to consider a move as bad")) form.spinbox(_("Bad move") + d(90), 20, 1000, 60, perf.bad_lostp) form.spinbox( _("Very bad move") + d(200), 50, 1000, 60, perf.very_bad_lostp) form.separador() form.spinbox( _("Degree of effect of bad moves on the game elo") + d(2), 0, 5, 40, perf.bad_factor) form.separador() form.apart( _("Good moves: minimum depth required from the engine to discover the move" )) form.spinbox(_("Good move") + d(3), 2, 20, 40, perf.good_depth) form.spinbox(_("Very good move") + d(6), 3, 20, 40, perf.very_good_depth) form.add_tab(_("Performance")) # Modo no competitivo ############################################################################################ form.separador() form.spinbox(_("Lucas-Elo"), 0, 3200, 70, configuration.x_elo) form.separador() form.spinbox(_("Club players competition"), 0, 3200, 70, configuration.x_michelo) form.separador() form.spinbox(_("Fics-Elo"), 0, 3200, 70, configuration.x_fics) form.separador() form.spinbox(_("Fide-Elo"), 0, 3200, 70, configuration.x_fide) form.separador() form.spinbox(_("Lichess-Elo"), 0, 3200, 70, configuration.x_lichess) form.add_tab(_("Change elos")) resultado = form.run() if resultado: accion, resp = resultado li_gen, li_son, li_tt, li_b, li_asp, li_pr, li_nc = resp if Code.is_windows: ( configuration.x_player, configuration.x_style, translator, configuration.x_menu_play, configuration.x_show_version11, configuration.x_check_for_update, ) = li_gen else: ( configuration.x_player, configuration.x_style, translator, configuration.x_menu_play, configuration.x_check_for_update, ) = li_gen configuration.set_translator(translator) por_defecto = li_asp[0] if por_defecto: li_asp = ( "", 11, False, 11, False, QtCore.Qt.ToolButtonTextUnderIcon, 283, 22, 10, False, True, True, False, 10, ) else: del li_asp[0] ( configuration.x_font_family, configuration.x_menu_points, configuration.x_menu_bold, configuration.x_tb_fontpoints, configuration.x_tb_bold, qt_iconstb, configuration.x_pgn_width, configuration.x_pgn_rowheight, configuration.x_pgn_fontpoints, configuration.x_pgn_english, configuration.x_pgn_withfigurines, configuration.x_captures_activate, configuration.x_info_activate, configuration.x_sizefont_infolabels, ) = li_asp if configuration.x_font_family == "System": configuration.x_font_family = "" configuration.set_tipoIconos(qt_iconstb) ( configuration.x_sound_beep, configuration.x_sound_results, configuration.x_sound_move, configuration.x_sound_our, ) = li_son ( configuration.x_tutor_clave, tiempoTutor, configuration.x_tutor_depth, configuration.x_tutor_multipv, tutor_inactive, configuration.x_tutor_view, workinbackground, configuration.x_tutor_difpoints, configuration.x_tutor_difporc, configuration.x_carpeta_gaviota, ) = li_tt configuration.x_default_tutor_active = not tutor_inactive configuration.x_tutor_mstime = int(tiempoTutor * 1000) configuration.x_engine_notbackground = not workinbackground ( configuration.x_elo, configuration.x_michelo, configuration.x_fics, configuration.x_fide, configuration.x_lichess, ) = li_nc ( configuration.x_show_effects, rapidezMovPiezas, configuration.x_mouse_shortcuts, configuration.x_show_candidates, configuration.x_autopromotion_q, configuration.x_cursor_thinking, dboard, toolIcon, configuration.x_position_tool_board, configuration.x_director_icon, configuration.x_direct_graphics, ) = li_b configuration.x_opacity_tool_board = 10 if toolIcon else 1 configuration.x_pieces_speed = drap[rapidezMovPiezas] if configuration.x_digital_board != dboard: if dboard: if QTUtil2.pregunta( parent, "%s<br><br>%s %s" % ( _("Are you sure %s is the correct driver ?") % dboard, _("WARNING: selecting the wrong driver might cause damage to your board." ), _("Proceed at your own risk."), ), ): DGT.ponON() else: dboard = "" configuration.x_digital_board = dboard perf.bad_lostp, perf.very_bad_lostp, perf.bad_factor, perf.good_depth, perf.very_good_depth = li_pr perf.very_bad_factor = perf.bad_factor * 4 return True else: return False
def cierra(self): DGT.quitarDispatch() self.voiceDeactive()
def __init__(self, wParent, configuracion, fen): QtGui.QDialog.__init__(self, wParent) self.wParent = wParent self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint) self.configuracion = configuracion self.setWindowTitle(_("Position")) self.setWindowIcon(Iconos.Datos()) # Quien mueve self.rbBlancas = Controles.RB(self, _("White")) self.rbNegras = Controles.RB(self, _("Black")) # Enroques permitidos self.cbBoo = Controles.CHB(self, _("White") + " O-O", True) self.cbBooo = Controles.CHB(self, _("White") + " O-O-O", True) self.cbNoo = Controles.CHB(self, _("Black") + " O-O", True) self.cbNooo = Controles.CHB(self, _("Black") + " O-O-O", True) # Peon al paso lbAlPaso = Controles.LB(self, _("En passant") + ":") self.edAlPaso = Controles.ED(self).controlrx("(-|[a-h][36])").anchoFijo(30) # Medias jugadas desde ultimo mov. peon self.edMedias, lbMedias = QTUtil2.spinBoxLB(self, 0, 0, 999, etiqueta=_("Moves since the last pawn advance or capture"), maxTam=50) # Jugadas self.edJugadas, lbJugadas = QTUtil2.spinBoxLB(self, 1, 1, 999, etiqueta=_("Moves"), maxTam=50) # Botones adicionales btPosInicial = Controles.PB(self, _("Start position"), self.posInicial, plano=False) btLimpiaTablero = Controles.PB(self, _("Clear board"), self.limpiaTablero, plano=False) btPegar = Controles.PB(self, _("Paste FEN position"), self.pegarPosicion, plano=False) btCopiar = Controles.PB(self, _("Copy FEN position"), self.copiarPosicion, plano=False) btVoyager = Controles.PB(self, "", self.lanzaVoyager, plano=False).ponIcono(Iconos.Voyager()) self.btVoice = Controles.PB(self, "", self.voiceActive, plano=False).ponIcono(Iconos.S_Microfono()) self.btVoiceX = Controles.PB(self, "", self.voiceDeactive, plano=False).ponIcono(Iconos.X_Microfono()) # Tablero confTablero = configuracion.confTablero("POSICION", 24) self.posicion = ControlPosicion.ControlPosicion() if fen: self.posicion.leeFen(fen) else: self.posicion.posInicial() self.tablero = Tablero.PosTablero(self, confTablero) self.tablero.crea() self.tablero.ponMensajero(self.mueve) self.tablero.mensBorrar = self.borraCasilla self.tablero.mensCrear = self.creaCasilla self.tablero.mensRepetir = self.repitePieza self.ultimaPieza = "P" self.piezas = self.tablero.piezas self.resetPosicion() # Piezas drag-drop self.dragDropWI = QTVarios.ListaPiezas(self, "P;N;B;R;Q;K", self.tablero) self.dragDropWB = QTVarios.ListaPiezas(self, "P,N,B,R,Q,K", self.tablero) self.dragDropBD = QTVarios.ListaPiezas(self, "k;q;r;b;n;p", self.tablero) self.dragDropBA = QTVarios.ListaPiezas(self, "k,q,r,b,n,p", self.tablero) self.tablero.ponDispatchDrop(self.dispatchDrop) self.tablero.baseCasillasSC.setAcceptDrops(True) # Ayuda lbAyuda = Controles.LB(self, _( "<ul><li><b>Add piece</b> : Right mouse button on empty square</li><li><b>Copy piece</b> : Left mouse button on empty square</li><li><b>Move piece</b> : Drag and drop piece with left mouse button</li><li><b>Delete piece</b> : Right mouse button on occupied square</li></ul>")) # Tool bar tb = QTUtil2.tbAcceptCancel(self, siReject=False) # Layout # # Quien mueve hbox = Colocacion.H().relleno().control(self.rbBlancas).espacio(30).control(self.rbNegras).relleno() gbColor = Controles.GB(self, _("Next move"), hbox) # # Enroques ly = Colocacion.G().control(self.cbBoo, 0, 0).control(self.cbNoo, 0, 1) ly.control(self.cbBooo, 1, 0).control(self.cbNooo, 1, 1) gbEnroques = Controles.GB(self, _("Castling moves possible"), ly) ## Otros ly = Colocacion.G() ly.controld(lbMedias, 0, 0, 1, 3).control(self.edMedias, 0, 3) ly.controld(lbAlPaso, 1, 0).control(self.edAlPaso, 1, 1) ly.controld(lbJugadas, 1, 2).control(self.edJugadas, 1, 3) gbOtros = Controles.GB(self, "", ly) ## Botones adicionales lyBA = Colocacion.H().control(btPosInicial).control(btLimpiaTablero).control(btPegar).control(btCopiar).control( btVoyager) ## Ayuda ly = Colocacion.H().control(lbAyuda) gbAyuda = Controles.GB(self, _("Help"), ly) ## Izquierda ly = Colocacion.V().control(gbColor).relleno().control(gbEnroques).relleno() ly.control(gbOtros).relleno().control(gbAyuda).margen(5) lyI = Colocacion.V().control(tb).otro(ly).margen(3) ## Derecha lyBT = Colocacion.H().control(self.btVoice).control(self.btVoiceX) lyDA = Colocacion.G() lyDA.controlc(self.dragDropBA, 0, 1).otro(lyBT, 0, 2) lyDA.controld(self.dragDropWI, 1, 0).control(self.tablero, 1, 1).control(self.dragDropBD, 1, 2) lyDA.controlc(self.dragDropWB, 2, 1) lyD = Colocacion.V().otro(lyDA).otro(lyBA).relleno() ## Completo ly = Colocacion.H().otro(lyI).otro(lyD).margen(3) self.setLayout(ly) if configuracion.siDGT: if not DGT.activarSegunON_OFF(self.dgt): # Error QTUtil2.mensError(self, _("Error, could not detect the DGT board driver.")) self.ponCursor() self.voyager = None self.bufferVoice = "" self.queueVoice = [] self.isVoiceActive = False if not configuracion.voice: self.btVoiceX.setVisible(False) self.btVoice.setVisible(False) else: if Voice.runVoice.isActive(): self.voiceActive() else: self.voiceDeactive()
def opciones(parent, configuracion): separador = (None, None) # Datos generales liGen = [separador] # # Nombre del jugador liGen.append(( _("Player's name") + ":", configuracion.jugador )) # # Estilo liGen.append(( _("Window style") + ":", configuracion.estilos() )) liTraducciones = configuracion.listaTraducciones() trActual = configuracion.traductor if configuracion.traductor else "en" li = [trActual] for k, trad, porc in liTraducciones: rotulo = trad if porc != "100": rotulo += " (%s%%)"%porc li.append(( k, rotulo )) liGen.append(( _("Language") + ":", li )) liGen.append(separador) liGen.append(( None, _("By showing scores from the engines") + ":" )) liMedidas = [configuracion.centipawns, ( True, "%s = 100 %s -> 64, 19, -19, +23, -120, +130" % (_("One pawn"), _("points") ) ), \ ( False, "%s = 1.00 %s -> 0.64, 0.19, -0.19, +0.23, -1.20, +1.30" % (_("One pawn"), _("points") ) )] liGen.append((_("Measuring system") + ":", liMedidas)) # Aspect liAsp = [separador] liAsp.append(( _("By default") + ":", False )) liAsp.append(( FormLayout.FontCombobox(_("Font")), configuracion.familia )) ## Menus liAsp.append(( None, _("Menus") + ":" )) liAsp.append(( FormLayout.Spinbox(_("Font size"), 5, 64, 60), configuracion.puntosMenu )) liAsp.append(( _("Bold") + ":", configuracion.boldMenu )) ## Toolbars liAsp.append(separador) liAsp.append(( None, _("Toolbars") + ":" )) liAsp.append(( FormLayout.Spinbox(_("Font size"), 5, 64, 60), configuracion.puntosTB )) liAsp.append(( _("Bold") + ":", configuracion.boldTB )) ## PGN table liAsp.append(separador) liAsp.append(( None, _("PGN table") + ":" )) liAsp.append(( FormLayout.Spinbox(_("Width"), 283, 1000, 70), configuracion.anchoPGN )) liAsp.append(( FormLayout.Spinbox(_("Height of each row"), 18, 99, 40), configuracion.altoFilaPGN )) liAsp.append(( FormLayout.Spinbox(_("Font size"), 10, 99, 40), configuracion.puntosPGN )) liAsp.append(( _("PGN always in English") + ":", configuracion.siNomPiezasEN )) liAsp.append(( _("PGN with figurines") + ":", configuracion.figurinesPGN )) liAsp.append(separador) liAsp.append(( FormLayout.Spinbox(_("Font size of information labels"), 8, 30, 40), configuracion.tamFontRotulos )) # Sonidos liSon = [separador] liSon.append(separador) ## Si a_adimos sonido tras cada jugada liSon.append(( _("Beep after opponent's move") + ":", configuracion.siSuenaBeep )) liSon.append(separador) liSon.append(( None, _("Sound on in") + ":" )) liSon.append(( _("Results") + ":", configuracion.siSuenaResultados )) liSon.append(( _("Rival moves") + ":", configuracion.siSuenaJugada )) liSon.append(separador) liSon.append(( _("Activate sounds with our moves") + ":", configuracion.siSuenaNuestro )) liSon.append(separador) config = FormLayout.Combobox(_("Activate voice recognition"), configuracion.listVoices()) liSon.append(( config, configuracion.voice )) # Tutor liTT = [separador] liTT.append(( _("Engine") + ":", configuracion.ayudaCambioTutor() )) liTT.append(( _("Duration of tutor analysis (secs)") + ":", float(configuracion.tiempoTutor / 1000.0) )) li = [( _("Maximum"), 0)] for x in ( 1, 3, 5, 10, 15, 20, 30, 40, 50, 75, 100, 150, 200 ): li.append((str(x), x)) config = FormLayout.Combobox(_("Number of moves evaluated by engine(MultiPV)"), li) liTT.append(( config, configuracion.tutorMultiPV )) liTT.append(separador) liTT.append(( _("Tutor enabled"), configuracion.tutorActivoPorDefecto )) liTT.append(separador) liTT.append(( None, _("Sensitivity") )) liTT.append((FormLayout.Spinbox(_("Minimum difference in points"), 0, 1000, 70), configuracion.tutorDifPts )) liTT.append((FormLayout.Spinbox(_("Minimum difference in %"), 0, 1000, 70), configuracion.tutorDifPorc )) # Modo no competitivo liNC = [separador] liNC.append(( FormLayout.Spinbox(_("Lucas-Elo"), 0, 3200, 70), configuracion.eloNC )) liNC.append(( FormLayout.Spinbox(_("Tourney-Elo"), 0, 3200, 70), configuracion.micheloNC )) liNC.append(( FormLayout.Spinbox(_("Fics-Elo"), 0, 3200, 70), configuracion.ficsNC )) liNC.append(( FormLayout.Spinbox(_("Fide-Elo"), 0, 3200, 70), configuracion.fideNC )) # Salvado automatico liSA = [separador] config = FormLayout.Fichero(_("Autosave to a PGN file"), "pgn", True) liSA.append(( config, configuracion.salvarFichero)) liSA.append(( _("Won games") + ":", configuracion.salvarGanados )) liSA.append(( _("Lost/Drawn games") + ":", configuracion.salvarPerdidos )) liSA.append(( _("Unfinished games") + ":", configuracion.salvarAbandonados )) liSA.append(separador) liSA.append(( _("Save as variant tutor's suggestion") + ":", configuracion.guardarVariantesTutor )) liSA.append(separador) config = FormLayout.Fichero(_("Autosave to a CSV file moves played"), "csv", True) liSA.append(( config, configuracion.salvarCSV)) ## Tableros liT = [separador] ### Mostrando el tutor # kTutorH, kTutorH2_1, kTutorH1_2, kTutorV liPosTutor = [configuracion.vistaTutor, ( kTutorH, _("Horizontal")), \ ( kTutorH2_1, _("Horizontal") + " 2+1"), \ ( kTutorH1_2, _("Horizontal") + " 1+2"), \ ( kTutorV, _("Vertical") )] liT.append((_("Tutor boards position") + ":", liPosTutor)) liT.append(separador) liT.append((_("Visual effects") + ":", configuracion.efectosVisuales)) drap = {1: 100, 2: 150, 3: 200, 4: 250, 5: 300, 6: 350, 7: 400, 8: 450, 9: 500} drapV = {} for x in drap: drapV[drap[x]] = x liT.append((FormLayout.Dial("%s (%s=1)" % (_("Speed"), _("Default")), 1, len(drap), siporc=False), drapV.get(configuracion.rapidezMovPiezas, 100) )) liT.append(separador) liMouseSH = [configuracion.siAtajosRaton, ( False, _("Type fixed: you must always indicate origin and destination")), \ ( True, _("Type predictive: program tries to guess your intention"))] liT.append((_("Mouse shortcuts") + ":", liMouseSH)) liT.append((_("Show candidates") + ":", configuracion.showCandidates )) liT.append((_("Show arrows of variants") + ":", configuracion.showVariantes)) liT.append(separador) liT.append(( _("Enable captured material window by default") + ":", configuracion.siActivarCapturas )) liMat = [configuracion.tipoMaterial, ("D", _("Difference material")), ("C", _("Captured material at beginning"))] liT.append((_("Show material") + ":", liMat)) liT.append(separador) liT.append(( _("Enable information panel by default") + ":", configuracion.siActivarInformacion )) liT.append(separador) liT.append(( _X(_("Enable %1"), _("DGT board")) + ":", configuracion.siDGT )) lista = [] lista.append((liGen, _("General"), "" )) lista.append((liSon, _("Sounds"), "" )) lista.append((liTT, _("Tutor"), "" )) lista.append((liT, _("Boards"), "" )) lista.append((liAsp, _("Appearance"), "" )) lista.append((liSA, _("Autosave"), "" )) lista.append((liNC, _("Non competitive mode"), "")) # Editamos resultado = FormLayout.fedit(lista, title=_("Configuration"), parent=parent, anchoMinimo=560, icon=Iconos.Opciones()) if resultado: accion, resp = resultado liGen, liSon, liTT, liT, liAsp, liSA, liNC = resp configuracion.jugador, configuracion.estilo, configuracion.traductor, \ configuracion.centipawns = liGen porDefecto = liAsp[0] if porDefecto: liAsp = "", 11, False, 11, False, 283, 22, 10, False, True, 10 else: del liAsp[0] configuracion.familia, configuracion.puntosMenu, configuracion.boldMenu, \ configuracion.puntosTB, configuracion.boldTB, \ configuracion.anchoPGN, configuracion.altoFilaPGN, configuracion.puntosPGN, \ configuracion.siNomPiezasEN, configuracion.figurinesPGN, \ configuracion.tamFontRotulos = liAsp if configuracion.familia == "System": configuracion.familia = "" configuracion.siSuenaBeep, configuracion.siSuenaResultados, configuracion.siSuenaJugada, \ configuracion.siSuenaNuestro, configuracion.voice = liSon configuracion.tutor.clave, tiempoTutor, configuracion.tutorMultiPV, \ configuracion.tutorActivoPorDefecto, configuracion.tutorDifPts, configuracion.tutorDifPorc = liTT configuracion.tiempoTutor = int(tiempoTutor * 1000) configuracion.eloNC, configuracion.micheloNC, configuracion.ficsNC, configuracion.fideNC = liNC configuracion.vistaTutor, \ configuracion.efectosVisuales, rapidezMovPiezas, \ configuracion.siAtajosRaton, configuracion.showCandidates, configuracion.showVariantes, \ configuracion.siActivarCapturas, configuracion.tipoMaterial, \ configuracion.siActivarInformacion, siDGT = liT configuracion.rapidezMovPiezas = drap[rapidezMovPiezas] if configuracion.siDGT != siDGT: if siDGT: DGT.ponON() configuracion.siDGT = siDGT configuracion.salvarFichero, configuracion.salvarGanados, configuracion.salvarPerdidos, \ configuracion.salvarAbandonados, configuracion.guardarVariantesTutor, \ configuracion.salvarCSV = liSA configuracion.salvarCSV = Util.dirRelativo(configuracion.salvarCSV) return True else: return False
def __init__(self, wParent, configuracion, fen): QtGui.QDialog.__init__(self, wParent) self.wParent = wParent self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint) self.configuracion = configuracion self.setWindowTitle(_("Position")) self.setWindowIcon(Iconos.Datos()) # Quien mueve self.rbBlancas = Controles.RB(self, _("White")) self.rbNegras = Controles.RB(self, _("Black")) # Enroques permitidos self.cbBoo = Controles.CHB(self, _("White") + " O-O", True) self.cbBooo = Controles.CHB(self, _("White") + " O-O-O", True) self.cbNoo = Controles.CHB(self, _("Black") + " O-O", True) self.cbNooo = Controles.CHB(self, _("Black") + " O-O-O", True) # Peon al paso lbAlPaso = Controles.LB(self, _("En passant") + ":") self.edAlPaso = Controles.ED(self).controlrx( "(-|[a-h][36])").anchoFijo(30) # Medias jugadas desde ultimo mov. peon self.edMedias, lbMedias = QTUtil2.spinBoxLB( self, 0, 0, 999, etiqueta=_("Moves since the last pawn advance or capture"), maxTam=50) # Jugadas self.edJugadas, lbJugadas = QTUtil2.spinBoxLB(self, 1, 1, 999, etiqueta=_("Moves"), maxTam=50) # Botones adicionales btPosInicial = Controles.PB(self, _("Start position"), self.posInicial, plano=False) btLimpiaTablero = Controles.PB(self, _("Clear board"), self.limpiaTablero, plano=False) btPegar = Controles.PB(self, _("Paste FEN position"), self.pegarPosicion, plano=False) btCopiar = Controles.PB(self, _("Copy FEN position"), self.copiarPosicion, plano=False) btVoyager = Controles.PB(self, "", self.lanzaVoyager, plano=False).ponIcono(Iconos.Voyager()) self.btVoice = Controles.PB(self, "", self.voiceActive, plano=False).ponIcono(Iconos.S_Microfono()) self.btVoiceX = Controles.PB(self, "", self.voiceDeactive, plano=False).ponIcono( Iconos.X_Microfono()) # Tablero confTablero = configuracion.confTablero("POSICION", 24) self.posicion = ControlPosicion.ControlPosicion() if fen: self.posicion.leeFen(fen) else: self.posicion.posInicial() self.tablero = Tablero.PosTablero(self, confTablero) self.tablero.crea() self.tablero.ponMensajero(self.mueve) self.tablero.mensBorrar = self.borraCasilla self.tablero.mensCrear = self.creaCasilla self.tablero.mensRepetir = self.repitePieza self.ultimaPieza = "P" self.piezas = self.tablero.piezas self.resetPosicion() # Piezas drag-drop self.dragDropWI = QTVarios.ListaPiezas(self, "P;N;B;R;Q;K", self.tablero) self.dragDropWB = QTVarios.ListaPiezas(self, "P,N,B,R,Q,K", self.tablero) self.dragDropBD = QTVarios.ListaPiezas(self, "k;q;r;b;n;p", self.tablero) self.dragDropBA = QTVarios.ListaPiezas(self, "k,q,r,b,n,p", self.tablero) self.tablero.ponDispatchDrop(self.dispatchDrop) self.tablero.baseCasillasSC.setAcceptDrops(True) # Ayuda lbAyuda = Controles.LB( self, _("<ul><li><b>Add piece</b> : Right mouse button on empty square</li><li><b>Copy piece</b> : Left mouse button on empty square</li><li><b>Move piece</b> : Drag and drop piece with left mouse button</li><li><b>Delete piece</b> : Right mouse button on occupied square</li></ul>" )) # Tool bar tb = QTUtil2.tbAcceptCancel(self, siReject=False) # Layout # # Quien mueve hbox = Colocacion.H().relleno().control( self.rbBlancas).espacio(30).control(self.rbNegras).relleno() gbColor = Controles.GB(self, _("Next move"), hbox) # # Enroques ly = Colocacion.G().control(self.cbBoo, 0, 0).control(self.cbNoo, 0, 1) ly.control(self.cbBooo, 1, 0).control(self.cbNooo, 1, 1) gbEnroques = Controles.GB(self, _("Castling moves possible"), ly) ## Otros ly = Colocacion.G() ly.controld(lbMedias, 0, 0, 1, 3).control(self.edMedias, 0, 3) ly.controld(lbAlPaso, 1, 0).control(self.edAlPaso, 1, 1) ly.controld(lbJugadas, 1, 2).control(self.edJugadas, 1, 3) gbOtros = Controles.GB(self, "", ly) ## Botones adicionales lyBA = Colocacion.H().control(btPosInicial).control( btLimpiaTablero).control(btPegar).control(btCopiar).control( btVoyager) ## Ayuda ly = Colocacion.H().control(lbAyuda) gbAyuda = Controles.GB(self, _("Help"), ly) ## Izquierda ly = Colocacion.V().control(gbColor).relleno().control( gbEnroques).relleno() ly.control(gbOtros).relleno().control(gbAyuda).margen(5) lyI = Colocacion.V().control(tb).otro(ly).margen(3) ## Derecha lyBT = Colocacion.H().control(self.btVoice).control(self.btVoiceX) lyDA = Colocacion.G() lyDA.controlc(self.dragDropBA, 0, 1).otro(lyBT, 0, 2) lyDA.controld(self.dragDropWI, 1, 0).control(self.tablero, 1, 1).control(self.dragDropBD, 1, 2) lyDA.controlc(self.dragDropWB, 2, 1) lyD = Colocacion.V().otro(lyDA).otro(lyBA).relleno() ## Completo ly = Colocacion.H().otro(lyI).otro(lyD).margen(3) self.setLayout(ly) if configuracion.siDGT: if not DGT.activarSegunON_OFF(self.dgt): # Error QTUtil2.mensError( self, _("Error, could not detect the DGT board driver.")) self.ponCursor() self.voyager = None self.bufferVoice = "" self.queueVoice = [] self.isVoiceActive = False if not configuracion.voice: self.btVoiceX.setVisible(False) self.btVoice.setVisible(False) else: if Voice.runVoice.isActive(): self.voiceActive() else: self.voiceDeactive()