コード例 #1
0
def export_polyglot_config(owner, configuration, file_nom_def):
    dic = configuration.read_variables("POLYGLOT_EXPORT")
    form = FormLayout.FormLayout(owner,
                                 _("Export to"),
                                 Iconos.Export8(),
                                 anchoMinimo=440)
    form.separador()

    folder = dic.get("FOLDER", "")
    file_def = os.path.realpath(os.path.join(folder, file_nom_def))
    form.file(_("Polyglot book"), "bin", True, file_def)
    form.separador()
    form.checkbox(_("Uniform distribution"), dic.get("UNIFORM", False))
    form.separador()

    resultado = form.run()

    if not resultado:
        return None
    accion, resp = resultado
    path_bin, uniform = resp
    if not path_bin:
        return None

    path_bin = os.path.realpath(path_bin)
    dic["FOLDER"] = os.path.dirname(path_bin)
    dic["UNIFORM"] = uniform
    configuration.write_variables("POLYGLOT_EXPORT", dic)

    return path_bin, uniform
コード例 #2
0
    def configurations(self):
        dic_conf = self.configuracion.leeVariables(self.work)
        menu = QTVarios.LCMenu(self)
        submenu = menu.submenu(_("Save"), Iconos.ManualSave())
        submenu.opcion("save_name", _("Save with name"), Iconos.Grabar())
        submenu.separador()
        submenu.opcion("save_default", _("Save as default"), Iconos.Defecto())
        menu.separador()
        menu.opcion("reinit", _("Reinit"), Iconos.Reiniciar())
        menu.separador()
        if dic_conf:
            menu.setToolTip(
                _("To choose: <b>left button</b> <br>To erase: <b>right button</b>"
                  ))
            for name in dic_conf:
                menu.opcion(name, name, Iconos.PuntoAzul())

        resp = menu.lanza()
        if resp is None:
            return

        elif resp == "save_name":
            form = FormLayout.FormLayout(self,
                                         _("Name"),
                                         Iconos.Opciones(),
                                         anchoMinimo=240)
            form.separador()

            form.edit(_("Name"), "")

            resultado = form.run()
            if resultado:
                accion, resp = resultado
                name = resp[0].strip()
                if name:
                    dic_current = self.o_columnas.save_dic(self.grid_owner)
                    dic_conf[name] = dic_current
                    self.configuracion.escVariables(self.work, dic_conf)

        elif resp == "save_default":
            key = "databases_columns_default"
            dic_current = self.o_columnas.save_dic(self.grid_owner)
            self.configuracion.escVariables(key, dic_current)

        elif resp == "reinit":
            dic_current = self.o_columnas_base.save_dic(self.grid_owner)
            self.o_columnas.restore_dic(dic_current)
            self.o_columnas.liColumnas.sort(key=lambda x: x.position)
            self.grid.refresh()

        else:
            if menu.siDer:
                if QTUtil2.pregunta(self, _X(_("Delete %1?"), resp)):
                    del dic_conf[resp]
                    self.configuracion.escVariables(self.work, dic_conf)
            else:
                dic_current = dic_conf[resp]
                self.o_columnas.restore_dic(dic_current, self.grid_owner)
                self.o_columnas.liColumnas.sort(key=lambda x: x.position)
                self.grid.refresh()
コード例 #3
0
def paramPelicula(configuration, parent):

    nomVar = "PARAMPELICULA"
    dicVar = configuration.read_variables(nomVar)

    # Datos
    form = FormLayout.FormLayout(parent, _("Replay game"), Iconos.Pelicula(), anchoMinimo=460)
    form.separador()

    form.float(_("Number of seconds between moves"), dicVar.get("SECONDS", 2.0))
    form.separador()

    form.checkbox(_("Start from first move"), dicVar.get("START", True))
    form.separador()

    form.checkbox(_("Show PGN"), dicVar.get("PGN", True))
    form.separador()

    form.checkbox(_("Beep after each move"), dicVar.get("BEEP", False))
    form.separador()

    resultado = form.run()

    if resultado:
        accion, liResp = resultado

        segundos, if_start, if_pgn, if_beep = liResp
        dicVar["SECONDS"] = segundos
        dicVar["START"] = if_start
        dicVar["PGN"] = if_pgn
        dicVar["BEEP"] = if_beep
        configuration.write_variables(nomVar, dicVar)
        return segundos, if_start, if_pgn, if_beep
    else:
        return None
