def save_dic(self): dic = {} # Básico dic["SIDE"] = "B" if self.rb_white.isChecked() else ("N" if self.rb_black.isChecked() else "R") dr = dic["RIVAL"] = {} dr["ENGINE"] = self.rival.key dr["TYPE"] = self.rivalTipo dr["ALIAS"] = self.rival.alias dr["LIUCI"] = self.rival.liUCI dr["ENGINE_TIME"] = int(self.edRtiempo.textoFloat() * 10) dr["ENGINE_DEPTH"] = self.edRdepth.textoInt() # Ayudas dic["HINTS"] = self.cbAyudas.valor() if self.gbTutor.isChecked() else 0 dic["ARROWS"] = self.sbArrows.valor() dic["BOXHEIGHT"] = self.sbBoxHeight.valor() dic["THOUGHTOP"] = self.cbThoughtOp.valor() dic["THOUGHTTT"] = self.cbThoughtTt.valor() dic["ARROWSTT"] = self.sbArrowsTt.valor() dic["2CHANCE"] = self.chbChance.isChecked() dic["SUMMARY"] = self.chbSummary.isChecked() dic["TAKEBACK"] = self.chbTakeback.isChecked() # Tiempo dic["WITHTIME"] = self.chbTiempo.isChecked() if dic["WITHTIME"]: dic["MINUTES"] = self.edMinutos.textoFloat() dic["SECONDS"] = self.edSegundos.value() dic["MINEXTRA"] = self.edMinExtra.value() dic["ZEITNOT"] = self.edZeitnot.value() # Mov. iniciales dic["OPENIGSFAVORITES"] = self.li_preferred_openings dic["OPENING"] = self.opening_block dic["FEN"] = self.fen is_book = self.chbBookR.isChecked() dic["BOOKR"] = self.cbBooksR.valor() if is_book else None dic["BOOKRR"] = self.cbBooksRR.valor() if is_book else None dic["BOOKRDEPTH"] = self.edDepthBookR.textoInt() if is_book else None is_book = self.chbBookP.isChecked() dic["BOOKP"] = self.cbBooksP.valor() if is_book else None dic["BOOKPDEPTH"] = self.edDepthBookP.textoInt() if is_book else None # Avanzado dic["ADJUST"] = self.cbAjustarRival.valor() dic["RESIGN"] = self.cbResign.valor() if self.configuration.x_digital_board: if self.chb_dgt.isChecked(): DGT.ponON() else: DGT.ponOFF() return dic
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 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 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 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