Example #1
0
    def __init__(self, guion, board, ancho, edit_mode=False, with_continue=False):
        QtWidgets.QWidget.__init__(self)

        self.guion = guion
        self.tarea = None

        self.mensaje = Controles.EM(self).ponTipoLetra(puntos=Code.configuration.x_sizefont_infolabels)

        self.pb = None
        self.chb = None
        if edit_mode:
            self.chb = Controles.CHB(self, _("With continue button"), False).capture_changes(self, self.save)
            self.mensaje.capturaCambios(self.save)
        elif with_continue:
            self.pb = Controles.PB(self, _("Continue"), self.continuar, plano=False)
            self.bloqueada = True
            self.mensaje.read_only()
        else:
            self.mensaje.read_only()

        self.pbLeft = Controles.PB(self, "", self.go_left).ponIcono(Iconos.AnteriorF()).anchoFijo(24)
        self.pbRight = Controles.PB(self, "", self.go_right).ponIcono(Iconos.SiguienteF()).anchoFijo(24)
        self.pbDown = Controles.PB(self, "", self.go_down).ponIcono(Iconos.Abajo()).anchoFijo(24)
        self.pbClose = Controles.PB(self, "", self.borrar).ponIcono(Iconos.CancelarPeque()).anchoFijo(24)

        cajon = QtWidgets.QWidget(self)
        ly = Colocacion.H()
        ly.control(self.pbLeft).control(self.pbDown)
        ly.control(self.pbRight).control(self.pbClose).margen(0)
        if self.pb:
            ly.control(self.pb)
        if self.chb:
            ly.control(self.chb)
        cajon.setLayout(ly)
        cajon.setFixedHeight(20)

        layout = Colocacion.V().control(self.mensaje).espacio(-6).control(cajon).margen(0)

        self.setLayout(layout)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.ToolTip)

        pos_tabl = board.pos()
        pos_tabl_global = board.mapToGlobal(pos_tabl)
        self.anchoTabl = board.width()
        self.anchoPizarra = ancho
        self.x = pos_tabl_global.x() - pos_tabl.x()
        self.y = pos_tabl_global.y() - pos_tabl.y()

        if self.guion.posPizarra == "R":
            self.go_right()
        elif self.guion.posPizarra == "L":
            self.go_left()
        else:
            self.go_down()

        if edit_mode:
            self.clearFocus()
            self.mensaje.setFocus()
Example #2
0
    def __init__(self, guion, tablero, ancho, editMode=False, withContinue=False):
        QtWidgets.QWidget.__init__(self)

        self.guion = guion
        self.tarea = None

        self.mensaje = Controles.EM(self).ponTipoLetra(puntos=VarGen.configuracion.tamFontRotulos)

        self.pb = None
        self.chb = None
        if editMode:
            self.chb = Controles.CHB(self, _("With continue button"), False).capturaCambiado(self, self.save)
            self.mensaje.capturaCambios(self.save)
        elif withContinue:
            self.pb = Controles.PB(self, _("Continue"), self.continuar, plano=False)
            self.bloqueada = True
            self.mensaje.soloLectura()
        else:
            self.mensaje.soloLectura()

        self.pbLeft = Controles.PB(self, "", self.goLeft).ponIcono(Iconos.AnteriorF()).anchoFijo(24)
        self.pbRight = Controles.PB(self, "", self.goRight).ponIcono(Iconos.SiguienteF()).anchoFijo(24)
        self.pbDown = Controles.PB(self, "", self.goDown).ponIcono(Iconos.Abajo()).anchoFijo(24)
        self.pbClose = Controles.PB(self, "", self.borrar).ponIcono(Iconos.CancelarPeque()).anchoFijo(24)

        cajon = QtWidgets.QWidget(self)
        ly = Colocacion.H()
        ly.control(self.pbLeft).control(self.pbDown)
        ly.control(self.pbRight).control(self.pbClose).margen(0)
        if self.pb:
            ly.control(self.pb)
        if self.chb:
            ly.control(self.chb)
        cajon.setLayout(ly)
        cajon.setFixedHeight(20)

        layout = Colocacion.V().control(self.mensaje).espacio(-6).control(cajon).margen(0)

        self.setLayout(layout)
        self.setWindowFlags(QtCore.Qt.ToolTip)

        posTabl = tablero.pos()
        posTablGlobal = tablero.mapToGlobal(posTabl)
        self.anchoTabl = tablero.width()
        self.anchoPizarra = ancho
        self.x = posTablGlobal.x() - posTabl.x()
        self.y = posTablGlobal.y() - posTabl.y()

        if self.guion.posPizarra == "R":
            self.goRight()
        elif self.guion.posPizarra == "L":
            self.goLeft()
        else:
            self.goDown()

        if editMode:
            self.clearFocus()
            self.mensaje.setFocus()