コード例 #4
0
ファイル: WEndingsGTB.py プロジェクト: xaizek/lucaschessR
    def configurar(self):
        dic_vars = self.configuracion.leeVariables("endingsGTB")

        form = FormLayout.FormLayout(self, _("Configuration"), Iconos.Finales())
        form.separador()

        li_options = ((_("Initial"), "initial"), (_("By difficulty"), "difficulty"), (_("Random"), "random"))
        order = dic_vars.get("ORDER", "initial")
        form.combobox(_("Order of positions"), li_options, order)
        form.separador()

        li_options = (
            (_("Stop"), PLAY_STOP),
            (_("Jump to the next"), PLAY_NEXT_SOLVED),
            (_("Jump to the next if minimum moves done"), PLAY_NEXT_BESTMOVES),
        )
        play_next = dic_vars.get("PLAY_NEXT", PLAY_STOP)
        form.combobox(_("What to do after solving"), li_options, play_next)
        form.separador()

        examples = dic_vars.get("EXAMPLES_AUTO", True)
        form.checkbox(_("Import examples automatically"), examples)
        form.separador()

        resp = form.run()
        if resp:
            accion, liResp = resp
            order, play_next, examples_auto = liResp
            dic_vars["PLAY_NEXT"] = self.play_next_type = play_next
            dic_vars["ORDER"] = order
            dic_vars["EXAMPLES_AUTO"] = examples_auto
            self.db.examples_auto = examples_auto
            self.configuracion.escVariables("endingsGTB", dic_vars)
コード例 #5
0
    def import_polyglot(self, game):
        list_books = Books.ListBooks()
        list_books.restore_pickle(self.configuration.file_books)
        list_books.check()

        dicData = self.dbop.getconfig("IMPORT_POLYGLOT")
        bookW = list_books.lista[0]
        bookB = list_books.lista[0]
        if dicData:
            book = list_books.buscaLibro(dicData["BOOKW"])
            if book:
                bookW = book
            book = list_books.buscaLibro(dicData["BOOKB"])
            if book:
                bookB = book

        form = FormLayout.FormLayout(self,
                                     _("Polyglot book"),
                                     Iconos.Libros(),
                                     anchoMinimo=360)
        form.separador()

        li = [(bookx.name, bookx) for bookx in list_books.lista]
        form.combobox(_("Book that plays white side"), li, bookW)
        form.separador()

        form.combobox(_("Book that plays black side"), li, bookB)
        form.separador()

        resultado = form.run()
        if resultado:
            accion, liResp = resultado
            bookW, bookB = liResp
            dicData = {"BOOKW": bookW.name, "BOOKB": bookB.name}
            self.dbop.setconfig("IMPORT_POLYGLOT", dicData)
        else:
            return

        bookW.polyglot()
        bookB.polyglot()

        titulo = bookW.name if bookW == bookB else "%s/%s" % (bookW.name,
                                                              bookB.name)
        dicData = self.import_param_books(titulo, True)
        if dicData:
            depth, siWhite, onlyone, minMoves, excl_transpositions = (
                dicData["DEPTH"], dicData["SIWHITE"], dicData["ONLYONE"],
                dicData["MINMOVES"], dicData["EXCLTRANSPOSITIONS"])
            self.dbop.import_polyglot(self, game, bookW, bookB, titulo, depth,
                                      siWhite, onlyone, minMoves,
                                      excl_transpositions)
            self.glines.refresh()
            self.glines.gotop()
