diff options
| author | Felipe Corr??a da Silva Sanches <juca@members.fsf.org> | 2011-06-02 22:48:10 +0000 |
|---|---|---|
| committer | Felipe C. da S. Sanches <juca@members.fsf.org> | 2011-06-02 22:48:10 +0000 |
| commit | 9e8757e90b3f35b90e19f16cd3812e7ae2928c37 (patch) | |
| tree | b191d8cd3cf2031fbda5f26d19573df56428c9da /share | |
| parent | some fixes to the svgfont2layers extension. (diff) | |
| download | inkscape-9e8757e90b3f35b90e19f16cd3812e7ae2928c37.tar.gz inkscape-9e8757e90b3f35b90e19f16cd3812e7ae2928c37.zip | |
add multiple glyph layers at once (from characters found in user input string)
(bzr r10252)
Diffstat (limited to 'share')
| -rwxr-xr-x | share/extensions/new_glyph_layer.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/share/extensions/new_glyph_layer.py b/share/extensions/new_glyph_layer.py index ed6d74229..7b6eafa95 100755 --- a/share/extensions/new_glyph_layer.py +++ b/share/extensions/new_glyph_layer.py @@ -22,27 +22,31 @@ import sys class NewGlyphLayer(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) - self.OptionParser.add_option("-u", "--unicodechar", + self.OptionParser.add_option("-u", "--unicodechars", action="store", type="string", - dest="unicodechar", default='', - help="Unicode char") + dest="unicodechars", default='', + help="Unicode chars") def effect(self): # Get all the options - unicode_char = self.options.unicodechar + unicode_chars = self.options.unicodechars + + #TODO: remove duplicate chars # Get access to main SVG document element svg = self.document.getroot() - # Create a new layer. - layer = inkex.etree.SubElement(svg, 'g') - layer.set(inkex.addNS('label', 'inkscape'), 'GlyphLayer-'+unicode_char) - layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer') - layer.set('style', 'display:none') #initially not visible - - # Move selection to the newly created layer - for id,node in self.selected.iteritems(): - layer.append(node) + for char in unicode_chars: + # Create a new layer. + layer = inkex.etree.SubElement(svg, 'g') + layer.set(inkex.addNS('label', 'inkscape'), 'GlyphLayer-'+char) + layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer') + layer.set('style', 'display:none') #initially not visible + + #TODO: make it optional ("Use current selection as template glyph") + # Move selection to the newly created layer + for id,node in self.selected.iteritems(): + layer.append(node) if __name__ == '__main__': e = NewGlyphLayer() |