Example #3
0
    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, 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 __init__(self, parent, config, carpeta):
        QtWidgets.QHBoxLayout.__init__(self)

        self.config = config
        self.parent = parent

        self.carpeta = carpeta
        self.boton = Controles.PB(parent, self.carpeta, self.cambiarCarpeta, plano=False)
        btCancelar = Controles.PB(parent, "", self.cancelar)
        btCancelar.ponIcono(Iconos.Delete()).anchoFijo(16)
        self.parent = parent

        self.addWidget(self.boton)
        self.addWidget(btCancelar)
Example #6
0
    def __init__(self, wowner, configuracion, with_remcomments=False):
        QtWidgets.QWidget.__init__(self, wowner)

        self.wowner = wowner
        self.file = ""
        self.configuracion = configuracion
        self.with_remcomments = with_remcomments
        self.vars_read()

        lb_file = Controles.LB(self, _("File to save") + ": ")
        bt_history = Controles.PB(self, "", self.history).ponIcono(
            Iconos.Favoritos(), 24).ponToolTip(_("Previous"))
        bt_boxrooms = (Controles.PB(self, "", self.boxrooms).ponIcono(
            Iconos.BoxRooms(), 24).ponToolTip(_("Boxrooms PGN")))
        self.bt_file = Controles.PB(self, "", self.file_select,
                                    plano=False).anchoMinimo(300)

        # Codec
        lb_codec = Controles.LB(self, _("Encoding") + ": ")
        liCodecs = [
            k for k in set(v for k, v in encodings.aliases.aliases.items())
        ]
        liCodecs.sort()
        liCodecs = [(k, k) for k in liCodecs]
        liCodecs.insert(0, (_("Same as file"), "file"))
        liCodecs.insert(0,
                        ("%s: %s" % (_("By default"), _("UTF-8")), "default"))
        self.cb_codecs = Controles.CB(self, liCodecs, self.codec)

        # Rest
        self.chb_overwrite = Controles.CHB(self, _("Overwrite"), False)
        if with_remcomments:
            self.chb_remove_c_v = Controles.CHB(
                self, _("Remove comments and variations"), self.remove_c_v)

        lyF = Colocacion.H().control(lb_file).control(
            self.bt_file).control(bt_history).control(bt_boxrooms).relleno(1)
        lyC = Colocacion.H().control(lb_codec).control(
            self.cb_codecs).relleno(1)
        ly = Colocacion.V().espacio(15).otro(lyF).otro(lyC).control(
            self.chb_overwrite)
        if with_remcomments:
            ly.control(self.chb_remove_c_v)
        ly.relleno(1)

        self.chb_overwrite.hide()

        self.setLayout(ly)
Example #7
0
    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)
Example #8
0
    def __init__(self, owner, conj_piezas, is_white):
        QtWidgets.QWidget.__init__(self)

        self.owner = owner

        self.conj_piezas = conj_piezas

        self.filaPromocion = (7, 8) if is_white else (2, 1)

        self.menuPromocion = self.creaMenuPiezas("QRBN ", is_white)

        self.promocion = " "

        self.origen = (EDCelda(self, "").caracteres(2).controlrx(
            "(|[a-h][1-8])").anchoFijo(32).align_center().capture_changes(
                self.miraPromocion))

        self.arrow = arrow = Controles.LB(self).ponImagen(Iconos.pmMover())

        self.destino = (EDCelda(self, "").caracteres(2).controlrx(
            "(|[a-h][1-8])").anchoFijo(32).align_center().capture_changes(
                self.miraPromocion))

        self.pbPromocion = Controles.PB(self,
                                        "",
                                        self.pulsadoPromocion,
                                        plano=False).anchoFijo(24)

        ly = (Colocacion.H().relleno().control(
            self.origen).espacio(2).control(arrow).espacio(2).control(
                self.destino).control(self.pbPromocion).margen(0).relleno())
        self.setLayout(ly)

        self.miraPromocion()
