Esempio n. 1
0
    def editarBanda(self, cid):
        li = cid.split("_")
        tp = li[1]
        xid = li[2]
        ok = False
        if tp == TabVisual.TP_FLECHA:
            regFlecha = TabTipos.Flecha(dic = self.dbFlechas[xid])
            w = PantallaTabVFlechas.WTV_Flecha(self, regFlecha, True)
            if w.exec_():
                self.dbFlechas[xid] = w.regFlecha.save_dic()
                ok = True
        elif tp == TabVisual.TP_MARCO:
            regMarco = TabTipos.Marco(dic=self.dbMarcos[xid])
            w = PantallaTabVMarcos.WTV_Marco(self, regMarco)
            if w.exec_():
                self.dbMarcos[xid] = w.regMarco.save_dic()
                ok = True
        elif tp == TabVisual.TP_SVG:
            regSVG = TabTipos.SVG(dic=self.dbSVGs[xid])
            w = PantallaTabVSVGs.WTV_SVG(self, regSVG)
            if w.exec_():
                self.dbSVGs[xid] = w.regSVG.save_dic()
                ok = True
        elif tp == TabVisual.TP_MARKER:
            regMarker = TabTipos.Marker(dic=self.dbMarkers[xid])
            w = PantallaTabVMarkers.WTV_Marker(self, regMarker)
            if w.exec_():
                self.dbMarkers[xid] = w.regMarker.save_dic()
                ok = True

        if ok:
            self.actualizaBandas()
            if len(self.guion):
                self.ponSiGrabar()
Esempio n. 2
0
    def list_arrows(self):
        dic = self.dbFlechas.as_dictionary()
        li = []
        for k, dicFlecha in dic.items():
            arrow = TabTipos.Flecha(dic=dicFlecha)
            arrow.id = k
            li.append(arrow)

        li.sort(key=lambda x: x.ordenVista)
        return li
Esempio n. 3
0
 def flechaRivalDefecto(self):
     bf = TabTipos.Flecha()
     bf.posicion.orden = kZvalue_pieza - 2
     bf.grosor = 1
     bf.altocabeza = 22
     bf.tipo = 1
     bf.destino = "m"
     bf.anchoCasilla = 36
     bf.color = 4281749760
     bf.colorinterior = 4289396480
     bf.colorinterior2 = -1
     bf.redondeos = False
     bf.forma = "3"
     bf.ancho = 5
     bf.vuelo = 4
     bf.descuelgue = 6
     return bf
Esempio n. 4
0
 def flechaDefecto(self):
     bf = TabTipos.Flecha()
     bf.grosor = 1
     bf.altocabeza = 20
     bf.tipo = 1
     bf.destino = "m"
     bf.anchoCasilla = 32
     bf.color = 4293848576
     bf.colorinterior = 4292532736
     bf.opacidad = 0.8
     bf.redondeos = True
     bf.forma = "3"
     bf.ancho = 4
     bf.vuelo = 5
     bf.descuelgue = 6
     bf.posicion.orden = kZvalue_pieza - 1
     return bf