コード例 #6
0
    def import_param_books(self, titulo, with_excltrans):
        dicData = self.dbop.getconfig("IMPORTAR_LEEPARAM")
        if not dicData:
            dicData = {}

        form = FormLayout.FormLayout(self,
                                     titulo,
                                     Iconos.Naranja(),
                                     anchoMinimo=360)
        form.separador()

        form.apart(
            _("Select a maximum number of moves (plies)<br> to consider from each game"
              ))
        form.spinbox(_("Depth"), 3, 99, 50, dicData.get("DEPTH", 30))
        form.separador()

        li = [(_("Only white best moves"), True),
              (_("Only black best moves"), False)]
        form.combobox(_("Moves"), li, dicData.get("SIWHITE", True))
        form.separador()

        li = [(_("Only one best move"), True), (_("All best moves"), False)]
        form.combobox(_("Best move"), li, dicData.get("ONLYONE", True))
        form.separador()

        form.spinbox(_("Minimum moves must have each line"), 0, 99, 50,
                     dicData.get("MINMOVES", 0))
        form.separador()

        if with_excltrans:
            form.checkbox(_("Exclude transpositions"),
                          dicData.get("EXCLTRANSPOSITIONS", True))

        resultado = form.run()
        if resultado:
            accion, liResp = resultado
            if with_excltrans:
                depth, siWhite, onlyone, minMoves, excltraspositions = liResp
                dicData["EXCLTRANSPOSITIONS"] = excltraspositions
            else:
                depth, siWhite, onlyone, minMoves = liResp
            dicData["DEPTH"] = depth
            dicData["SIWHITE"] = siWhite
            dicData["ONLYONE"] = onlyone
            dicData["MINMOVES"] = minMoves

            self.dbop.setconfig("IMPORTAR_LEEPARAM", dicData)
            self.configuration.write_variables("WBG_MOVES", dicData)
            return dicData
        return None
コード例 #7
0
def opcionesPrimeraVez(parent, configuracion):
    form = FormLayout.FormLayout(parent, _("Player"), Iconos.Usuarios(), anchoMinimo=460)
    form.separador()
    form.edit(_("Player's name"), configuracion.x_player)
    result = form.run()
    if result:
        accion, resp = result
        player = resp[0].strip()
        if not player:
            player = _("Player")
        configuracion.x_player = player
        return True
    else:
        return False
コード例 #8
0
    def importarPGN(self, game):
        previo = self.configuration.read_variables("OPENINGLINES")
        carpeta = previo.get("CARPETAPGN", "")

        fichero_pgn = QTUtil2.leeFichero(self,
                                         carpeta,
                                         "%s (*.pgn)" % _("PGN Format"),
                                         titulo=_("File to import"))
        if not fichero_pgn:
            return
        previo["CARPETAPGN"] = os.path.dirname(fichero_pgn)

        form = FormLayout.FormLayout(self,
                                     os.path.basename(fichero_pgn),
                                     Iconos.PGN_Importar(),
                                     anchoMinimo=460)
        form.separador()

        form.apart(
            _("Select a maximum number of moves (plies)<br> to consider from each game"
              ))

        form.spinbox(_("Depth"), 3, 999, 50, previo.get("IPGN_DEPTH", 30))
        form.separador()

        liVariations = ((_("All"), ALL), (_("None"), NONE),
                        (_("White"), ONLY_WHITE), (_("Black"), ONLY_BLACK))
        form.combobox(_("Include variations"), liVariations,
                      previo.get("IPGN_VARIATIONSMODE", "A"))
        form.separador()

        form.checkbox(_("Include comments"),
                      previo.get("IPGN_COMMENTS", False))
        form.separador()

        resultado = form.run()

        if resultado:
            accion, liResp = resultado
            previo["IPGN_DEPTH"] = depth = liResp[0]
            previo["IPGN_VARIATIONSMODE"] = variations = liResp[1]
            previo["IPGN_COMMENTS"] = comments = liResp[2]
            self.configuration.write_variables("OPENINGLINES", previo)

            self.dbop.importarPGN(self, game, fichero_pgn, depth, variations,
                                  comments)
            self.glines.refresh()
            self.glines.gotop()
コード例 #9
0
    def nuevo_engine(self):
        form = FormLayout.FormLayout(self,
                                     _("Kibitzer"),
                                     Iconos.Kibitzer(),
                                     anchoMinimo=340)

        form.edit(_("Name"), "")
        form.separador()

        form.combobox(_("Engine"), self.configuration.comboMotores(),
                      "stockfish")
        form.separador()

        liTipos = Kibitzers.Tipos().comboSinIndices()
        form.combobox(_("Type"), liTipos, Kibitzers.KIB_CANDIDATES)
        form.separador()

        form.combobox(_("Process priority"), Priorities.priorities.combo(),
                      Priorities.priorities.normal)
        form.separador()

        form.combobox(_("Point of view"), Kibitzers.cb_pointofview_options(),
                      Kibitzers.KIB_AFTER_MOVE)
        form.separador()

        resultado = form.run()

        if resultado:
            accion, resp = resultado

            name, engine, tipo, prioridad, pointofview = resp

            # Indexes only with Rodent II
            if tipo == "I":
                engine = "rodentII"
                if not name:  # para que no repita rodent II
                    name = _("Indexes") + " - RodentII"

            name = name.strip()
            if not name:
                for label, key in liTipos:
                    if key == tipo:
                        name = "%s: %s" % (label, engine)
            num = self.kibitzers.nuevo_engine(name, engine, tipo, prioridad,
                                              pointofview)
            self.goto(num)