Example #9
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)
Example #10
0
    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 = {}
Example #11
0
    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()
Example #12
0
    def __init__(self, owner, titulo, formato1="%v/%m", formato2="%v/%m"):
        QtGui.QDialog.__init__(self, owner)

        self.owner = owner

        # self.setWindowModality(QtCore.Qt.WindowModal)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint)
        self.setWindowTitle(titulo)

        # gb1 + progress
        self.bp1 = QtGui.QProgressBar()
        self.bp1.setFormat(formato1)
        ly = Colocacion.H().control(self.bp1)
        self.gb1 = Controles.GB(self, "", ly)

        # gb2 + progress
        self.bp2 = QtGui.QProgressBar()
        self.bp2.setFormat(formato2)
        ly = Colocacion.H().control(self.bp2)
        self.gb2 = Controles.GB(self, "", ly)

        # cancelar
        bt = Controles.PB(self, _("Cancel"), self.cancelar,
                          plano=False)  # .ponIcono( Iconos.Delete() )
        lyBT = Colocacion.H().relleno().control(bt)

        layout = Colocacion.V().control(self.gb1).control(self.gb2).otro(lyBT)

        self.setLayout(layout)
        self._siCancelado = False
Example #13
0
    def __init__(self, owner, conj_piezas, is_white, position):
        QtWidgets.QWidget.__init__(self)

        self.owner = owner
        self.wm = WEdMove(self, conj_piezas, is_white)
        self.ms = Controles.LB(self, "")
        self.an = Controles.PB(self, "?", self.analizarUno, plano=False).anchoFijo(18)
        self.cancelar = Controles.LB(self, "").ponImagen(Iconos.pmCancelarPeque())
        self.aceptar = Controles.LB(self, "").ponImagen(Iconos.pmAceptarPeque())
        ly = (
            Colocacion.H()
            .control(self.aceptar)
            .control(self.cancelar)
            .control(self.wm)
            .control(self.an)
            .control(self.ms)
            .relleno()
            .margen(0)
        )
        self.setLayout(ly)

        self.ms.hide()
        self.an.hide()
        self.aceptar.hide()
        self.cancelar.hide()

        self.position = position
Example #14
0
    def __init__(self, owner, conj_piezas, siBlancas):
        QtGui.QWidget.__init__(self)

        self.owner = owner

        self.conj_piezas = conj_piezas

        self.filaPromocion = (7, 8) if siBlancas else (2, 1)

        self.menuPromocion = self.creaMenuPiezas("QRBN ", siBlancas)

        self.promocion = " "

        self.origen = EDCelda(self, "").caracteres(2).controlrx("(|[a-h][1-8])").anchoFijo(32).alinCentrado().capturaCambiado(self.miraPromocion)

        self.flecha = flecha = Controles.LB(self).ponImagen(Iconos.pmMover())

        self.destino = EDCelda(self, "").caracteres(2).controlrx("(|[a-h][1-8])").anchoFijo(32).alinCentrado().capturaCambiado(self.miraPromocion)

        self.pbPromocion = Controles.PB(self, "", self.pulsadoPromocion, plano=False).anchoFijo(24)

        ly = Colocacion.H().relleno().control(self.origen).espacio(2).control(flecha).espacio(2).control(
                self.destino).control(self.pbPromocion).margen(0).relleno()
        self.setLayout(ly)

        self.miraPromocion()
Example #15
0
    def __init__(self, parent):
        super(BlancasNegras, self).__init__(parent)
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint)

        icoP = VarGen.todasPiezas.iconoDefecto("K")
        icop = VarGen.todasPiezas.iconoDefecto("k")
        self.setWindowTitle(_("Choose Color"))
        self.setWindowIcon(icoP)

        btBlancas = Controles.PB(self, "", rutina=self.accept, plano=False).ponIcono(icoP, tamIcon=64)
        btNegras = Controles.PB(self, "", rutina=self.negras, plano=False).ponIcono(icop, tamIcon=64)

        self.resultado = True

        ly = Colocacion.H().control(btBlancas).control(btNegras)
        ly.margen(10)
        self.setLayout(ly)
