From: aurium Date: Wed, 8 Apr 2009 21:40:18 +0000 (+0000) Subject: group recognition to a more faster work with web-transmit-att extension. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ac851ddd38f466093751b7d307d128dd01ee858f;p=inkscape.git group recognition to a more faster work with web-transmit-att extension. --- diff --git a/share/extensions/inkweb.js b/share/extensions/inkweb.js index 7b53153e7..10eaf9d01 100644 --- a/share/extensions/inkweb.js +++ b/share/extensions/inkweb.js @@ -67,18 +67,22 @@ InkWeb.setStyle = function (el, att, val) { } InkWeb.transmitAtt = function (conf) { + conf.att = conf.att.split( /\s+/ ); if ( typeof(conf.from) == "string" ) conf.from = document.getElementById( conf.from ); - if ( typeof(conf.to) == "string" ) - conf.to = document.getElementById( conf.to ); - conf.att = conf.att.split( /\s+/ ); - for ( var i=0; iRun it before <_item value="replace">Replace + <_param name="help" type="description">The next parameter is useful when you select more then two elements. + + <_item value="g-to-one">All tramsmit to the last + <_item value="one-to-g">The first transmit to all + all diff --git a/share/extensions/web-transmit-att.py b/share/extensions/web-transmit-att.py index 830085fab..9c7844dfc 100644 --- a/share/extensions/web-transmit-att.py +++ b/share/extensions/web-transmit-att.py @@ -36,6 +36,10 @@ class InkWebTransmitAtt(inkwebeffect.InkWebEffect): action="store", type="string", dest="compatibility", default="append", help="Compatibility with previews code to this event.") + self.OptionParser.add_option("-t", "--from-and-to", + action="store", type="string", + dest="from_and_to", default="g-to-one", + help='Who transmit to Who? "g-to-one" All tramsmit to the last. "one-to-g" The first transmit to all.') def effect(self): self.ensureInkWebSupport() @@ -44,20 +48,31 @@ class InkWebTransmitAtt(inkwebeffect.InkWebEffect): inkwebeffect.inkex.errormsg(_("You must to select at least two elements.")) exit(1) - elFrom = self.selected[ self.options.ids[0] ] - idTo = self.options.ids[1] + elFrom = [] + idTo = [] + if self.options.from_and_to == "g-to-one": + # All tramsmit to the last + for selId in self.options.ids[:-1]: + elFrom.append( self.selected[selId] ) + idTo.append( self.options.ids[-1] ) + else: + # The first transmit to all + elFrom.append( self.selected[ self.options.ids[0] ] ) + for selId in self.options.ids[1:]: + idTo.append( selId ) - prevEvCode = elFrom.get( self.options.when ) - if prevEvCode == None: prevEvCode = "" + evCode = "InkWeb.transmitAtt({from:this, to:['"+ "','".join(idTo) +"'], att:'"+self.options.att+"'})" - evCode = "InkWeb.transmitAtt({from:this, to:'"+idTo+"', att:'"+self.options.att+"'})" + for el in elFrom: + prevEvCode = el.get( self.options.when ) + if prevEvCode == None: prevEvCode = "" - if self.options.compatibility == 'append': - evCode = prevEvCode +";\n"+ evCode - if self.options.compatibility == 'prepend': - evCode = evCode +";\n"+ prevEvCode + if self.options.compatibility == 'append': + elEvCode = prevEvCode +";\n"+ evCode + if self.options.compatibility == 'prepend': + elEvCode = evCode +";\n"+ prevEvCode - elFrom.set( self.options.when, evCode ) + el.set( self.options.when, elEvCode ) if __name__ == '__main__': e = InkWebTransmitAtt()