コード例 #10
0
    def comment_edit(self):
        li_variation_move = self.selected_link.split("|")
        variation, var_move = self.det_variation_move(li_variation_move)
        previo = var_move.comment
        form = FormLayout.FormLayout(self, _("Comments"), Iconos.ComentarioEditar(), anchoMinimo=640)
        form.separador()

        config = FormLayout.Editbox(_("Comment"), alto=5)
        form.base(config, previo)

        resultado = form.run()

        if resultado:
            accion, resp = resultado
            comment = resp[0].strip()
            var_move.comment = comment
            self.link_variation_pressed(self.selected_link)
コード例 #11
0
ファイル: QTVarios.py プロジェクト: gamaBHC/lucaschessR
def change_interval(owner, configuration):
    form = FormLayout.FormLayout(owner,
                                 _("Replay game"),
                                 Iconos.Pelicula_Repetir(),
                                 anchoMinimo=250)
    form.separador()
    form.float(_("Duration of interval (secs)"),
               configuration.x_interval_replay / 1000)
    form.separador()
    resultado = form.run()
    if resultado is None:
        return None
    accion, liResp = resultado
    vtime = liResp[0]
    if vtime > 0.01:
        configuration.x_interval_replay = int(vtime * 1000)
        configuration.graba()
コード例 #12
0
def export_polyglot_config(owner, configuration, file_nom_def):
    dic = configuration.read_variables("POLYGLOT_EXPORT")
    form = FormLayout.FormLayout(owner,
                                 _("Export to"),
                                 Iconos.Export8(),
                                 anchoMinimo=440)
    form.separador()

    folder = dic.get("FOLDER", "")
    file_def = os.path.realpath(os.path.join(folder, file_nom_def))
    form.file(_("Polyglot book"), "bin", True, file_def)
    form.separador()
    form.checkbox(_("Uniform distribution"), dic.get("UNIFORM", False))
    form.separador()

    resultado = form.run()

    if not resultado:
        return None
    accion, resp = resultado
    path_bin, uniform = resp
    if not path_bin:
        return None

    dic["FOLDER"] = os.path.dirname(path_bin)
    dic["UNIFORM"] = uniform
    configuration.write_variables("POLYGLOT_EXPORT", dic)

    path_bin = os.path.realpath(path_bin)
    if Util.exist_file(path_bin):
        yn = QTUtil2.preguntaCancelar(
            owner,
            _X(_("The file %1 already exists, what do you want to do?"),
               os.path.basename(path_bin)),
            si=_("Overwrite"),
            no=_("Choose another"),
        )
        if yn is None:
            return
        if not yn:
            return export_polyglot_config(owner, configuration,
                                          os.path.basename(path_bin))

    return path_bin, uniform
コード例 #13
0
ファイル: WFactory.py プロジェクト: xaizek/lucaschessR
 def get_new_path(self, name):
     while True:
         form = FormLayout.FormLayout(self,
                                      _("New polyglot book"),
                                      Iconos.Book(),
                                      anchoMinimo=340)
         form.separador()
         form.filename(_("Name"), name)
         form.separador()
         resp = form.run()
         if resp:
             name = resp[1][0]
             path = os.path.join(
                 self.configuracion.folder_polyglots_factory(),
                 name + ".dbbin")
             if os.path.isfile(path):
                 QTUtil2.message_error(
                     self, "%s/n%s" % (_("This file already exists"), path))
             else:
                 return os.path.realpath(path)
         else:
             return None