Example #16
0
    def __init__(self, parent, rut_actual, rut_defecto, rut_actualiza):
        Colocacion.H.__init__(self)
        self.width = 128
        self.height = 32
        self.btFlecha = Controles.PB(parent, "", self.cambiar)
        self.btFlecha.setFixedSize(self.width, self.height)
        self.btQuitar = Controles.PB(parent, "", self.ponDefecto).ponIcono(Iconos.Motor_No())
        self.parent = parent

        self.rut_actual = rut_actual
        self.rut_defecto = rut_defecto
        self.rut_actualiza = rut_actualiza

        self.control(self.btFlecha)
        self.control(self.btQuitar)

        self.ponImagen()
Example #17
0
    def __init__(self, parent, rut_actual, rut_actualiza, bt_asociado):
        Colocacion.H.__init__(self)
        self.width = 32
        self.height = 32
        self.btImagen = Controles.PB(parent, "", self.cambiar)
        self.btImagen.setFixedSize(self.width, self.height)
        self.btQuitar = Controles.PB(parent, "", self.quitaImagen).ponIcono(Iconos.Motor_No())
        self.bt_asociado = bt_asociado
        self.parent = parent

        self.rut_actual = rut_actual
        self.rut_actualiza = rut_actualiza

        self.control(self.btImagen)
        self.control(self.btQuitar)

        self.ponImagen()
    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)
Example #19
0
    def __init__(self, owner, um):
        super(WMuestra, self).__init__(owner)

        self.um = um
        self.owner = owner

        self.time_engine = um.time_engine()
        self.time_label = um.time_label()

        self.tablero = owner.tablero

        self.lbMotorM = Controles.LB(
            self, self.time_engine).alinCentrado().ponTipoLetra(puntos=9,
                                                                peso=75)
        self.lbTiempoM = Controles.LB(
            self, self.time_label).alinCentrado().ponTipoLetra(puntos=9,
                                                               peso=75)
        self.dicFonts = {True: "blue", False: "grey"}

        self.btCancelar = Controles.PB(self, "",
                                       self.cancelar).ponIcono(Iconos.X())

        self.lbPuntuacion = owner.lbPuntuacion
        self.lbMotor = owner.lbMotor
        self.lbTiempo = owner.lbTiempo
        self.lbPGN = owner.lbPGN

        self.list_rm_name = um.list_rm_name  # rm, name, centipawns
        self.siTiempoActivo = False

        self.colorNegativo = QTUtil.qtColorRGB(255, 0, 0)
        self.colorImpares = QTUtil.qtColorRGB(231, 244, 254)
        o_columns = Columnas.ListaColumnas()
        self.si_figurines_pgn = Code.configuracion.x_pgn_withfigurines
        o_columns.nueva(
            "JUGADAS",
            "%d %s" % (len(self.list_rm_name), _("Moves")),
            120,
            centered=True,
            edicion=Delegados.EtiquetaPGN(
                um.move.is_white() if self.si_figurines_pgn else None),
        )
        self.wrm = Grid.Grid(self, o_columns, siLineas=False)

        self.wrm.tipoLetra(puntos=Code.configuracion.x_pgn_fontpoints)
        nAncho = self.wrm.anchoColumnas() + 20
        self.wrm.setFixedWidth(nAncho)
        self.wrm.goto(self.um.pos_selected, 0)

        # Layout
        ly2 = Colocacion.H().relleno().control(
            self.lbTiempoM).relleno().control(self.btCancelar)
        layout = Colocacion.V().control(self.lbMotorM).otro(ly2).control(
            self.wrm)

        self.setLayout(layout)

        self.wrm.setFocus()
    def __init__(self, owner, um):
        super(WMuestra, self).__init__(owner)

        self.um = um
        self.owner = owner

        self.etiquetaMotor = um.etiquetaMotor()
        self.etiquetaTiempo = um.etiquetaTiempo()

        self.tablero = owner.tablero

        self.lbMotorM = Controles.LB(
            self, self.etiquetaMotor).alinCentrado().ponTipoLetra(puntos=9,
                                                                  peso=75)
        self.lbTiempoM = Controles.LB(
            self, self.etiquetaTiempo).alinCentrado().ponTipoLetra(puntos=9,
                                                                   peso=75)
        self.dicFonts = {True: "blue", False: "grey"}

        self.btCancelar = Controles.PB(self, "",
                                       self.cancelar).ponIcono(Iconos.X())

        self.lbPuntuacion = owner.lbPuntuacion
        self.lbMotor = owner.lbMotor
        self.lbTiempo = owner.lbTiempo
        self.lbPGN = owner.lbPGN

        self.listaRM = um.listaRM
        self.siTiempoActivo = False

        self.colorNegativo = QTUtil.qtColorRGB(255, 0, 0)
        self.colorImpares = QTUtil.qtColorRGB(231, 244, 254)
        oColumnas = Columnas.ListaColumnas()
        self.siFigurinesPGN = VarGen.configuracion.figurinesPGN
        oColumnas.nueva(
            "JUGADAS",
            "%d %s" % (len(self.listaRM), _("Moves")),
            120,
            siCentrado=True,
            edicion=Delegados.EtiquetaPGN(
                um.jg.siBlancas() if self.siFigurinesPGN else None))
        self.wrm = Grid.Grid(self, oColumnas, siLineas=False)

        self.wrm.tipoLetra(puntos=VarGen.configuracion.puntosPGN)
        nAncho = self.wrm.anchoColumnas() + 20
        self.wrm.setFixedWidth(nAncho)
        self.wrm.goto(self.um.posElegida, 0)

        # Layout
        ly2 = Colocacion.H().relleno().control(
            self.lbTiempoM).relleno().control(self.btCancelar)
        layout = Colocacion.V().control(self.lbMotorM).otro(ly2).control(
            self.wrm)

        self.setLayout(layout)

        self.wrm.setFocus()
