Exemplo n.º 1
0
    def __init__(self, wowner, configuration, path_lcbin):
        self.title = os.path.basename(path_lcbin)[:-6]
        QTVarios.WDialogo.__init__(self, wowner, self.title, Iconos.Book(), "polyglot")

        self.configuration = configuration
        self.path_lcbin = path_lcbin

        self.owner = wowner

        self.db_entries = DBPolyglot.DBPolyglot(path_lcbin)

        self.pol_import = PolyglotImportExports.PolyglotImport(self)
        self.pol_export = PolyglotImportExports.PolyglotExport(self)

        self.li_moves = []
        self.history = []

        conf_board = configuration.config_board("WPOLYGLOT", 48)
        self.board = Board.Board(self, conf_board)
        self.board.crea()
        self.board.set_dispatcher(self.mensajero)
        self.with_figurines = configuration.x_pgn_withfigurines

        o_columnas = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(True, siLineas=False) if self.configuration.x_pgn_withfigurines else None
        o_columnas.nueva("move", _("Move"), 80, centered=True, edicion=delegado, siEditable=False)
        o_columnas.nueva("%", "%", 60, siDerecha=True, siEditable=False)
        o_columnas.nueva("weight", _("Weight"), 60, siDerecha=True, edicion=Delegados.LineaTexto(siEntero=True))
        o_columnas.nueva("score", _("Score"), 60, siDerecha=True, edicion=Delegados.LineaTexto(siEntero=True))
        o_columnas.nueva("depth", _("Depth"), 60, siDerecha=True, edicion=Delegados.LineaTexto(siEntero=True))
        o_columnas.nueva("learn", _("Learn"), 60, siDerecha=True, edicion=Delegados.LineaTexto(siEntero=True))
        self.grid_moves = Grid.Grid(self, o_columnas, siEditable=True)
        self.grid_moves.setMinimumWidth(self.grid_moves.anchoColumnas() + 20)

        li_acciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar),
            None,
            (_("Takeback"), Iconos.Atras(), self.takeback),
            None,
            (_("Voyager"), Iconos.Voyager32(), self.voyager),
            None,
            (_("Import"), Iconos.Import8(), self.pol_import.importar),
            None,
            (_("Create book"), Iconos.BinBook(), self.pol_export.exportar),
            None,
        )
        self.tb = Controles.TBrutina(self, li_acciones)

        ly2 = Colocacion.V().control(self.tb).control(self.grid_moves)

        layout = Colocacion.H().control(self.board).otro(ly2)
        self.setLayout(layout)

        self.restore_video()

        self.position = None
        position = Position.Position()
        position.set_pos_initial()
        self.set_position(position, True)
Exemplo n.º 2
0
 def tw_utilities(self):
     menu = QTVarios.LCMenu(self)
     menu.opcion(self.tw_massive_analysis, _("Mass analysis"), Iconos.Analizar())
     menu.separador()
     menu.opcion(self.tw_polyglot, _("Create a polyglot book"), Iconos.Book())
     menu.separador()
     menu.opcion(self.tw_pack, _("Pack database"), Iconos.Pack())
     resp = menu.lanza()
     if resp:
         resp()
Exemplo n.º 3
0
    def nuevo(self):
        menu = QTVarios.LCMenu(self)
        menu.opcion(("engine", None), _("Engine"), Iconos.Motor())
        menu.separador()

        submenu = menu.submenu(_("Polyglot book"), Iconos.Book())
        list_books = Books.ListBooks()
        list_books.restore_pickle(self.configuration.file_books)
        list_books.check()
        rondo = QTVarios.rondoPuntos()
        for book in list_books.lista:
            submenu.opcion(("book", book), book.name, rondo.otro())
            submenu.separador()
        submenu.opcion(("installbook", None), _("Install new book"),
                       Iconos.Nuevo())
        menu.separador()

        si_gaviota = True
        si_index = True
        for kib in self.kibitzers.lista:
            if kib.tipo == Kibitzers.KIB_GAVIOTA:
                si_gaviota = False
            elif kib.tipo == Kibitzers.KIB_INDEXES:
                si_index = False
        if si_index:
            menu.opcion(("index", None),
                        _("Indexes") + " - RodentII", Iconos.Camara())
            menu.separador()
        if si_gaviota:
            menu.opcion(("gaviota", None), _("Gaviota Tablebases"),
                        Iconos.Finales())

        resp = menu.lanza()
        if resp:
            orden, extra = resp

            if orden == "engine":
                self.nuevo_engine()
            elif orden in "book":
                num = self.kibitzers.nuevo_polyglot(extra)
                self.goto(num)
            elif orden == "gaviota":
                num = self.kibitzers.nuevo_gaviota()
                self.goto(num)
            elif orden == "index":
                num = self.kibitzers.nuevo_index()
                self.goto(num)
            elif orden in "installbook":
                self.polyglot_install(list_books)