コード例 #14
0
def create_tactics(procesador, wowner, li_registros, rutina_datos, name):

    form = FormLayout.FormLayout(wowner, _("Create tactics training"), Iconos.Tacticas())

    form.separador()
    form.edit(_("Name"), name)

    form.separador()
    li_j = [(_("Default"), 0), (_("White"), 1), (_("Black"), 2)]
    form.combobox(_("Point of view"), li_j, 0)

    resultado = form.run()

    if not resultado:
        return

    accion, li_gen = resultado

    menuname = li_gen[0].strip()
    if not menuname:
        return
    pointview = str(li_gen[1])

    rest_dir = Util.valid_filename(menuname)
    nom_dir = os.path.join(Code.configuration.folder_tactics(), rest_dir)
    nom_ini = os.path.join(nom_dir, "Config.ini")
    if os.path.isfile(nom_ini):
        dic_ini = Util.ini2dic(nom_ini)
        n = 1
        while True:
            if "TACTIC%d" % n in dic_ini:
                if "MENU" in dic_ini["TACTIC%d" % n]:
                    if dic_ini["TACTIC%d" % n]["MENU"].upper() == menuname.upper():
                        break
                else:
                    break
                n += 1
            else:
                break
        nom_tactic = "TACTIC%d" % n
    else:
        nom_dir_tac = Code.configuration.folder_tactics()
        Util.create_folder(nom_dir)
        nom_tactic = "TACTIC1"
        dic_ini = {}
    nom_fns = os.path.join(nom_dir, "Puzzles.fns")
    if os.path.isfile(nom_fns):
        n = 1
        nom_fns = os.path.join(nom_dir, "Puzzles-%d.fns")
        while os.path.isfile(nom_fns % n):
            n += 1
        nom_fns = nom_fns % n

    # Se crea el file con los puzzles
    f = open(nom_fns, "wt", encoding="utf-8", errors="ignore")

    nregs = len(li_registros)
    tmp_bp = QTUtil2.BarraProgreso(wowner, menuname, "%s: %d" % (_("Games"), nregs), nregs)
    tmp_bp.mostrar()

    fen0 = FEN_INITIAL

    t = time.time()

    for n in range(nregs):

        if tmp_bp.is_canceled():
            break

        tmp_bp.pon(n + 1)
        if time.time() - t > 1.0 or (nregs - n) < 10:
            tmp_bp.mensaje("%d/%d" % (n + 1, nregs))
            t = time.time()

        recno = li_registros[n]

        dic_valores = rutina_datos(recno)
        plies = dic_valores["PLIES"]
        if plies == 0:
            continue

        pgn = dic_valores["PGN"]
        li = pgn.split("\n")
        if len(li) == 1:
            li = pgn.split("\r")
        li = [linea for linea in li if not linea.strip().startswith("[")]
        num_moves = " ".join(li).replace("\r", "").replace("\n", "")
        if not num_moves.strip("*"):
            continue

        def xdic(k):
            x = dic_valores.get(k, "")
            if x is None:
                x = ""
            elif "?" in x:
                x = x.replace(".?", "").replace("?", "")
            return x.strip()

        fen = dic_valores.get("FEN")
        if not fen:
            fen = fen0

        event = xdic("EVENT")
        site = xdic("SITE")
        date = xdic("DATE")
        if site == event:
            es = event
        else:
            es = event + " " + site
        es = es.strip()
        if date:
            if es:
                es += " (%s)" % date
            else:
                es = date
        white = xdic("WHITE")
        black = xdic("BLACK")
        wb = ("%s-%s" % (white, black)).strip("-")
        titulo = ""
        if es:
            titulo += "<br>%s" % es
        if wb:
            titulo += "<br>%s" % wb

        for other in ("TASK", "SOURCE"):
            v = xdic(other)
            if v:
                titulo += "<br>%s" % v

        txt = fen + "|%s|%s\n" % (titulo, num_moves)

        f.write(txt)

    f.close()
    tmp_bp.cerrar()

    # Se crea el file de control
    dic_ini[nom_tactic] = d = {}
    d["MENU"] = menuname
    d["FILESW"] = "%s:100" % os.path.basename(nom_fns)
    d["POINTVIEW"] = pointview

    Util.dic2ini_base(nom_ini, dic_ini)

    QTUtil2.message_bold(
        wowner,
        (
            "%s<br>%s<br>  %s<br>    ➔%s<br>        ➔%s"
            % (
                _("Tactic training %s created.") % menuname,
                _("You can access this training from"),
                _("Trainings"),
                _("Learn tactics by repetition"),
                rest_dir,
            )
        ),
    )

    procesador.entrenamientos.rehaz()