Example #21
0
    def __init__(self, procesador, winBookGuide):
        QtGui.QWidget.__init__(self)

        self.winBookGuide = winBookGuide
        self.bookGuide = None  # <--setBookGuide
        self.wsummary = None  # <--setSummary
        self.infoMove = None  # <--setInfoMove

        self.procesador = procesador

        # Tree
        self.tree = WBG_Tree.TreeMoves(self)

        # ToolBar
        liAccionesWork = (
            (_("Close"), Iconos.MainMenu(), self.tw_terminar),
            None,
            (_("Bookmarks"), Iconos.Favoritos(), self.tw_bookmarks),
            None,
            (_("Start position"), Iconos.Inicio(), self.tw_inicio),
        )
        self.tbWork = Controles.TBrutina(self, liAccionesWork, tamIcon=24)

        liAccionesGen = (
            (_("Change"), Iconos.Modificar(), self.tg_cambiar),
            (_("New"), Iconos.NuevoMas(), self.tg_crear),
            (_("Copy"), Iconos.Copiar(), self.tg_copiar),
            (_("Remove"), Iconos.Borrar(), self.tg_borrar),
            (_("Rename"), Iconos.Rename(), self.tg_rename),
            (_("Training"), Iconos.Entrenamiento(), self.tg_training),
            (_("Import"), Iconos.Mezclar(), self.tg_import),
        )
        self.tbGen = Controles.TBrutina(self, liAccionesGen, tamIcon=24)

        # Name
        self.lbName = Controles.LB(self,
                                   "").ponWrap().alinCentrado().ponColorFondoN(
                                       "white",
                                       "#5178AA").ponTipoLetra(puntos=16)

        # Navigator
        self.navigator = WNavigator(self)
        self.btInicial = Controles.PB(self, "", self.tw_inicio).ponIcono(
            Iconos.Inicio(), tamIcon=24).anchoFijo(24)
        lyN = Colocacion.H().control(self.btInicial).control(
            self.navigator).relleno().margen(3)

        lyTB = Colocacion.H().control(self.tbWork).relleno().control(
            self.tbGen)

        layout = Colocacion.V().control(self.lbName).otro(lyTB).control(
            self.tree).otro(lyN).margen(1)

        self.setLayout(layout)
    def __init__(self, parent, titulo, siErroneos, icono):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint)

        self.setWindowTitle(titulo)
        self.setWindowIcon(icono)
        self.fontB = f = Controles.TipoLetra(puntos=10, peso=75)

        self.siErroneos = siErroneos

        self.siCancelado = False

        lbRotLeidos = Controles.LB(self, _("Games read") + ":").ponFuente(f)
        self.lbLeidos = Controles.LB(self, "0").ponFuente(f)

        if siErroneos:
            lbRotErroneos = Controles.LB(self,
                                         _("Erroneous") + ":").ponFuente(f)
            self.lbErroneos = Controles.LB(self, "0").ponFuente(f)

        self.lbRotDuplicados = Controles.LB(self,
                                            _("Duplicated") + ":").ponFuente(f)
        self.lbDuplicados = Controles.LB(self, "0").ponFuente(f)

        self.lbRotImportados = lbRotImportados = Controles.LB(
            self,
            _("Imported") + ":").ponFuente(f)
        self.lbImportados = Controles.LB(self, "0").ponFuente(f)

        self.btCancelarSeguir = Controles.PB(self,
                                             _("Cancel"),
                                             self.cancelar,
                                             plano=False).ponIcono(
                                                 Iconos.Delete())

        # Tiempo
        ly = Colocacion.G().margen(20)
        ly.controld(lbRotLeidos, 0, 0).controld(self.lbLeidos, 0, 1)
        if siErroneos:
            ly.controld(lbRotErroneos, 1, 0).controld(self.lbErroneos, 1, 1)
        ly.controld(self.lbRotDuplicados, 2,
                    0).controld(self.lbDuplicados, 2, 1)
        ly.controld(lbRotImportados, 3, 0).controld(self.lbImportados, 3, 1)

        lyBT = Colocacion.H().relleno().control(self.btCancelarSeguir)

        layout = Colocacion.V()
        layout.otro(ly)
        layout.espacio(20)
        layout.otro(lyBT)

        self.setLayout(layout)
    def __init__(self, parent, config, file):
        QtWidgets.QHBoxLayout.__init__(self)

        if config.li_histo and not config.ficheroDefecto:
            config.ficheroDefecto = os.path.dirname(config.li_histo[0])

        self.boton = BotonFichero(
            file, config.extension, config.siSave, config.siRelativo, config.anchoMinimo, config.ficheroDefecto
        )
        btCancelar = Controles.PB(parent, "", self.cancelar)
        btCancelar.ponIcono(Iconos.Delete()).anchoFijo(16)
        self.parent = parent

        self.addWidget(self.boton)
        self.addWidget(btCancelar)

        if config.li_histo:
            btHistorico = Controles.PB(parent, "", self.historico).ponIcono(Iconos.Favoritos())
            self.addWidget(btHistorico)
            self.li_histo = config.li_histo
        self.boton.ponFichero(file)