Exemplo n.º 4
0
    def __init__(self, cpu):
        WKibCommon.WKibCommon.__init__(self, cpu, Iconos.Book())

        self.book = Books.Book("P", cpu.kibitzer.name, cpu.kibitzer.path_exe,
                               True)
        self.book.polyglot()

        o_columns = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(
            True, siLineas=False) if self.with_figurines else None
        o_columns.nueva("MOVE", _("Move"), 80, centered=True, edicion=delegado)
        o_columns.nueva("PORC", "%", 60, centered=True)
        o_columns.nueva("WEIGHT", _("Weight"), 80, siDerecha=True)
        self.grid = Grid.Grid(self,
                              o_columns,
                              dicVideo=self.dicVideo,
                              siSelecFilas=True)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Takeback"), Iconos.pmKibitzer_Back(), self.takeback),
            (_("Manual position"), Iconos.Kibitzer_Voyager(),
             self.set_position),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")),
             Iconos.Kibitzer_Up(), self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")),
             Iconos.Kibitzer_Down(), self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.grid)
        layout = Colocacion.V().control(
            self.tb).espacio(-8).otro(ly1).margen(3)
        self.setLayout(layout)

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(500)

        self.restore_video(self.dicVideo)
        self.ponFlags()
Exemplo n.º 5
0
 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
Exemplo n.º 6
0
    def __init__(self, cpu):
        WKibCommon.WKibCommon.__init__(self, cpu, Iconos.Book())

        self.em = Controles.EM(self, siHTML=False).read_only()
        f = Controles.TipoLetra(name="Courier New", puntos=10)
        self.em.ponFuente(f)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.em).margen(3)
        layout = Colocacion.V().control(
            self.tb).espacio(-10).otro(ly1).margen(3)
        self.setLayout(layout)

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        self.restore_video(self.dicVideo)
        self.ponFlags()
Exemplo n.º 7
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.show_board = dicVideo.get("SHOW_BOARD", True)
        self.position = Position.Position()

        self.game = None
        self.siPlay = True
        self.li_moves = []
        self.history = []

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Book())

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuration = cpu.configuration

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuration.config_board(
            "kib" + cpu.kibitzer.huella, 24)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        self.board.set_dispatcher(self.mensajero)
        Delegados.generaPM(self.board.piezas)

        self.book = Books.Book("P", cpu.kibitzer.name, cpu.kibitzer.path_exe,
                               True)
        self.book.polyglot()

        self.with_figurines = cpu.configuration.x_pgn_withfigurines

        o_columns = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(
            True, siLineas=False) if self.with_figurines else None
        o_columns.nueva("MOVE", _("Move"), 80, centered=True, edicion=delegado)
        o_columns.nueva("PORC", "%", 60, centered=True)
        o_columns.nueva("WEIGHT", _("Weight"), 80, siDerecha=True)
        self.grid_moves = Grid.Grid(self,
                                    o_columns,
                                    dicVideo=dicVideo,
                                    siSelecFilas=True)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Takeback"), Iconos.pmKibitzer_Back(), self.takeback),
            (_("Manual position"), Iconos.Kibitzer_Voyager(),
             self.set_position),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.grid_moves)
        layout = Colocacion.V().control(
            self.tb).espacio(-8).otro(ly1).margen(3)
        self.setLayout(layout)

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(500)

        if not self.show_board:
            self.board.hide()
        self.restore_video(dicVideo)
        self.ponFlags()
