def __init__(self, oBase, ventana, segundosPensando, siBlancas, cPuntos, maxRecursion): super(WAnalisisVariantes, self).__init__(ventana) self.oBase = oBase # Creamos los controles self.setWindowTitle(_("Variants")) self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint ) self.setWindowIcon(Iconos.Tutor()) f = Controles.TipoLetra(puntos=12, peso=75) flb = Controles.TipoLetra(puntos=10) lbPuntuacionAnterior = Controles.LB(self, cPuntos).alinCentrado().ponFuente(flb) self.lbPuntuacionNueva = Controles.LB(self).alinCentrado().ponFuente(flb) confTablero = VarGen.configuracion.confTablero("ANALISISVARIANTES", 32) self.tablero = Tablero.Tablero(self, confTablero) self.tablero.crea() self.tablero.ponerPiezasAbajo(siBlancas) self.tableroT = Tablero.Tablero(self, confTablero) self.tableroT.crea() self.tableroT.ponerPiezasAbajo(siBlancas) btTerminar = Controles.PB(self, _("Close"), self.close).ponPlano(False) btReset = Controles.PB(self, _("Another change"), oBase.reset).ponIcono(Iconos.MoverLibre()).ponPlano(False) liMasAcciones = (("FEN:%s" % _("Copy to clipboard"), "MoverFEN", Iconos.Clip()),) lytbTutor, self.tb = QTVarios.lyBotonesMovimiento(self, "", siLibre=maxRecursion > 0, liMasAcciones=liMasAcciones) self.maxRecursion = maxRecursion - 1 self.segundos, lbSegundos = QTUtil2.spinBoxLB(self, segundosPensando, 1, 999, maxTam=40, etiqueta=_("Second(s)")) # Creamos los layouts lyVariacion = Colocacion.V().control(lbPuntuacionAnterior).control(self.tablero) gbVariacion = Controles.GB(self, _("Proposed change"), lyVariacion).ponFuente(f).alinCentrado() lyTutor = Colocacion.V().control(self.lbPuntuacionNueva).control(self.tableroT) gbTutor = Controles.GB(self, _("Tutor's prediction"), lyTutor).ponFuente(f).alinCentrado() lyBT = Colocacion.H().control(btTerminar).control(btReset).relleno().control(lbSegundos).control(self.segundos) layout = Colocacion.G().control(gbVariacion, 0, 0).control(gbTutor, 0, 1) layout.otro(lyBT, 1, 0).otro(lytbTutor, 1, 1) self.setLayout(layout) self.move(ventana.x() + 20, ventana.y() + 20)
def menu(self): pantalla = self.procesador.pantalla pantalla.cursorFueraTablero() menu = QTVarios.LCMenu(pantalla) f = Controles.TipoLetra(nombre="Courier New", puntos=10) fbold = Controles.TipoLetra(nombre="Courier New", puntos=10, peso=700) fbolds = Controles.TipoLetra(nombre="Courier New", puntos=10, peso=500, siSubrayado=True) menu.ponFuente(f) li_results = self.lee_results() icono = Iconos.PuntoAzul() menu.separador() menu.opcion(None,("** %s **" % _("Challenge 101")).center(30)) menu.separador() ok_en_lista = False for n, (fecha, pts) in enumerate(li_results, 1): if fecha == self.key: ok_en_lista = True ico = Iconos.PuntoEstrella() tipoLetra = fbolds else: ico = icono tipoLetra = None txt = str(fecha)[:16] menu.opcion( None, "%2d. %-20s %6d" % (n, txt, pts), ico, tipoLetra=tipoLetra) menu.separador() menu.opcion(None, "") menu.separador() if self.puntos_ultimo: menu.opcion(None, ("+%d" % (self.puntos_ultimo)).center(30), tipoLetra=fbold) if self.pendientes == 0: if not ok_en_lista: menu.opcion(None, ("%s: %d" % (_("Score"), self.puntos_totales)).center(30), tipoLetra=fbold) menu.separador() menu.opcion("close", _("GAME OVER").center(30), Iconos.Terminar()) else: menu.opcion(None, ("%s: %d" % (_("Score"), self.puntos_totales)).center(30), tipoLetra=fbold) menu.separador() menu.opcion(None, ("%s: %d" % (_("Positions left"), self.pendientes)).center(30), tipoLetra=fbold) menu.separador() menu.opcion(None, "") menu.separador() menu.opcion("continuar", _("Continue"), Iconos.Pelicula_Seguir()) menu.separador() menu.opcion("close", _("Close"), Iconos.MainMenu()) resp = menu.lanza() return not (resp == "close" or self.pendientes == 0)
def __init__(self, wparent, titulo, head, txt, min_tam, pm_icon): super(WInfo, self).__init__(wparent) self.setWindowTitle(titulo) self.setWindowIcon(Iconos.Aplicacion64()) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint) f = Controles.TipoLetra(puntos=20) lb_ico = Controles.LB(self).ponImagen(pm_icon) lb_titulo = Controles.LB(self, head).align_center().ponFuente(f) lb_texto = Controles.LB(self, txt) lb_texto.setMinimumWidth(min_tam - 84) lb_texto.setWordWrap(True) lb_texto.setTextFormat(QtCore.Qt.RichText) bt_seguir = Controles.PB(self, _("Continue"), self.seguir).ponPlano(False) ly_v1 = Colocacion.V().control(lb_ico).relleno() ly_v2 = Colocacion.V().control(lb_titulo).control(lb_texto).espacio( 10).control(bt_seguir) ly_h = Colocacion.H().otro(ly_v1).otro(ly_v2).margen(10) self.setLayout(ly_h)
def __init__(self, owner): QtGui.QTreeWidget.__init__(self) self.owner = owner self.setAlternatingRowColors(True) self.listaMoves = owner.listaMoves self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.menuContexto) self.setHeaderLabels((_("Moves"), "", _("Games"), "", "")) self.setColumnHidden(3, True) ftxt = Controles.TipoLetra(puntos=9) self.setFont(ftxt) self.connect( self, QtCore.SIGNAL( "currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"), self.seleccionado) self.connect(self, QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"), self.owner.aceptar) self.dicItemMoves = {} self.ponMoves(self.listaMoves) self.sortItems(4, QtCore.Qt.AscendingOrder)
def __init__(self, w_parent, txtcategoria, max_level): super(WDatos, self).__init__(w_parent) self.setWindowTitle(_("Check your memory on a chessboard")) self.setWindowIcon(Iconos.Memoria()) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint) tb = QTUtil2.tbAcceptCancel(self) f = Controles.TipoLetra(puntos=12, peso=75) self.ed, lb = QTUtil2.spinBoxLB(self, max_level, 1, max_level, etiqueta=txtcategoria + " " + _("Level"), maxTam=40) lb.ponFuente(f) ly = Colocacion.H().control(lb).control(self.ed).margen(20) layout = Colocacion.V().control(tb).otro(ly).margen(3) self.setLayout(layout)
def message(owner, texto, explanation=None, titulo=None, pixmap=None, px=None, py=None, si_bold=False): msg = QtWidgets.QMessageBox(owner) if pixmap is None: msg.setIconPixmap(Iconos.pmMensInfo()) else: msg.setIconPixmap(pixmap) msg.setText(texto) msg.setFont( Controles.TipoLetra(puntos=Code.configuracion.x_menu_points, peso=300 if si_bold else 50)) if explanation: msg.setInformativeText(explanation) if titulo is None: titulo = _("Message") msg.setWindowTitle(titulo) if px is not None: msg.move( px, py ) # topright: owner.x() + owner.width() - msg.width() - 46, owner.y()+4) msg.addButton(_("Continue"), QtWidgets.QMessageBox.ActionRole) msg.exec_()
def selectOneFNS(owner, procesador): tpirat = Controles.TipoLetra("Chess Diagramm Pirat", procesador.configuracion.puntosMenu + 4) def xopcion(menu, clave, texto, icono, siDeshabilitado=False): if "KP" in texto: d = {"K": "r", "P": "w", "k": chr(126), "p": chr(134)} k2 = texto.index("K", 2) texto = texto[:k2] + texto[k2:].lower() texton = "" for c in texto: texton += d[c] menu.opcion(clave, texton, icono, siDeshabilitado, tipoLetra=tpirat) else: menu.opcion(clave, texto, icono, siDeshabilitado) menu = QTVarios.LCMenu(owner) td = TrainingDir("Trainings") td.addOtherFolder(procesador.configuracion.dirPersonalTraining) td.reduce() td.menu(menu, xopcion) resp = menu.lanza() return resp if resp is None else resp[3:]
def __init__(self, parent, titulo): QtWidgets.QDialog.__init__(self, parent) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint) self.is_canceled = False self.setWindowTitle(titulo) self.setWindowIcon(Iconos.Import8()) self.fontB = Controles.TipoLetra(puntos=10, peso=75) self.lbgames_readed = Controles.LB(self).ponFuente(self.fontB) self.bp = QtWidgets.QProgressBar() self.bp.setFont(self.fontB) self.lb_previsto = Controles.LB(self) self.li_times = [] self.time_inicial = None self.invalid_prevision = True self.total = None self.bt_cancelar = Controles.PB(self, _("Cancel"), self.cancelar, plano=False).ponIcono(Iconos.Delete()) lyBT = Colocacion.H().relleno().control(self.bt_cancelar) layout = Colocacion.V() layout.control(self.lbgames_readed) layout.control(self.bp) layout.control(self.lb_previsto) layout.espacio(20) layout.otro(lyBT) self.setLayout(layout) self.setMinimumWidth(480)
def __init__(self, tabsAnalisis, configuration): QtWidgets.QWidget.__init__(self) self.tabsAnalisis = tabsAnalisis self.tree = TreeMoves(self) self.tree.setAlternatingRowColors(True) self.tree.setIndentation(24) self.tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.tree.customContextMenuRequested.connect(self.menuContexto) self.tree.setStyleSheet( "selection-background-color: #F1D369; selection-color: #000000;") self.tree.setFont( Controles.TipoLetra(puntos=configuration.x_pgn_fontpoints)) self.tree.setHeaderLabels((_("Moves"), _("Opening"))) bt_act = Controles.PB(self, _("Update"), self.bt_update, plano=False).ponIcono(Iconos.Pelicula_Seguir(), 16) self.lb_analisis = Controles.LB( self, "").set_background("#C9D2D7").ponTipoLetra( puntos=configuration.x_pgn_fontpoints) ly_act = Colocacion.H().control(bt_act).control( self.lb_analisis).relleno(1) layout = Colocacion.V().otro(ly_act).control(self.tree) self.setLayout(layout) self.dicItems = {}
def informacion(self): menu = QTVarios.LCMenu(self.pantalla) f = Controles.TipoLetra(puntos=10, peso=75) menu.ponFuente(f) siOpening = False for clave, valor in self.partida.liTags: trad = TrListas.pgnLabel(clave) if trad != clave: clave = trad menu.opcion(clave, "%s : %s" % (clave, valor), Iconos.PuntoAzul()) if clave.upper() == "OPENING": siOpening = True if not siOpening: apertura = self.partida.apertura if apertura: menu.separador() nom = apertura.trNombre ape = _("Opening") rotulo = nom if ape.upper() in nom.upper() else ("%s : %s" % (ape, nom)) menu.opcion("opening", rotulo, Iconos.PuntoNaranja()) menu.separador() menu.opcion("pgn", _("Edit PGN labels"), Iconos.PGN()) resp = menu.lanza() if resp: self.editarEtiquetasPGN()
def __init__(self, parent, mensaje, siCancelar, siMuestraYa, opacity, posicion, fixedSize, titCancelar, background, pmImagen=None, puntos=12, conImagen=True): super(MensEspera, self).__init__(parent) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint) self.setStyleSheet("QWidget, QLabel { background: %s }" % background) if conImagen: lbi = QtGui.QLabel(self) lbi.setPixmap(pmImagen if pmImagen else Iconos.pmMensEspera()) self.owner = parent self.posicion = posicion self.siCancelado = False if posicion == "tb": fixedSize = parent.width() self.lb = lb = Controles.LB(parent, resalta(mensaje)).ponFuente( Controles.TipoLetra(puntos=puntos)) if fixedSize is not None: lb.ponWrap().anchoFijo(fixedSize - 60) if siCancelar: if not titCancelar: titCancelar = _("Cancel") self.btCancelar = Controles.PB( self, titCancelar, rutina=self.cancelar, plano=False).ponIcono(Iconos.Cancelar()).anchoFijo(100) ly = Colocacion.G() if conImagen: ly.control(lbi, 0, 0, 3, 1) ly.control(lb, 1, 1) if siCancelar: ly.controlc(self.btCancelar, 2, 1) ly.margen(12) self.setLayout(ly) self.teclaPulsada = None if fixedSize: self.setFixedWidth(fixedSize) self.setWindowOpacity(opacity) if siMuestraYa: self.muestra()
def aperturasFavoritas(self): if len(self.liAperturasFavoritas) == 0: return menu = QTVarios.LCMenu(self) menu.setToolTip(_("To choose: <b>left button</b> <br>To erase: <b>right button</b>")) f = Controles.TipoLetra(puntos=8, peso=75) menu.ponFuente(f) nPos = 0 for nli, bloque in enumerate(self.liAperturasFavoritas): if type(bloque) == tuple: # compatibilidad con versiones anteriores bloque = bloque[0] self.liAperturasFavoritas[nli] = bloque menu.opcion(bloque, bloque.trNombre, Iconos.PuntoVerde()) nPos += 1 resp = menu.lanza() if resp: if menu.siIzq: self.bloqueApertura = resp self.muestraApertura() elif menu.siDer: bloqueApertura = resp if QTUtil2.pregunta( self, _X( _("Do you want to delete the opening %1 from the list of favourite openings?"), bloqueApertura.trNombre, ), ): del self.liAperturasFavoritas[nPos]
def pregunta(parent, mens, label_yes=None, label_no=None, si_top=False, px=None, py=None): msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Question, _("Question"), resalta(mens), parent=parent) if label_yes is None: label_yes = _("Yes") if label_no is None: label_no = _("No") si_button = msg_box.addButton(label_yes, QtWidgets.QMessageBox.YesRole) msg_box.setFont( Controles.TipoLetra(puntos=Code.configuration.x_menu_points)) msg_box.addButton(label_no, QtWidgets.QMessageBox.NoRole) if si_top: msg_box.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) if px is not None: msg_box.move( px, py ) # topright: owner.x() + owner.width() - msg.width() - 46, owner.y()+4) msg_box.exec_() return msg_box.clickedButton() == si_button
def eligeJugadaBooks(pantalla, liJugadas, siBlancas, siSelectSiempre=True): pantalla.cursorFueraTablero() menu = QTVarios.LCMenu(pantalla) f = Controles.TipoLetra(nombre="Courier New", puntos=10) menu.ponFuente(f) titulo = _("White") if siBlancas else _("Black") icono = Iconos.Carpeta() menu.opcion(None, titulo, icono) menu.separador() icono = Iconos.PuntoNaranja() if siBlancas else Iconos.PuntoNegro() for desde, hasta, coronacion, pgn, peso in liJugadas: menu.opcion((desde, hasta, coronacion), pgn, icono) menu.separador() resp = menu.lanza() if resp: return resp else: if siSelectSiempre: desde, hasta, coronacion, pgn, peso = liJugadas[0] return desde, hasta, coronacion else: return None
def eligeJugadaBooks(main_window, li_moves, is_white, siSelectSiempre=True): main_window.cursorFueraBoard() menu = QTVarios.LCMenu(main_window) f = Controles.TipoLetra(name="Courier New", puntos=10) menu.ponFuente(f) titulo = _("White") if is_white else _("Black") icono = Iconos.Carpeta() menu.opcion(None, titulo, icono) menu.separador() icono = Iconos.PuntoNaranja() if is_white else Iconos.PuntoNegro() for from_sq, to_sq, promotion, pgn, peso in li_moves: menu.opcion((from_sq, to_sq, promotion), pgn, icono) menu.separador() resp = menu.lanza() if resp: return resp else: if siSelectSiempre: from_sq, to_sq, promotion, pgn, peso = li_moves[0] return from_sq, to_sq, promotion else: return None
def __init__(self, wParent, o_columns, where): QtWidgets.QDialog.__init__(self, wParent) QTVarios.WDialogo.__init__(self, wParent, _("Filter"), Iconos.Filtrar(), "rawfilter") self.where = "" li_fields = [(x.cabecera, x.key) for x in o_columns.liColumnas if x.key != "number"] f = Controles.TipoLetra(puntos=12) # 0, peso=75 ) lbRaw = Controles.LB(self, "%s:" % _("Raw SQL")).ponFuente(f) self.edRaw = EM_SQL( self, where, li_fields).altoFijo(72).anchoMinimo(512).ponFuente(f) lbHelp = Controles.LB( self, _("Right button to select a column of database")).ponFuente(f) lyHelp = Colocacion.H().relleno().control(lbHelp).relleno() ly = Colocacion.H().control(lbRaw).control(self.edRaw) # Toolbar li_acciones = [(_("Accept"), Iconos.Aceptar(), self.aceptar), None, (_("Cancel"), Iconos.Cancelar(), self.reject), None] tb = QTVarios.LCTB(self, li_acciones) # Layout layout = Colocacion.V().control(tb).otro(ly).otro(lyHelp).margen(3) self.setLayout(layout) self.edRaw.setFocus() self.restore_video(siTam=False)
def __init__(self, side, rutina): QtWidgets.QWidget.__init__(self) self.dispatch = rutina self.side = side self.setFont(Controles.TipoLetra()) ancho = 54 bt_all = Controles.PB(self, _("All"), self.run_all, plano=False).anchoFijo(ancho + 16) bt_e4 = Controles.PB(self, "e4", self.run_e4, plano=False).anchoFijo(ancho) bt_d4 = Controles.PB(self, "d4", self.run_d4, plano=False).anchoFijo(ancho) bt_c4 = Controles.PB(self, "c4", self.run_c4, plano=False).anchoFijo(ancho) bt_nf3 = Controles.PB(self, "Nf3", self.run_nf3, plano=False).anchoFijo(ancho) bt_other = Controles.PB(self, _("Others"), self.run_other, plano=False).anchoFijo(ancho + 16) ply1 = Controles.PB(self, _("%d ply") % 1, self.run_p1, plano=False).anchoFijo(ancho) ply2 = Controles.PB(self, _("%d ply") % 2, self.run_p2, plano=False).anchoFijo(ancho) ply3 = Controles.PB(self, _("%d ply") % 3, self.run_p3, plano=False).anchoFijo(ancho) ply4 = Controles.PB(self, _("%d ply") % 4, self.run_p4, plano=False).anchoFijo(ancho) ply5 = Controles.PB(self, _("%d ply") % 5, self.run_p5, plano=False).anchoFijo(ancho) self.sbply = Controles.SB(self, 0, 0, 100) self.sbply.capture_changes(self.run_p) lbply = Controles.LB(self, _("Plies")) layout = Colocacion.H().relleno(1).control(bt_all) layout.control(bt_e4).control(bt_d4).control(bt_c4).control(bt_nf3).control(bt_other).relleno(1) layout.control(ply1).control(ply2).control(ply3).control(ply4).control(ply5) layout.control(lbply).control(self.sbply).relleno(1).margen(0) self.setLayout(layout)
def __init__(self, owner): self.owner = owner configuracion = VarGen.configuracion self.siFigurines = configuracion.figurinesPGN puntos = configuracion.puntosPGN QtGui.QWidget.__init__(self, self.owner) liAcciones = ( (_("Append"), Iconos.Mas(), self.tbMasVariante), None, ("%s+%s" % (_("Append"), _("Engine")), Iconos.MasR(), self.tbMasVarianteR), None, (_("Edit"), Iconos.ComentarioEditar(), self.tbEditarVariante), None, (_("Remove"), Iconos.Borrar(), self.tbBorrarVariante), None, ) tbVariantes = Controles.TBrutina(self, liAcciones, siTexto=False, tamIcon=16) self.em = Controles.EM(self)#.capturaCambios(self.variantesCambiado) self.em.setReadOnly(True) self.em.capturaDobleClick(self.dobleClick) ly = Colocacion.V().control(tbVariantes).control(self.em).margen(3) f = Controles.TipoLetra(puntos=puntos) gbVariantes = Controles.GB(self.owner, _("Variants"), ly).ponFuente(f) layout = Colocacion.H().control(gbVariantes).margen(0) self.setLayout(layout) self.liVariantes = [] self.jg = None
def informacion(self): menu = QTVarios.LCMenu(self.main_window) f = Controles.TipoLetra(puntos=10, peso=75) menu.ponFuente(f) siOpening = False for key, valor in self.game.li_tags: trad = TrListas.pgnLabel(key) if trad != key: key = trad menu.opcion(key, "%s : %s" % (key, valor), Iconos.PuntoAzul()) if key.upper() == "OPENING": siOpening = True if not siOpening: opening = self.game.opening if opening: menu.separador() nom = opening.trNombre ape = _("Opening") label = nom if ape.upper() in nom.upper() else ("%s : %s" % (ape, nom)) menu.opcion("opening", label, Iconos.PuntoNaranja()) menu.separador() menu.opcion("pgn", _("Edit PGN labels"), Iconos.PGN()) resp = menu.lanza() if resp: self.editEtiquetasPGN()
def eligeJugadaBooks(pantalla, liJugadas, is_white, siSelectSiempre=True): pantalla.cursorFueraTablero() menu = QTVarios.LCMenu(pantalla) f = Controles.TipoLetra(name=Code.font_mono, puntos=10) menu.ponFuente(f) titulo = _("White") if is_white else _("Black") icono = Iconos.Carpeta() menu.opcion(None, titulo, icono) menu.separador() icono = Iconos.PuntoNaranja() if is_white else Iconos.PuntoNegro() for xfrom, xto, promotion, pgn, peso in liJugadas: menu.opcion((xfrom, xto, promotion), pgn, icono) menu.separador() resp = menu.lanza() if resp: return resp else: if siSelectSiempre: xfrom, xto, promotion, pgn, peso = liJugadas[0] return xfrom, xto, promotion else: return None
def __init__(self, owner, listaSVGs, dbSVGs): titulo = _("Images") icono = Iconos.SVGs() extparam = "svgs" QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam) self.owner = owner flb = Controles.TipoLetra(puntos=8) self.configuracion = VarGen.configuracion self.liPSVGs = listaSVGs self.dbSVGs = dbSVGs # Lista oColumnas = Columnas.ListaColumnas() oColumnas.nueva("NUMERO", _("N."), 60, siCentrado=True) oColumnas.nueva("NOMBRE", _("Name"), 256) self.grid = Grid.Grid(self, oColumnas, xid="M", siSelecFilas=True) liAcciones = [ (_("Close"), Iconos.MainMenu(), "terminar"), None, (_("New"), Iconos.Nuevo(), "mas"), None, (_("Remove"), Iconos.Borrar(), "borrar"), None, (_("Modify"), Iconos.Modificar(), "modificar"), None, (_("Copy"), Iconos.Copiar(), "copiar"), None, (_("Up"), Iconos.Arriba(), "arriba"), None, (_("Down"), Iconos.Abajo(), "abajo"), None, ] tb = Controles.TB(self, liAcciones) tb.setFont(flb) ly = Colocacion.V().control(tb).control(self.grid) # Tablero confTablero = owner.tablero.confTablero self.tablero = Tablero.Tablero(self, confTablero, siDirector=False) self.tablero.crea() self.tablero.copiaPosicionDe(owner.tablero) # Layout layout = Colocacion.H().otro(ly).control(self.tablero) self.setLayout(layout) # Ejemplos liMovs = ["g4h3", "e2e2", "d6f4"] self.liEjemplos = [] regSVG = TabTipos.SVG() for a1h8 in liMovs: regSVG.a1h8 = a1h8 regSVG.xml = estrellaSVG regSVG.siMovible = True svg = self.tablero.creaSVG(regSVG, siEditando=True) self.liEjemplos.append(svg) self.grid.gotop() self.grid.setFocus()
def __init__(self, wParent): QtGui.QDialog.__init__(self, wParent) self.wParent = wParent self.fichero = "" self.setWindowTitle(_("Create a new book")) self.setWindowIcon(Iconos.Libros()) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint) f = Controles.TipoLetra(puntos=9, peso=75) self.configuracion = VarGen.configuracion fvar = self.configuracion.ficheroBooks self.listaLibros = Books.ListaLibros() self.listaLibros.recuperaVar(fvar) lbFichero = Controles.LB(self, _("Book to create") + ":").ponFuente(f) self.btFichero = Controles.PB(self, "", self.buscaFichero, False).anchoMinimo(450).ponFuente(f) lbMaxPly = Controles.LB(self, _("Maximum no. half moves (ply)") + ":").ponFuente(f) self.sbMaxPly = Controles.SB(self, 0, 0, 999).tamMaximo(50) lbMinGame = Controles.LB(self, _("Minimum number of games") + ":").ponFuente(f) self.sbMinGame = Controles.SB(self, 3, 1, 999).tamMaximo(50) lbMinScore = Controles.LB(self, _("Minimum score") + ":").ponFuente(f) self.sbMinScore = Controles.SB(self, 0, 0, 100).tamMaximo(50) self.chbOnlyWhite = Controles.CHB(self, _("White only"), False).ponFuente(f) self.chbOnlyBlack = Controles.CHB(self, _("Black only"), False).ponFuente(f) self.chbUniform = Controles.CHB(self, _("Uniform distribution"), False).ponFuente(f) lyf = Colocacion.H().control(lbFichero).control(self.btFichero) ly = Colocacion.G().margen(15) ly.otroc(lyf, 0, 0, 1, 2) ly.controld(lbMaxPly, 1, 0).control(self.sbMaxPly, 1, 1) ly.controld(lbMinGame, 2, 0).control(self.sbMinGame, 2, 1) ly.controld(lbMinScore, 3, 0).control(self.sbMinScore, 3, 1) ly.controlc(self.chbOnlyWhite, 4, 0, 1, 2) ly.controlc(self.chbOnlyBlack, 5, 0, 1, 2) ly.controlc(self.chbUniform, 6, 0, 1, 2) # Toolbar liAcciones = [(_("Accept"), Iconos.Aceptar(), "aceptar"), None, (_("Cancel"), Iconos.Cancelar(), "cancelar"), None] tb = Controles.TB(self, liAcciones) # Layout layout = Colocacion.V().control(tb).otro(ly).margen(3) self.setLayout(layout)
def __init__(self, owner, listaMarkers, dbMarkers): titulo = _("Markers") icono = Iconos.Markers() extparam = "markers" super().__init__(parent=owner, titulo=titulo, icono=icono, extparam=extparam) self.owner = owner flb = Controles.TipoLetra(puntos=8) self.configuracion = VarGen.configuracion self.liPMarkers = listaMarkers self.dbMarkers = dbMarkers # Lista oColumnas = Columnas.ListaColumnas() oColumnas.nueva("NUMERO", _("N."), 60, siCentrado=True) oColumnas.nueva("NOMBRE", _("Name"), 256) self.grid = Grid.Grid(self, oColumnas, xid="M", siSelecFilas=True) liAcciones = [ (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("New"), Iconos.Nuevo(), self.mas), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Modify"), Iconos.Modificar(), self.modificar), None, (_("Copy"), Iconos.Copiar(), self.copiar), None, (_("Up"), Iconos.Arriba(), self.arriba), None, (_("Down"), Iconos.Abajo(), self.abajo), None, ] tb = Controles.TBrutina(self, liAcciones) tb.setFont(flb) ly = Colocacion.V().control(tb).control(self.grid) # Tablero confTablero = owner.tablero.confTablero self.tablero = Tablero.Tablero(self, confTablero, siDirector=False) self.tablero.crea() self.tablero.copiaPosicionDe(owner.tablero) # Layout layout = Colocacion.H().otro(ly).control(self.tablero) self.setLayout(layout) self.grid.gotop() self.grid.setFocus()
def __init__(self, escena, bloqueTexto, rutina=None): super(TextoSC, self).__init__(escena, bloqueTexto.posicion) self.bloqueDatos = self.bloqueTexto = bloqueTexto self.font = Controles.TipoLetra(txt=str(bloqueTexto.tipoLetra)) self.font.setPixelSize(bloqueTexto.tipoLetra.puntos) self.textOption = QtGui.QTextOption(QTUtil.qtAlineacion(bloqueTexto.alineacion)) self.rutina = rutina
def __init__(self, owner, list_markers, dbMarkers): titulo = _("Markers") icono = Iconos.Markers() extparam = "markers" QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam) self.owner = owner flb = Controles.TipoLetra(puntos=8) self.configuration = Code.configuration self.liPMarkers = list_markers self.dbMarkers = dbMarkers # Lista o_columns = Columnas.ListaColumnas() o_columns.nueva("NUMBER", _("N."), 60, centered=True) o_columns.nueva("NOMBRE", _("Name"), 256) self.grid = Grid.Grid(self, o_columns, xid="M", siSelecFilas=True) li_acciones = [ (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("New"), Iconos.Nuevo(), self.mas), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Modify"), Iconos.Modificar(), self.modificar), None, (_("Copy"), Iconos.Copiar(), self.copiar), None, (_("Up"), Iconos.Arriba(), self.arriba), None, (_("Down"), Iconos.Abajo(), self.abajo), None, ] tb = Controles.TBrutina(self, li_acciones) tb.setFont(flb) ly = Colocacion.V().control(tb).control(self.grid) # Board config_board = self.configuration.config_board("EDIT_GRAPHICS", 48) self.board = Board.Board(self, config_board, siDirector=False) self.board.crea() self.board.copiaPosicionDe(owner.board) # Layout layout = Colocacion.H().otro(ly).control(self.board) self.setLayout(layout) self.grid.gotop() self.grid.setFocus()
def __init__(self, owner, db_coordinates, is_white): QTVarios.WDialogo.__init__(self, owner, _("Coordinates"), Iconos.Blocks(), "runcoordinatesbasic") self.configuration = Code.configuration self.is_white = is_white self.db_coordinates = db_coordinates self.coordinates = None self.current_score = 0 self.working = False self.time_ini = None conf_board = self.configuration.config_board( "RUNCOORDINATESBASIC", self.configuration.size_base()) self.board = Board.BoardEstaticoMensaje(self, conf_board, None, 0.6) self.board.crea() self.board.bloqueaRotacion(True) self.cp_initial = Position.Position() self.cp_initial.set_pos_initial() self.board.ponerPiezasAbajo(self.is_white) self.board.set_position(self.cp_initial) font = Controles.TipoLetra(puntos=26, peso=500) lb_score_k = Controles.LB(self, _("Score")).ponFuente(font) self.lb_score = Controles.LB(self).ponFuente(font) li_acciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Begin"), Iconos.Empezar(), self.begin), (_("Continue"), Iconos.Pelicula_Seguir(), self.seguir), ) self.tb = QTVarios.LCTB(self, li_acciones) self.show_tb(self.terminar, self.begin) ly_info = Colocacion.G() ly_info.controlc(lb_score_k, 0, 0).controlc(self.lb_score, 1, 0) ly_right = Colocacion.V().control( self.tb).relleno().otro(ly_info).relleno() w = QtWidgets.QWidget(self) w.setLayout(ly_right) w.setMinimumWidth(240) ly_center = Colocacion.H().control(self.board).control(w).margen(3) self.setLayout(ly_center) self.restore_video() self.adjustSize()
def marcar(self): menu = QTVarios.LCMenu(self) f = Controles.TipoLetra(puntos=8, peso=75) menu.ponFuente(f) menu.opcion(1, _("All"), Iconos.PuntoVerde()) menu.opcion(2, _("None"), Iconos.PuntoNaranja()) resp = menu.lanza() if resp: for obj in self.li_gm: obj["ELEGIDO"] = resp == 1 self.grid.refresh()
def marcar(self): menu = QTVarios.LCMenu(self) f = Controles.TipoLetra(puntos=8, peso=75) menu.ponFuente(f) menu.opcion(1, _("All"), Iconos.PuntoVerde()) menu.opcion(2, _("None"), Iconos.PuntoNaranja()) resp = menu.lanza() if resp: for n in range(len(self.liElegidos)): self.liElegidos[n] = resp == 1 self.pgn.refresh()
def __init__(self, procesador, is_captures): self.configuration = procesador.configuration self.is_captures = is_captures if is_captures: path = self.configuration.file_captures() title = _("Captures and threats in a game") icon = Iconos.Captures() extconfig = "captures" else: path = self.configuration.file_counts() title = _("Count moves") icon = Iconos.Count() extconfig = "counts" self.db = CountsCaptures.DBCountCapture(path) QTVarios.WDialogo.__init__(self, procesador.main_window, title, icon, extconfig) o_columns = Columnas.ListaColumnas() o_columns.nueva("DATE", _("Date"), 120, centered=True) o_columns.nueva("GAME", _("Game"), 520, centered=True) o_columns.nueva("CURRENT_MOVE", _("Current move"), 96, centered=True) o_columns.nueva("%", _("Success"), 90, centered=True) self.glista = Grid.Grid(self, o_columns, siSelecFilas=True, siSeleccionMultiple=True) f = Controles.TipoLetra(puntos=self.configuration.x_menu_points) self.glista.ponFuente(f) li_acciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Play"), Iconos.Play(), self.play), None, (_("New"), Iconos.Nuevo(), self.new), None, (_("Repeat"), Iconos.Copiar(), self.repetir), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Options"), Iconos.Opciones(), self.options), None, ) tb = QTVarios.LCTB(self, li_acciones) ly = Colocacion.V().control(tb).control(self.glista).margen(4) self.setLayout(ly) self.register_grid(self.glista) self.restore_video(anchoDefecto=self.glista.anchoColumnas() + 20) self.glista.gotop()
def __init__(self, procesador, dic_data): entrenamientos = procesador.entrenamientos entrenamientos.check() self.entrenamientos = entrenamientos self.procesador = procesador self.li_favoritos = self.procesador.configuration.get_favoritos() self.dic_data = dic_data QTVarios.WDialogo.__init__(self, self.procesador.main_window, _("Shortcuts"), Iconos.Atajos(), "atajos") li_acciones = [ (_("Close"), Iconos.MainMenu(), self.terminar), None, ("+" + _("Play"), Iconos.Libre(), self.masplay), ("+" + _("Train"), Iconos.Entrenamiento(), self.masentrenamiento), ("+" + _("Compete"), Iconos.NuevaPartida(), self.mascompete), ("+" + _("Tools"), Iconos.Tools(), self.mastools), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Up"), Iconos.Arriba(), self.arriba), (_("Down"), Iconos.Abajo(), self.abajo), None, ] tb = Controles.TBrutina( self, li_acciones, puntos=procesador.configuration.x_tb_fontpoints) # Lista o_columnas = Columnas.ListaColumnas() o_columnas.nueva("KEY", _("Key"), 80, centered=True) o_columnas.nueva("OPCION", _("Option"), 300) o_columnas.nueva("LABEL", _("Label"), 300, edicion=Delegados.LineaTextoUTF8(siPassword=False)) self.grid = Grid.Grid(self, o_columnas, siSelecFilas=True, siEditable=True) self.grid.setMinimumWidth(self.grid.anchoColumnas() + 20) f = Controles.TipoLetra(puntos=10, peso=75) self.grid.ponFuente(f) # Layout layout = Colocacion.V().control(tb).control( self.grid).relleno().margen(3) self.setLayout(layout) self.restore_video(siTam=True) self.grid.gotop()