Example #24
0
    def __init__(self, fenActivo):
        QtGui.QWidget.__init__(self)

        confTablero = VarGen.configuracion.confTablero("INFOMOVE", 32)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(" w " in fenActivo)

        self.cpDefecto = ControlPosicion.ControlPosicion()
        self.cpDefecto.leeFen(fenActivo)
        self.porDefecto()

        btInicio = Controles.PB(self, "",
                                self.inicio).ponIcono(Iconos.MoverInicio())
        btAtras = Controles.PB(self, "",
                               self.atras).ponIcono(Iconos.MoverAtras())
        btAdelante = Controles.PB(self, "", self.adelante).ponIcono(
            Iconos.MoverAdelante())
        btFinal = Controles.PB(self, "",
                               self.final).ponIcono(Iconos.MoverFinal())

        self.lbTituloLibro = Controles.LB(self, "")

        lybt = Colocacion.H().relleno()
        for x in (btInicio, btAtras, btAdelante, btFinal):
            lybt.control(x)
        lybt.relleno()

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbTituloLibro).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        layout.relleno()
        self.setLayout(layout)

        self.movActual = None
    def __init__(self, is_white_bottom, fenActivo):
        QtWidgets.QWidget.__init__(self)

        config_board = Code.configuration.config_board("INFOMOVE", 32)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        self.board.ponerPiezasAbajo(is_white_bottom)

        self.cpDefecto = Position.Position()
        self.cpDefecto.read_fen(fenActivo)
        self.porDefecto()

        btInicio = Controles.PB(self, "",
                                self.start).ponIcono(Iconos.MoverInicio())
        btAtras = Controles.PB(self, "",
                               self.atras).ponIcono(Iconos.MoverAtras())
        btAdelante = Controles.PB(self, "", self.adelante).ponIcono(
            Iconos.MoverAdelante())
        btFinal = Controles.PB(self, "",
                               self.final).ponIcono(Iconos.MoverFinal())

        self.lbTituloLibro = Controles.LB(self, "")

        lybt = Colocacion.H().relleno()
        for x in (btInicio, btAtras, btAdelante, btFinal):
            lybt.control(x)
        lybt.relleno()

        lyt = Colocacion.H().relleno().control(self.board).relleno()

        lya = Colocacion.H().relleno().control(self.lbTituloLibro).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        layout.relleno()
        self.setLayout(layout)

        self.movActual = None
