def __init__(self, tabsAnalisis, book, configuration): QtWidgets.QWidget.__init__(self) self.tabsAnalisis = tabsAnalisis self.position = None self.leido = False self.book = book book.polyglot() self.li_moves = [] self.with_figurines = configuration.x_pgn_withfigurines o_columns = Columnas.ListaColumnas() delegado = Delegados.EtiquetaPOS( True, siLineas=False) if self.with_figurines else None for x in range(20): o_columns.nueva(x, "", 80, centered=True, edicion=delegado) self.grid_moves = Grid.Grid(self, o_columns, siSelecFilas=True, siCabeceraMovible=False, siCabeceraVisible=False) self.grid_moves.tipoLetra(puntos=configuration.x_pgn_fontpoints) self.grid_moves.ponAltoFila(configuration.x_pgn_rowheight) ly = Colocacion.V().control(self.grid_moves).margen(3) self.setLayout(ly)
def __init__(self, tabsanalisis, book, configuracion): QtGui.QWidget.__init__(self) self.tabsanalisis = tabsanalisis self.posicion = None self.leido = False self.book = book book.polyglot() self.li_moves = [] self.siFigurines = configuracion.figurinesPGN oColumnas = Columnas.ListaColumnas() delegado = Delegados.EtiquetaPOS( True, siLineas=False) if self.siFigurines else None for x in range(20): oColumnas.nueva(x, "", 80, siCentrado=True, edicion=delegado) self.grid_moves = Grid.Grid(self, oColumnas, siSelecFilas=True, siCabeceraMovible=False, siCabeceraVisible=False) self.grid_moves.tipoLetra(puntos=configuracion.puntosPGN) self.grid_moves.ponAltoFila(configuracion.altoFilaPGN) ly = Colocacion.V().control(self.grid_moves).margen(3) self.setLayout(ly)
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)
def __init__(self, tabsAnalisis, procesador, configuracion): QtWidgets.QWidget.__init__(self) self.analyzing = False self.position = None self.li_analysis = [] self.gestor_motor = None self.current_mrm = None self.dbop = tabsAnalisis.dbop self.procesador = procesador self.configuracion = configuracion self.siFigurines = configuracion.x_pgn_withfigurines self.tabsAnalisis = tabsAnalisis self.bt_start = Controles.PB(self, "", self.start).ponIcono(Iconos.Pelicula_Seguir(), 32) self.bt_stop = Controles.PB(self, "", self.stop).ponIcono(Iconos.Pelicula_Pausa(), 32) self.bt_stop.hide() self.lb_engine = Controles.LB(self, _("Engine") + ":") liMotores = configuracion.comboMotores() # (name, key) default = configuracion.tutor.clave engine = self.dbop.getconfig("ENGINE", default) if len([key for name, key in liMotores if key == engine]) == 0: engine = default self.cb_engine = Controles.CB(self, liMotores, engine).capturaCambiado(self.reset_motor) multipv = self.dbop.getconfig("ENGINE_MULTIPV", 10) lb_multipv = Controles.LB(self, _("Multi PV") + ": ") self.sb_multipv = Controles.SB(self, multipv, 1, 500).tamMaximo(50) self.lb_analisis = ( Controles.LB(self, "").ponFondoN("#C9D2D7").ponTipoLetra(puntos=configuracion.x_pgn_fontpoints) ) o_columns = Columnas.ListaColumnas() o_columns.nueva("PDT", _("Evaluation"), 120, centered=True) delegado = Delegados.EtiquetaPOS(True, siLineas=False) if self.siFigurines else None o_columns.nueva("SOL", "", 100, centered=True, edicion=delegado) o_columns.nueva("PGN", _("Solution"), 860) self.grid_analysis = Grid.Grid(self, o_columns, siSelecFilas=True, siCabeceraVisible=False) self.grid_analysis.tipoLetra(puntos=configuracion.x_pgn_fontpoints) self.grid_analysis.ponAltoFila(configuracion.x_pgn_rowheight) # self.register_grid(self.grid_analysis) ly_lin1 = Colocacion.H().control(self.bt_start).control(self.bt_stop).control(self.lb_engine) ly_lin1.control(self.cb_engine) ly_lin1.espacio(50).control(lb_multipv).control(self.sb_multipv).relleno() ly = Colocacion.V().otro(ly_lin1).control(self.lb_analisis).control(self.grid_analysis).margen(3) self.setLayout(ly) self.reset_motor()
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()
def __init__(self, procesador, dbop): self.dbop = dbop title = dbop.gettitle() QTVarios.WDialogo.__init__(self, procesador.pantalla, title, Iconos.OpeningLines(), "studyOpening") self.procesador = procesador self.configuracion = procesador.configuracion self.partidabase = self.dbop.getpartidabase() self.num_jg_inicial = self.partidabase.numJugadas() self.num_jg_actual = None self.partida = None self.resultado = None siFigurinesPGN = self.configuracion.figurinesPGN liAcciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Import"), Iconos.Mezclar(), self.importar), None, (_("Utilities"), Iconos.Utilidades(), self.utilidades), None, (_("Train"), Iconos.Study(), self.train), None, ) self.tb = Controles.TBrutina(self, liAcciones) oColumnas = Columnas.ListaColumnas() oColumnas.nueva("LINE", _("Line"), 35, edicion=Delegados.EtiquetaPOS(False, True)) inicio = self.partidabase.numJugadas() / 2 + 1 ancho_col = ((self.configuracion.anchoPGN - 35 - 20) / 2) * 80 // 100 for x in range(inicio, 75): oColumnas.nueva(str(x), str(x), ancho_col, edicion=Delegados.EtiquetaPOS( siFigurinesPGN, True)) self.glines = Grid.Grid(self, oColumnas, siCabeceraMovible=False) self.glines.setAlternatingRowColors(False) self.glines.tipoLetra(puntos=self.configuracion.puntosPGN) self.glines.ponAltoFila(self.configuracion.altoFilaPGN) self.pboard = POLBoard.BoardLines(self, self.configuracion) self.tabsanalisis = POLAnalisis.TabsAnalisis(self, self.procesador, self.configuracion) splitter = QtGui.QSplitter(self) splitter.setOrientation(QtCore.Qt.Vertical) splitter.addWidget(self.glines) splitter.addWidget(self.tabsanalisis) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) splitter.setSizePolicy(sp) self.registrarSplitter(splitter, "SPLITTER") lyLV = Colocacion.V().control(splitter) lyTB = Colocacion.V().control(self.tb).control(self.pboard) layout = Colocacion.H().otro(lyTB).otro(lyLV).margen(3) self.setLayout(layout) self.colorPar = QTUtil.qtColor("#DBDAD9") self.colorNon = QTUtil.qtColor("#F1EFE9") self.colorLine = QTUtil.qtColor("#CDCCCB") self.partida = self.partidabase self.pboard.MoverFinal() self.recuperarVideo()
def __init__(self, procesador, winBookGuide, dbGames): QtGui.QWidget.__init__(self) self.winBookGuide = winBookGuide self.procesador = procesador self.data = [[], [], [], []] self.movesWhite = [] self.movesBlack = [] self.lastFilterMoves = {"white": "", "black": ""} self.configuracion = procesador.configuracion self.infoMove = None # <-- setInfoMove self.ap = AperturasStd.ap self.gridOpeningWhite = self.gridOpeningBlack = self.gridMovesWhite = self.gridMovesBlack = 0 # GridOpening ancho = 54 oColumnas = Columnas.ListaColumnas() oColumnas.nueva("opening", _("Opening"), 200) oColumnas.nueva("games", _("Games"), ancho, siDerecha=True) oColumnas.nueva("pgames", "% " + _("Games"), 70, siDerecha=True) oColumnas.nueva("win", _("Win"), ancho, siDerecha=True) oColumnas.nueva("draw", _("Draw"), ancho, siDerecha=True) oColumnas.nueva("lost", _("Loss"), ancho, siDerecha=True) oColumnas.nueva("pwin", "% " + _("Win"), ancho, siDerecha=True) oColumnas.nueva("pdraw", "% " + _("Draw"), ancho, siDerecha=True) oColumnas.nueva("plost", "% " + _("Loss"), ancho, siDerecha=True) oColumnas.nueva("pdrawwin", "%% %s" % _("W+D"), ancho, siDerecha=True) oColumnas.nueva("pdrawlost", "%% %s" % _("L+D"), ancho, siDerecha=True) self.gridOpeningWhite = Grid.Grid(self, oColumnas, siSelecFilas=True) self.gridOpeningBlack = Grid.Grid(self, oColumnas, siSelecFilas=True) # GridWhite/GridBlack oColumnas = Columnas.ListaColumnas() oColumnas.nueva("games", _("Games"), ancho, siDerecha=True) oColumnas.nueva("win", _("Win"), ancho, siDerecha=True) oColumnas.nueva("draw", _("Draw"), ancho, siDerecha=True) oColumnas.nueva("lost", _("Loss"), ancho, siDerecha=True) oColumnas.nueva("pwin", "% " + _("Win"), ancho, siDerecha=True) oColumnas.nueva("pdraw", "% " + _("Draw"), ancho, siDerecha=True) oColumnas.nueva("plost", "% " + _("Loss"), ancho, siDerecha=True) ancho_col = 40 siFigurinesPGN = self.configuracion.figurinesPGN for x in range(1, 50): num = (x - 1) * 2 oColumnas.nueva(str(num), "%d." % x, ancho_col, siCentrado=True, edicion=Delegados.EtiquetaPOS(siFigurinesPGN, siLineas=False)) oColumnas.nueva(str(num + 1), "...", ancho_col, siCentrado=True, edicion=Delegados.EtiquetaPOS(siFigurinesPGN, siLineas=False)) self.gridMovesWhite = Grid.Grid(self, oColumnas, siSelecFilas=True) self.gridMovesBlack = Grid.Grid(self, oColumnas, siSelecFilas=True) wWhite = QtGui.QWidget(self) tbmovesw = ToolbarMoves("white", self.dispatchMoves) ly = Colocacion.V().control(tbmovesw).control( self.gridMovesWhite).margen(3) wWhite.setLayout(ly) wblack = QtGui.QWidget(self) tbmovesb = ToolbarMoves("black", self.dispatchMoves) ly = Colocacion.V().control(tbmovesb).control( self.gridMovesBlack).margen(3) wblack.setLayout(ly) tabs = Controles.Tab(self) tabs.nuevaTab(self.gridOpeningWhite, _("White openings")) tabs.nuevaTab(self.gridOpeningBlack, _("Black openings")) tabs.nuevaTab(wWhite, _("White moves")) tabs.nuevaTab(wblack, _("Black moves")) # ToolBar liAccionesWork = [ (_("Close"), Iconos.MainMenu(), self.tw_terminar), None, ("", Iconos.Usuarios(), self.tw_changeplayer), None, (_("Rebuild"), Iconos.Reindexar(), self.tw_rebuild), None, ] self.tbWork = Controles.TBrutina(self, liAccionesWork, tamIcon=24, puntos=12) self.tbWork.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) lyTB = Colocacion.H().control(self.tbWork) layout = Colocacion.V().otro(lyTB).control(tabs).margen(1) self.setLayout(layout) self.qtColor = (QTUtil.qtColorRGB(221, 255, 221), QTUtil.qtColorRGB(247, 247, 247), QTUtil.qtColorRGB(255, 217, 217)) self.setdbGames(dbGames) self.setPlayer(self.leeVariable("PLAYER", ""))
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()
def __init__(self, procesador, dbop): self.dbop = dbop self.title = dbop.gettitle() QTVarios.WDialogo.__init__(self, procesador.main_window, self.title, Iconos.OpeningLines(), "studyOpening") self.procesador = procesador self.configuration = procesador.configuration self.gamebase = self.dbop.getgamebase() self.num_jg_inicial = self.gamebase.num_moves() self.num_jg_actual = None self.game = None self.resultado = None si_figurines_pgn = self.configuration.x_pgn_withfigurines li_acciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Import"), Iconos.Import8(), self.importar), None, (_("Export"), Iconos.Export8(), self.exportar), None, (_("Utilities"), Iconos.Utilidades(), self.utilidades), None, (_("Train"), Iconos.Study(), self.train), None, ) self.tb = QTVarios.LCTB(self, li_acciones) o_columns = Columnas.ListaColumnas() o_columns.nueva("LINE", _("Line"), 35, edicion=Delegados.EtiquetaPOS(False, True)) start = self.gamebase.num_moves() // 2 + 1 ancho_col = int( ((self.configuration.x_pgn_width - 35 - 20) / 2) * 80 / 100) for x in range(start, 75): o_columns.nueva(str(x), str(x), ancho_col, edicion=Delegados.EtiquetaPOS( si_figurines_pgn, True)) self.glines = Grid.Grid(self, o_columns, siCabeceraMovible=False) self.glines.setAlternatingRowColors(False) self.glines.tipoLetra(puntos=self.configuration.x_pgn_fontpoints) self.glines.ponAltoFila(self.configuration.x_pgn_rowheight) self.pboard = POLBoard.BoardLines(self, self.configuration) self.tabsanalisis = POLAnalisis.TabsAnalisis(self, self.procesador, self.configuration) widget = QtWidgets.QWidget() widget.setStyleSheet("background-color:lightgray;") widget_layout = Colocacion.V().control(self.glines) widget_layout.setSpacing(10) widget_layout.margen(3) widget.setLayout(widget_layout) splitter = QtWidgets.QSplitter(self) splitter.setOrientation(QtCore.Qt.Vertical) splitter.addWidget(widget) splitter.addWidget(self.tabsanalisis) sp = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) splitter.setSizePolicy(sp) self.register_splitter(splitter, "SPLITTER") layout_down = Colocacion.H().control( self.pboard).control(splitter).margen(3) layout = Colocacion.V().control(self.tb).otro(layout_down).margen(3) self.setLayout(layout) self.colorPar = QTUtil.qtColor("#DBDAD9") self.colorNon = QTUtil.qtColor("#F1EFE9") self.colorLine = QTUtil.qtColor("#CDCCCB") self.game = self.gamebase self.pboard.MoverFinal() self.restore_video() self.last_numlines = 0 self.show_lines()
def __init__(self, cpu): QtWidgets.QDialog.__init__(self) self.cpu = cpu self.kibitzer = cpu.kibitzer self.siCandidates = cpu.tipo == Kibitzers.KIB_CANDIDATES self.siThreats = cpu.tipo == Kibitzers.KIB_THREATS dicVideo = self.cpu.dic_video if not dicVideo: dicVideo = {} self.siTop = dicVideo.get("SITOP", True) self.siShowTablero = dicVideo.get("SHOW_TABLERO", True) self.nArrows = dicVideo.get("NARROWS", 2) self.fen = "" self.liData = [] self.history = [] self.setWindowTitle(cpu.titulo) self.setWindowIcon(Iconos.Motor()) 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() self.tablero.set_dispatcher(self.mensajero) self.siFigurines = cpu.configuracion.x_pgn_withfigurines Delegados.generaPM(self.tablero.piezas) delegado = Delegados.EtiquetaPOS(True, siLineas=False) if self.siFigurines else None o_columns = Columnas.ListaColumnas() if not self.siCandidates: o_columns.nueva("DEPTH", "^", 40, centered=True) o_columns.nueva("BESTMOVE", _("Alternatives"), 80, centered=True, edicion=delegado) o_columns.nueva("EVALUATION", _("Evaluation"), 85, centered=True) o_columns.nueva("MAINLINE", _("Main line"), 400) self.grid = Grid.Grid(self, o_columns, dicVideo=dicVideo, siSelecFilas=True) self.lbDepth = Controles.LB(self) li_acciones = ( (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar), (_("Continue"), Iconos.Kibitzer_Continuar(), self.play), (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause), (_("Takeback"), Iconos.Atras(), self.takeback), (_("The line selected is saved on clipboard"), Iconos.MoverGrabar(), self.portapapelesJugSelected), (_("Analyze only color"), Iconos.P_16c(), self.color), (_("Show/hide board"), Iconos.Tablero(), self.config_board), (_("Manual position"), Iconos.Voyager(), self.set_position), ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Top(), self.windowTop), ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Bottom(), self.windowBottom), (_("Options"), Iconos.Opciones(), self.change_options), ) self.tb = Controles.TBrutina(self, li_acciones, siTexto=False, tamIcon=16) self.tb.setAccionVisible(self.play, False) ly1 = Colocacion.H().control(self.tb).relleno().control(self.lbDepth) ly2 = Colocacion.V().otro(ly1).control(self.grid) layout = Colocacion.H().control(self.tablero).otro(ly2) self.setLayout(layout) self.siPlay = True self.is_white = True self.siNegras = True if not self.siShowTablero: self.tablero.hide() self.restore_video(dicVideo) self.ponFlags() self.engine = self.lanzaMotor() self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.compruebaInput) self.timer.start(500) self.depth = 0 self.veces = 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.siPlay = True self.li_moves = [] self.history = [] self.setWindowTitle(cpu.titulo) self.setWindowIcon(Iconos.Finales()) 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() self.tablero.set_dispatcher(self.mensajero) Delegados.generaPM(self.tablero.piezas) self.t4 = LibChess.T4(cpu.configuracion) self.siFigurines = cpu.configuracion.x_pgn_withfigurines o_columns = Columnas.ListaColumnas() delegado = Delegados.EtiquetaPOS(True, siLineas=False) if self.siFigurines else None o_columns.nueva("MOVE", _("Move"), 80, centered=True, edicion=delegado) o_columns.nueva("DTM", "DTM", 60, centered=True) self.grid_moves = Grid.Grid(self, o_columns, dicVideo=dicVideo, siSelecFilas=True) li_acciones = ( (_("Quit"), Iconos.Kibitzer_Terminar(), self.terminar), (_("Continue"), Iconos.Kibitzer_Continuar(), self.play), (_("Pause"), Iconos.Kibitzer_Pausa(), self.pause), (_("Takeback"), Iconos.Atras(), self.takeback), (_("Manual position"), Iconos.Voyager(), self.set_position), (_("Show/hide 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.grid_moves) layout = Colocacion.H().control(self.tablero).otro(ly2) self.setLayout(layout) 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()
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)
def __init__(self, cpu): WKibCommon.WKibCommon.__init__(self, cpu, Iconos.Kibitzer()) self.siCandidates = cpu.tipo == Kibitzers.KIB_CANDIDATES or Kibitzers.KIB_THREATS if cpu.tipo == Kibitzers.KIB_BESTMOVE: rotulo = _("Best move") elif cpu.tipo == Kibitzers.KIB_THREATS: rotulo = _("Threats") else: rotulo = _("Alternatives") delegado = Delegados.EtiquetaPOS( True, siLineas=False) if self.with_figurines else None o_columns = Columnas.ListaColumnas() if not self.siCandidates: o_columns.nueva("DEPTH", "^", 40, centered=True) o_columns.nueva("BESTMOVE", rotulo, 80, centered=True, edicion=delegado) o_columns.nueva("EVALUATION", _("Evaluation"), 85, centered=True) o_columns.nueva("MAINLINE", _("Main line"), 400) self.grid = Grid.Grid(self, o_columns, dicVideo=self.dicVideo, siSelecFilas=True) self.lbDepth = Controles.LB(self) li_acciones = [ (_("Quit"), Iconos.Kibitzer_Close(), self.terminar), (_("Continue"), Iconos.Kibitzer_Play(), self.play), (_("Pause"), Iconos.Kibitzer_Pause(), self.pause), (_("Takeback"), Iconos.Kibitzer_Back(), self.takeback), (_("The line selected is saved on clipboard"), Iconos.Kibitzer_Clipboard(), self.portapapelesJugSelected), (_("Analyze only color"), Iconos.Kibitzer_Side(), self.color), (_("Show/hide board"), Iconos.Kibitzer_Board(), self.config_board), (_("Manual position"), Iconos.Kibitzer_Voyager(), self.set_position), ("%s: %s" % (_("Enable"), _("window on top")), Iconos.Kibitzer_Up(), self.windowTop), ("%s: %s" % (_("Disable"), _("window on top")), Iconos.Kibitzer_Down(), self.windowBottom), (_("Options"), Iconos.Kibitzer_Options(), self.change_options), ] if cpu.tipo == Kibitzers.KIB_THREATS: del li_acciones[4] self.tb = Controles.TBrutina(self, li_acciones, with_text=False, icon_size=24) self.tb.setAccionVisible(self.play, False) ly1 = Colocacion.H().control(self.tb).relleno().control( self.lbDepth).margen(0) ly2 = Colocacion.H().control(self.board).control(self.grid).margen(0) layout = Colocacion.V().otro(ly1).espacio(-10).otro(ly2).margen(3) self.setLayout(layout) self.siPlay = True self.is_white = True self.is_black = True if not self.show_board: self.board.hide() self.restore_video(self.dicVideo) self.ponFlags() self.engine = self.lanzaMotor() self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.compruebaInput) self.timer.start(500) self.depth = 0 self.veces = 0