コード例 #15
0
def import_polyglot_config(owner, configuration, titulo, with_collisions):
    dic = configuration.read_variables("POLYGLOT_IMPORT")

    form = FormLayout.FormLayout(owner,
                                 titulo,
                                 Iconos.Import8(),
                                 anchoMinimo=440)
    form.separador()

    form.spinbox(_("Maximum half moves (plies)"), 1, 999, 60,
                 dic.get("PLIES", 50))
    form.separador()

    li_options = (("%s + %s" % (_("White"), _("Black")), {True, False}),
                  (_("White"), {True}), (_("Black"), {False}))
    form.combobox(_("Side to include"), li_options,
                  dic.get("SIDE", {True, False}))
    form.separador()

    form.apart_simple(_("Include games when result is"))
    form.checkbox("1-0", dic.get("1-0", True))
    form.checkbox("0-1", dic.get("0-1", True))
    form.checkbox("1/2-1/2", dic.get("1/2-1/2", True))
    form.separador()
    li_options = ((_("Discard"), ""), ("1-0", "1-0"), ("0-1", "0-1"),
                  ("1/2-1/2", "1/2-1/2"))
    form.combobox("%s %s" % (_("Unknown result"), _("convert to")), li_options,
                  dic.get("*", ""))
    form.separador()

    form.spinbox(_("Minimum number of games"), 1, 999999, 50,
                 dic.get("MINGAMES", 5))
    form.spinbox(
        _("Minimum score") + " (0-100)", 0, 100, 50, dic.get("MINSCORE", 0))

    form.separador()
    li_options = (
        (_("Number of games"), CALCWEIGHT_NUMGAMES),
        (_("Number of games") + " * " + _("Score"), CALCWEIGHT_NUMGAMES_SCORE),
        (_("Score") + "% * 100", CALCWEIGHT_SCORE),
    )
    form.combobox(_("Calculation of the weight"), li_options,
                  dic.get("CALCWEIGHT", CALCWEIGHT_NUMGAMES))
    form.separador()
    form.checkbox(_("Save score"), dic.get("SAVESCORE", False))
    form.separador()

    if with_collisions:
        li_options = ((_("Replace"), "replace"), (_("Add"), "add"),
                      (_("Discard"), "discard"))
        form.combobox(_("What to do in case of collisions"), li_options,
                      dic.get("COLLISIONS", "replace"))

    resultado = form.run()

    if not resultado:
        return None
    accion, resp = resultado
    if with_collisions:
        plies, st_side, r1_0, r0_1, r1_1, ru, min_games, min_score, calc_weight, save_score, collisions = resp
    else:
        plies, st_side, r1_0, r0_1, r1_1, ru, min_games, min_score, calc_weight, save_score = resp
    if not (r1_0 or r0_1 or r1_1 or ru != ""):
        return None

    st_results = set()
    if r1_0:
        st_results.add(b"1-0")
    if r1_1:
        st_results.add(b"1/2-1/2")
    if r0_1:
        st_results.add(b"0-1")
    if ru != "":
        st_results.add(b"*")

    dic["PLIES"] = plies
    dic["SIDE"] = st_side
    dic["1-0"] = r1_0
    dic["0-1"] = r0_1
    dic["1/2-1/2"] = r1_1
    dic["*"] = ru
    dic["MINGAMES"] = min_games
    dic["MINSCORE"] = min_score
    dic["CALCWEIGHT"] = calc_weight
    dic["SAVESCORE"] = save_score
    configuration.write_variables("POLYGLOT_IMPORT", dic)

    if with_collisions:
        return plies, st_side, st_results, ru, min_games, min_score, calc_weight, save_score, collisions
    else:
        return plies, st_side, st_results, ru, min_games, min_score, calc_weight, save_score