Exemplo n.º 8
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.siShowTablero = dicVideo.get("SHOW_TABLERO", True)
        self.position = Position.Position()

        self.fen = ""
        self.almFEN = {}
        self.siPlay = True
        self.is_white = True
        self.siNegras = True

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Book())

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuracion = cpu.configuracion

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuracion.config_board(
            "kib" + cpu.kibitzer.huella, 24)
        self.tablero = Tablero.Tablero(self, config_board)
        self.tablero.crea()
        Delegados.generaPM(self.tablero.piezas)

        self.em = Controles.EM(self, siHTML=False).soloLectura()
        f = Controles.TipoLetra(name="Courier New", puntos=10)
        self.em.ponFuente(f)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Continuar(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause),
            (_("Board"), Iconos.Tablero(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     siTexto=False,
                                     tamIcon=16)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.tb)
        ly2 = Colocacion.V().otro(ly1).control(self.em)

        layout = Colocacion.H().control(self.tablero).otro(ly2)
        self.setLayout(layout)

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        if not self.siShowTablero:
            self.tablero.hide()
        self.restore_video(dicVideo)
        self.ponFlags()
Exemplo n.º 9
0
    def __init__(self, cpu):
        QtWidgets.QDialog.__init__(self)

        self.cpu = cpu

        self.kibitzer = cpu.kibitzer

        dicVideo = self.cpu.dic_video
        if not dicVideo:
            dicVideo = {}

        self.siTop = dicVideo.get("SITOP", True)
        self.show_board = dicVideo.get("SHOW_BOARD", True)
        self.position = Position.Position()

        self.game = None
        self.siPlay = True
        self.is_white = True
        self.is_black = True

        self.setWindowTitle(cpu.titulo)
        self.setWindowIcon(Iconos.Book())

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.setBackgroundRole(QtGui.QPalette.Light)

        Code.configuration = cpu.configuration

        Code.todasPiezas = Piezas.TodasPiezas()
        config_board = cpu.configuration.config_board(
            "kib" + cpu.kibitzer.huella, 24)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        Delegados.generaPM(self.board.piezas)

        self.em = Controles.EM(self, siHTML=False).read_only()
        f = Controles.TipoLetra(name="Courier New", puntos=10)
        self.em.ponFuente(f)

        li_acciones = (
            (_("Quit"), Iconos.Kibitzer_Close(), self.terminar),
            (_("Continue"), Iconos.Kibitzer_Play(), self.play),
            (_("Pause"), Iconos.Kibitzer_Pause(), self.pause),
            (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board),
            ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(),
             self.windowTop),
            ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(),
             self.windowBottom),
        )
        self.tb = Controles.TBrutina(self,
                                     li_acciones,
                                     with_text=False,
                                     icon_size=24)
        self.tb.setAccionVisible(self.play, False)

        ly1 = Colocacion.H().control(self.board).control(self.em).margen(3)
        layout = Colocacion.V().control(
            self.tb).espacio(-10).otro(ly1).margen(3)
        self.setLayout(layout)

        self.engine = self.lanzaMotor()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.cpu.compruebaInput)
        self.timer.start(200)

        if not self.show_board:
            self.board.hide()
        self.restore_video(dicVideo)
        self.ponFlags()