Esempio n. 5
0
 def flechaActivoDefecto(self):
     bf = TabTipos.Flecha()
     bf.position.orden = ZVALUE_PIECE - 2
     bf.grosor = 1
     bf.altocabeza = 22
     bf.tipo = 1
     bf.destino = "m"
     bf.anchoCasilla = 36
     bf.color = 4283760767
     bf.colorinterior = 4294923520
     bf.colorinterior2 = -1
     bf.redondeos = False
     bf.forma = "3"
     bf.ancho = 5
     bf.vuelo = 4
     bf.descuelgue = 6
     return bf
    def __init__(self, owner, listaFlechas, dbFlechas):

        titulo = _("Arrows")
        icono = Iconos.Flechas()
        extparam = "flechas"
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.owner = owner

        flb = Controles.TipoLetra(puntos=8)

        self.configuracion = VarGen.configuracion

        self.dbFlechas = dbFlechas

        self.liPFlechas = owner.listaFlechas()

        # Lista
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("NUMERO", _("N."), 60, siCentrado=True)
        oColumnas.nueva("NOMBRE", _("Name"), 256)

        self.grid = Grid.Grid(self, oColumnas, xid="F", 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.TableroVisual(self, confTablero)
        self.tablero.crea()
        self.tablero.copiaPosicionDe(owner.tablero)

        # Layout
        layout = Colocacion.H().otro(ly).control(self.tablero)
        self.setLayout(layout)

        self.registrarGrid(self.grid)
        self.recuperarVideo()

        # Ejemplos
        liMovs = ["d2d6", "a8h8", "h5b7"]
        self.liEjemplos = []
        regFlecha = TabTipos.Flecha()
        for a1h8 in liMovs:
            regFlecha.a1h8 = a1h8
            regFlecha.siMovible = True
            flecha = self.tablero.creaFlecha(regFlecha)
            self.liEjemplos.append(flecha)

        self.grid.gotop()
        self.grid.setFocus()
Esempio n. 7
0
    def creaTareaBase(self, tp, xid, a1h8, fila):
        # if tp != TabVisual.TP_FLECHA: # Se indica al terminar en porque puede que no se grabe
        # self.ponSiGrabar()
        tpid = tp, xid
        if tp == "P":
            tarea = TabVisual.GT_PiezaMueve(self.guion)
            from_sq, to_sq = a1h8[:2], a1h8[2:]
            borra = self.tablero.dameNomPiezaEn(to_sq)
            tarea.desdeHastaBorra(from_sq, to_sq, borra)
            self.tablero.activaTodas()
        elif tp == "C":
            tarea = TabVisual.GT_PiezaCrea(self.guion)
            borra = self.tablero.dameNomPiezaEn(a1h8)
            tarea.from_sq(a1h8, borra)
            tarea.pieza(xid)
            self.tablero.activaTodas()
        elif tp == "B":
            tarea = TabVisual.GT_PiezaBorra(self.guion)
            tarea.from_sq(a1h8)
            tarea.pieza(xid)
        else:
            xid = str(xid)
            if tp == TabVisual.TP_FLECHA:
                dicFlecha = self.dbFlechas[xid]
                if dicFlecha is None:
                    return None, None
                regFlecha = TabTipos.Flecha()
                regFlecha.restore_dic(dicFlecha)
                regFlecha.tpid = tpid
                regFlecha.a1h8 = a1h8
                sc = self.tablero.creaFlecha(regFlecha)
                tarea = TabVisual.GT_Flecha(self.guion)
            elif tp == TabVisual.TP_MARCO:
                dicMarco = self.dbMarcos[xid]
                if dicMarco is None:
                    return None, None
                regMarco = TabTipos.Marco()
                regMarco.restore_dic(dicMarco)
                regMarco.tpid = tpid
                regMarco.a1h8 = a1h8
                sc = self.tablero.creaMarco(regMarco)
                tarea = TabVisual.GT_Marco(self.guion)
            elif tp == TabVisual.TP_SVG:
                dicSVG = self.dbSVGs[xid]
                if dicSVG is None:
                    return None, None
                regSVG = TabTipos.SVG()
                regSVG.restore_dic(dicSVG)
                regSVG.tpid = tpid
                regSVG.a1h8 = a1h8
                sc = self.tablero.creaSVG(regSVG, siEditando=True)
                tarea = TabVisual.GT_SVG(self.guion)
            elif tp == TabVisual.TP_MARKER:
                dicMarker = self.dbMarkers[xid]
                if dicMarker is None:
                    return None, None
                regMarker = TabTipos.Marker()
                regMarker.restore_dic(dicMarker)
                regMarker.tpid = tpid
                regMarker.a1h8 = a1h8
                sc = self.tablero.creaMarker(regMarker, siEditando=True)
                tarea = TabVisual.GT_Marker(self.guion)
            sc.ponRutinaPulsada(None, tarea.id())
            tarea.itemSC(sc)

        tarea.marcado(True)
        tarea.registro((tp, xid, a1h8))
        fila = self.guion.nuevaTarea(tarea, fila)

        return tarea, fila