Example #26
0
    def __init__(self, liUsuarios):
        QtWidgets.QDialog.__init__(self, None)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint)

        self.setWindowTitle(Code.lucas_chess)
        self.setWindowIcon(Iconos.Aplicacion64())

        self.setFont(Controles.TipoLetra(puntos=14))

        self.liUsuarios = liUsuarios

        li_options = [(usuario.name, nusuario)
                      for nusuario, usuario in enumerate(liUsuarios)]
        lbU = Controles.LB(self, _("User") + ":")
        self.cbU = Controles.CB(self, li_options, liUsuarios[0])

        lbP = Controles.LB(self, _("Password") + ":")
        self.edP = Controles.ED(self).password()

        btaceptar = Controles.PB(self,
                                 _("Accept"),
                                 rutina=self.accept,
                                 plano=False)
        btcancelar = Controles.PB(self,
                                  _("Cancel"),
                                  rutina=self.reject,
                                  plano=False)

        ly = Colocacion.G()
        ly.controld(lbU, 0, 0).control(self.cbU, 0, 1)
        ly.controld(lbP, 1, 0).control(self.edP, 1, 1)

        lybt = Colocacion.H().relleno().control(btaceptar).espacio(10).control(
            btcancelar)

        layout = Colocacion.V().otro(ly).espacio(10).otro(lybt).margen(10)

        self.setLayout(layout)
        self.edP.setFocus()
Example #27
0
    def __init__(self, parent):
        QtWidgets.QDialog.__init__(self, parent)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint)

        icoP = Code.todasPiezas.iconoDefecto("K")
        icop = Code.todasPiezas.iconoDefecto("k")
        self.setWindowTitle(_("Choose Color"))
        self.setWindowIcon(icoP)
        self.key_saved = "BLANCASNEGRASTIEMPO"

        btBlancas = Controles.PB(self, "", rutina=self.blancas,
                                 plano=False).ponIcono(icoP, icon_size=64)
        btNegras = Controles.PB(self, "", rutina=self.negras,
                                plano=False).ponIcono(icop, icon_size=64)

        # Tiempo
        self.edMinutos, self.lbMinutos = QTUtil2.spinBoxLB(
            self, 10, 0, 999, maxTam=50, etiqueta=_("Total minutes"))
        self.edSegundos, self.lbSegundos = QTUtil2.spinBoxLB(
            self, 0, 0, 999, maxTam=50, etiqueta=_("Seconds added per move"))
        ly = Colocacion.G()
        ly.controld(self.lbMinutos, 0, 0).control(self.edMinutos, 0, 1)
        ly.controld(self.lbSegundos, 0, 2).control(self.edSegundos, 0, 3)
        self.gbT = Controles.GB(self, _("Time"),
                                ly).to_connect(self.change_time)

        self.chb_fastmoves = Controles.CHB(self, _("Fast moves"), False)

        self.color = None

        ly = Colocacion.H().control(btBlancas).control(btNegras)
        ly.margen(10)
        layout = Colocacion.V().otro(ly).espacio(10).control(self.gbT).control(
            self.chb_fastmoves).margen(5)
        self.setLayout(layout)

        self.read_saved()
    def __init__(self, owner, fichero):
        self.litourneys = Everest.str_file(fichero)
        self.configuracion = owner.configuracion
        titulo = _("New expedition")
        icono = Iconos.Trekking()
        extparam = "newexpedition"
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.selected = None

        # Torneo
        li = [("%s (%d)" % (_F(tourney["TOURNEY"]), len(tourney["GAMES"])), tourney) for tourney in self.litourneys]
        li.sort(key=lambda x:x[0])
        self.cbtourney, lbtourney = QTUtil2.comboBoxLB(self, li, li[0], _("Expedition"))
        btmas = Controles.PB(self, "", self.mas).ponIcono(Iconos.Mas22())
        lytourney = Colocacion.H().control(lbtourney).control(self.cbtourney).control(btmas).relleno(1)

        # tolerance
        self.sbtolerance_min, lbtolerance_min = QTUtil2.spinBoxLB(self, 20, 0, 99999, _("From"))
        self.sbtolerance_min.capturaCambiado(self.tolerance_changed)
        self.sbtolerance_max, lbtolerance_max = QTUtil2.spinBoxLB(self, 1000, 0, 99999, _("To"))
        lbexplanation = Controles.LB(self, _("Maximum lost points for having to repeat active game"))
        ly = Colocacion.H().relleno(2).control(lbtolerance_min).control(self.sbtolerance_min).relleno(1)
        ly.control(lbtolerance_max).control(self.sbtolerance_max).relleno(2)
        layout = Colocacion.V().otro(ly).control(lbexplanation)
        gbtolerance = Controles.GB(self, _("Tolerance"), layout)

        # tries
        self.sbtries_min, lbtries_min = QTUtil2.spinBoxLB(self, 2, 1, 99999, _("From"))
        self.sbtries_min.capturaCambiado(self.tries_changed)
        self.sbtries_max, lbtries_max = QTUtil2.spinBoxLB(self, 15, 1, 99999, _("To"))
        lbexplanation = Controles.LB(self, _("Maximum repetitions to return to the previous game"))
        ly = Colocacion.H().relleno(2).control(lbtries_min).control(self.sbtries_min).relleno(1)
        ly.control(lbtries_max).control(self.sbtries_max).relleno(2)
        layout = Colocacion.V().otro(ly).control(lbexplanation)
        gbtries = Controles.GB(self, _("Tries"), layout)

        # color
        liColors = ((_("Default"), "D"), (_("White"), "W"), (_("Black"), "B"))
        self.cbcolor = Controles.CB(self, liColors, "D")
        layout = Colocacion.H().relleno(1).control(self.cbcolor).relleno(1)
        gbcolor = Controles.GB(self, _("Color"), layout)

        tb = QTVarios.LCTB(self)
        tb.new(_("Accept"), Iconos.Aceptar(), self.aceptar)
        tb.new(_("Cancel"), Iconos.Cancelar(), self.cancelar)

        layout = Colocacion.V().control(tb).otro(lytourney).control(gbtolerance).control(gbtries).control(gbcolor)

        self.setLayout(layout)