Exemplo n.º 10
0
def run_gui(procesador):
    app = QtWidgets.QApplication([])

    # Usuarios
    list_users = Usuarios.Usuarios().list_users
    if len(list_users) > 1:
        main_config = Configuration.Configuration("")
        main_config.releeTRA()

        user = pide_usuario(list_users)
        if user == list_users[0]:
            user = None
    else:
        user = None

    procesador.start_with_user(user)
    configuration = procesador.configuration
    if user:
        if not configuration.x_player:
            configuration.x_player = user.name
            configuration.graba()
        elif configuration.x_player != user.name:
            for usu in list_users:
                if usu.number == user.number:
                    usu.name = configuration.x_player
                    Usuarios.Usuarios().save_list(list_users)

    # Comprobamos el lenguaje
    if not configuration.x_translator:
        if user:
            conf_main = Configuration.Configuration("")
            configuration.x_translator = conf_main.x_translator
            configuration.start()
            configuration.limpia(user.name)
            configuration.set_folders()
            configuration.graba()

        else:
            li = configuration.list_translations()

            li_info = locale.getdefaultlocale()
            lng_default = "en"
            name_default = "English"
            if len(li_info) == 2:
                lng = li_info[0][:2]
                for k, name, porc, author in li:
                    if k == lng:
                        name_default = name
                        lng_default = lng

            menu = QTVarios.LCMenuRondo(None)
            menu.opcion(None, "Select your language", icono=Iconos.Book())
            menu.separador()
            menu.opcion(lng_default,
                        "By default: %s" % name_default,
                        icono=Iconos.AceptarPeque())
            menu.separador()

            font_metrics = QtGui.QFontMetrics(menu.font())
            space_width = font_metrics.width(" ")

            mx = 0
            d_with = {}
            for k, name, porc, author in li:
                if porc < 95:
                    name += " (%d%%)" % porc
                name_with = font_metrics.width(name)
                d_with[k] = name, name_with
                if name_with > mx:
                    mx = name_with
            mx += space_width * 2

            for k, name, porc, author in li:
                name, name_with = d_with[k]
                resto = mx - name_with
                name += " " * (resto // space_width) + "by %s" % author
                if k == lng_default:
                    menu.opcion(k, name, icono=Iconos.AceptarPeque())
                else:
                    menu.opcion(k, name)
            menu.separador()
            resp = menu.lanza()
            if resp:
                lng = resp
            else:
                lng = lng_default
            configuration.set_translator(lng)
            configuration.graba()
            configuration.releeTRA()

    # Estilo
    # https://github.com/gmarull/qtmodern/blob/master/qtmodern/styles.py
    # https://stackoverflow.com/questions/15035767/is-the-qt-5-dark-fusion-theme-available-for-windows
    # darkPalette.setColor(QPalette.Window, QColor(53, 53, 53))
    # darkPalette.setColor(QPalette.WindowText, QColor(180, 180, 180))
    # darkPalette.setColor(QPalette.Base, QColor(42, 42, 42))
    # darkPalette.setColor(QPalette.Text, QColor(180, 180, 180))
    # darkPalette.setColor(QPalette.AlternateBase, QColor(66, 66, 66))
    # darkPalette.setColor(QPalette.ToolTipBase, QColor(53, 53, 53))
    # darkPalette.setColor(QPalette.ToolTipText, QColor(180, 180, 180))
    # darkPalette.setColor(QPalette.Button, QColor(53, 53, 53))
    # darkPalette.setColor(QPalette.ButtonText, QColor(180, 180, 180))
    # darkPalette.setColor(QPalette.BrightText, QColor(180, 180, 180))
    # darkPalette.setColor(QPalette.Link, QColor(56, 252, 196))
    #
    # darkPalette.setColor(QPalette.Light, QColor(180, 180, 180))
    # darkPalette.setColor(QPalette.Midlight, QColor(90, 90, 90))
    # darkPalette.setColor(QPalette.Dark, QColor(35, 35, 35))
    # darkPalette.setColor(QPalette.Shadow, QColor(20, 20, 20))
    # darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218))
    # darkPalette.setColor(QPalette.HighlightedText, QColor(180, 180, 180))
    #
    # # disabled
    # darkPalette.setColor(QPalette.Disabled, QPalette.WindowText,
    #                      QColor(127, 127, 127))
    # darkPalette.setColor(QPalette.Disabled, QPalette.Text,
    #                      QColor(127, 127, 127))
    # darkPalette.setColor(QPalette.Disabled, QPalette.ButtonText,
    #                      QColor(127, 127, 127))
    # darkPalette.setColor(QPalette.Disabled, QPalette.Highlight,
    #                      QColor(80, 80, 80))
    # darkPalette.setColor(QPalette.Disabled, QPalette.HighlightedText,
    #                      QColor(127, 127, 127))
    app.setStyle(QtWidgets.QStyleFactory.create(configuration.x_style))

    if configuration.palette:
        qpalette = QtGui.QPalette()
        palette = configuration.palette
        # palette = palette_dark = {'Window': '#353535', 'WindowText': '#b4b4b4', 'Base': '#2a2a2a', 'Text': '#b4b4b4', 'AlternateBase': '#424242',
        #  'ToolTipBase': '#353535', 'ToolTipText': '#b4b4b4', 'Button': '#353535', 'ButtonText': '#b4b4b4', 'BrightText': '#b4b4b4',
        #  'Link': '#38fcc4'}

        for key, tp in (
            (QtGui.QPalette.Window, "Window"),
            (QtGui.QPalette.WindowText, "WindowText"),
            (QtGui.QPalette.Base, "Base"),
            (QtGui.QPalette.Text, "Text"),
            (QtGui.QPalette.AlternateBase, "AlternateBase"),
            (QtGui.QPalette.ToolTipBase, "ToolTipBase"),
            (QtGui.QPalette.ToolTipText, "ToolTipText"),
            (QtGui.QPalette.Button, "Button"),
            (QtGui.QPalette.ButtonText, "ButtonText"),
            (QtGui.QPalette.BrightText, "BrightText"),
            (QtGui.QPalette.Link, "Link"),
        ):
            qpalette.setColor(key, QtGui.QColor(palette[tp]))
    else:
        qpalette = QtWidgets.QApplication.style().standardPalette()

    app.setPalette(qpalette)

    app.setEffectEnabled(QtCore.Qt.UI_AnimateMenu)

    QtGui.QFontDatabase.addApplicationFont(
        Code.path_resource("IntFiles", "ChessAlpha2.ttf"))

    if configuration.x_font_family:
        font = Controles.TipoLetra(configuration.x_font_family)
        app.setFont(font)

    Code.gc = QTUtil.GarbageCollector()

    procesador.iniciar_gui()

    resp = app.exec_()

    return resp
Exemplo n.º 11
0
    def __init__(self, wowner, configuracion, path_dbbin):
        title = os.path.basename(path_dbbin)[:-6]
        QTVarios.WDialogo.__init__(self, wowner, title, Iconos.Book(),
                                   "polyglot")

        self.configuracion = configuracion
        self.path_dbbin = path_dbbin
        self.path_mkbin = self.path_dbbin[:-6] + ".mkbin"

        self.owner = wowner
        self.key = None
        self.key_str10 = None

        self.db_entries = UtilSQL.DictSQL(self.path_dbbin)
        if Util.filesize(self.path_mkbin) < 0:
            f = open(self.path_mkbin, "wb")
            f.close()
        self.pol_mkbin = FasterCode.Polyglot(self.path_mkbin)

        self.li_moves = []
        self.history = []

        self.pol_imports = PolyglotImports.PolyglotImports(self)

        conf_tablero = configuracion.config_board("WPOLYGLOT", 48)
        self.tablero = Tablero.Tablero(self, conf_tablero)
        self.tablero.crea()
        self.tablero.set_dispatcher(self.mensajero)
        self.siFigurines = configuracion.x_pgn_withfigurines

        o_columnas = Columnas.ListaColumnas()
        delegado = Delegados.EtiquetaPOS(
            True,
            siLineas=False) if self.configuracion.x_pgn_withfigurines else None
        o_columnas.nueva("move",
                         _("Move"),
                         80,
                         centered=True,
                         edicion=delegado,
                         siEditable=False)
        o_columnas.nueva("%", "%", 60, siDerecha=True, siEditable=False)
        o_columnas.nueva("weight",
                         _("weight"),
                         60,
                         siDerecha=True,
                         edicion=Delegados.LineaTexto(siEntero=True))
        o_columnas.nueva("score",
                         _("Score"),
                         60,
                         siDerecha=True,
                         edicion=Delegados.LineaTexto(siEntero=True))
        o_columnas.nueva("depth",
                         _("Depth"),
                         60,
                         siDerecha=True,
                         edicion=Delegados.LineaTexto(siEntero=True))
        o_columnas.nueva("learn",
                         _("Learn"),
                         60,
                         siDerecha=True,
                         edicion=Delegados.LineaTexto(siEntero=True))
        self.grid_moves = Grid.Grid(self, o_columnas, siEditable=True)
        self.grid_moves.setMinimumWidth(self.grid_moves.anchoColumnas() + 20)

        li_acciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar),
            None,
            (_("Takeback"), Iconos.Atras(), self.takeback),
            None,
            (_("Voyager"), Iconos.Voyager(), self.voyager),
            None,
            (_("Import"), Iconos.Import8(), self.pol_imports.importar),
            None,
            (_("Export"), Iconos.Export8(), self.pol_imports.exportar),
            None,
        )
        self.tb = Controles.TBrutina(self, li_acciones)

        ly2 = Colocacion.V().control(self.tb).control(self.grid_moves)

        layout = Colocacion.H().control(self.tablero).otro(ly2)
        self.setLayout(layout)

        self.restore_video()

        self.position = None
        position = Position.Position()
        position.set_pos_initial()
        self.set_position(position, True)