コード例 #16
0
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
コード例 #17
0
    def gm_crear_queued(self):
        li_engines = self.torneo.list_engines()
        n_engines = len(li_engines)
        if n_engines < 2:
            QTUtil2.message_error(self,
                                  _("You must create at least two engines"))
            return

        dicValores = self.configuration.read_variables("crear_torneo")

        get = dicValores.get

        form = FormLayout.FormLayout(self, _("Games"), Iconos.Torneos())

        form.separador()
        form.spinbox(_("Rounds"), 1, 999, 50, get("ROUNDS", 1))

        form.separador()
        form.float(_("Total minutes"), get("MINUTES", 10.00))

        form.separador()
        form.float(_("Seconds added per move"), get("SECONDS", 0.0))

        form.add_tab(_("Options"))

        li_groups = Util.div_list(li_engines, 30)
        for ngroup, group in enumerate(li_groups):
            for en in group:
                form.checkbox(en.key, get(en.huella, True))
            form.add_tab(_("Engines"))

        resp = form.run()
        if resp is None:
            return

        accion, li_resp = resp

        options = li_resp[0]

        dicValores["ROUNDS"] = rounds = options[0]
        dicValores["MINUTES"] = minutos = options[1]
        dicValores["SECONDS"] = seconds = options[2]

        li_resp_engines = []
        for group in li_resp[1:]:
            li_resp_engines.extend(group)
        liSel = []
        for num in range(self.torneo.num_engines()):
            en = li_engines[num]
            dicValores[en.huella] = si = li_resp_engines[num]
            if si:
                liSel.append(en.huella)

        self.configuration.write_variables("crear_torneo", dicValores)

        nSel = len(liSel)
        if nSel < 2:
            QTUtil2.message_error(self, _("You must use at least two engines"))
            return

        for r in range(rounds):
            for x in range(nSel - 1):
                for y in range(x + 1, nSel):
                    self.torneo.nuevoGame(liSel[x], liSel[y], minutos, seconds)
                    self.torneo.nuevoGame(liSel[y], liSel[x], minutos, seconds)

        self.gridGamesQueued.refresh()
        self.gridGamesQueued.gobottom()
        self.rotulos_tabs()
コード例 #18
0
    def remove_worst(self):
        form = FormLayout.FormLayout(self, _("Remove worst lines"),
                                     Iconos.OpeningLines())
        form.separador()
        liJ = [(_("White"), "WHITE"), (_("Black"), "BLACK")]
        form.combobox(_("Side"), liJ, "WHITE")
        form.separador()

        list_books = Books.ListBooks()
        list_books.restore_pickle(self.configuration.file_books)
        list_books.check()
        libooks = [(bookx.name, bookx) for bookx in list_books.lista]
        libooks.insert(0, ("--", None))
        form.combobox(_("Book"), libooks, None)
        form.separador()

        form.float(_("Duration of engine analysis (secs)"),
                   float(self.configuration.x_tutor_mstime / 1000.0))
        form.separador()

        resultado = form.run()
        if resultado:
            color, book, segs = resultado[1]
            ms = int(segs * 1000)
            if ms == 0:
                return
            if book:
                book.polyglot()
            si_white = color == "WHITE"
            dic = self.dbop.dicRepeFen(si_white)
            mensaje = _("Move") + "  %d/" + str(len(dic))
            tmpBP = QTUtil2.BarraProgreso(self, _("Remove worst lines"), "",
                                          len(dic))

            xmanager = self.procesador.creaManagerMotor(
                self.configuration.tutor, ms, 0, siMultiPV=False)

            st_borrar = set()

            ok = True

            for n, fen in enumerate(dic, 1):
                if tmpBP.is_canceled():
                    ok = False
                    break

                tmpBP.inc()
                tmpBP.mensaje(mensaje % n)

                dic_a1h8 = dic[fen]
                st_a1h8 = set(dic_a1h8.keys())
                li = []
                if book:
                    li_moves = book.get_list_moves(fen)
                    if li_moves:
                        # (from_sq, to_sq, promotion, "%-5s -%7.02f%% -%7d" % (pgn, pc, w), 1.0 * w / maxim))
                        li = [(m[0] + m[1] + m[2], m[4]) for m in li_moves
                              if m[0] + m[1] + m[2] in st_a1h8]
                        if li:
                            li.sort(key=lambda x: x[1], reverse=True)
                            st_ya = set(x[0] for x in li)
                            for a1h8 in st_a1h8:
                                if a1h8 not in st_ya:
                                    li.append((a1h8, 0))

                if len(li) == 0:
                    mrm = xmanager.analiza(fen)
                    for a1h8 in dic_a1h8:
                        rm, pos = mrm.buscaRM(a1h8)
                        li.append((a1h8, pos))
                    li.sort(key=lambda x: x[1])

                for a1h8, pos in li[1:]:
                    for num_linea in dic_a1h8[a1h8]:
                        st_borrar.add(num_linea)

            tmpBP.cerrar()

            xmanager.terminar()

            if ok:
                li_borrar = list(st_borrar)
                n = len(li_borrar)
                if n:
                    self.dbop.removeLines(li_borrar, _("Remove worst lines"))
                    QTUtil2.message_bold(self, _("Removed %d lines") % n)
                else:
                    QTUtil2.message_bold(self, _("Done"))
コード例 #19
0
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