Example #29
0
    def __init__(self, parent, objetivo):
        QtWidgets.QDialog.__init__(self, parent)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.FramelessWindowHint)

        self.edAnotacion = Controles.ED(self, "")
        btAceptar = Controles.PB(self, "", rutina=self.aceptar).ponIcono(
            Iconos.Aceptar())
        btCancelar = Controles.PB(self, "", rutina=self.cancelar).ponIcono(
            Iconos.Cancelar())
        btAyuda = Controles.PB(self, "",
                               rutina=self.ayuda).ponIcono(Iconos.AyudaGR())

        self.objetivo = objetivo
        self.conAyuda = False
        self.errores = 0
        self.resultado = None

        layout = (Colocacion.H().relleno(1).control(btAyuda).control(
            self.edAnotacion).control(btAceptar).control(btCancelar).margen(3))
        self.setLayout(layout)
        self.move(parent.x() + parent.board.width() - 212,
                  parent.y() + parent.board.y() - 3)
Example #30
0
    def __init__(self, liUsuarios):
        QtGui.QDialog.__init__(self, None)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint)

        main = liUsuarios[0]

        self.setWindowTitle(main.trlucas)
        self.setWindowIcon(Iconos.Usuarios())

        liOpciones = [(usuario.nombre, usuario) for usuario in liUsuarios]
        lbU = Controles.LB(self, main.trusuario + ":")
        self.cbU = Controles.CB(self, liOpciones, main)

        lbP = Controles.LB(self, main.trpassword + ":")
        self.edP = Controles.ED(self).password()

        btaceptar = Controles.PB(self,
                                 main.traceptar,
                                 rutina=self.accept,
                                 plano=False)
        btcancelar = Controles.PB(self,
                                  main.trcancelar,
                                  rutina=self.reject,
                                  plano=False)

        ly = Colocacion.G()
        ly.controld(lbU, 0, 0).control(self.cbU, 0, 1)
        ly.controld(lbP, 1, 0).control(self.edP, 1, 1)

        lybt = Colocacion.H().relleno().control(btaceptar).espacio(10).control(
            btcancelar)

        layout = Colocacion.V().otro(ly).espacio(10).otro(lybt).margen(10)

        self.setLayout(layout)
        self.edP.setFocus()