Inkscape: Unterschied zwischen den Versionen

Aus Vosp.info
Wechseln zu:Navigation, Suche
(Die Seite wurde neu angelegt: „ == extension == === xml element um tag erweitern === <source lang="xml"> </source> <source lang="python"> </source>“)
 
Zeile 1: Zeile 1:
 
  
 
== extension ==  
 
== extension ==  
Zeile 7: Zeile 6:
  
 
<source lang="xml">
 
<source lang="xml">
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
 +
<_name>xml Attribute setzen</_name>
 +
<id>org.inkscape.ancXmlAttribute</id>
 +
 +
<dependency type="executable" location="extensions">inkex.py</dependency>
 +
 +
<param name="kindof" type="enum" _gui-text="Attribut Wert">
 +
<_item value="">...</_item>
 +
<_item value="text">Text</_item>
 +
<_item value="image">Bild</_item>
 +
<_item value="qrcode">qrcode</_item>
 +
<_item value="calendar">Kalender</_item>
 +
</param>
  
 +
<effect>
 +
<object-type>all</object-type>
 +
<effects-menu>
 +
<submenu _name="netz.coop"/>
 +
</effects-menu>
 +
</effect>
 +
 +
<script>
 +
<command reldir="extensions" interpreter="python">ancXmlAttribute.py</command>
 +
</script>
 +
 +
</inkscape-extension>
 
</source>
 
</source>
  
 
<source lang="python">
 
<source lang="python">
 +
#!/usr/bin/env python
 +
import sys
 +
sys.path.append('/usr/share/inkscape/extensions')
 +
import inkex
 +
from simplestyle import *
 +
 +
class C(inkex.Effect):
 +
    def __init__(self):
 +
        inkex.Effect.__init__(self)
 +
        self.OptionParser.add_option(
 +
"-k",
 +
"--kindof",
 +
action="store",
 +
type="string",
 +
dest="kindof",
 +
default="text",
 +
help="spv3 Objektart:"
 +
)
 +
 +
    def effect(self):
 +
if self.selected:
 +
for id, node in self.selected.iteritems():
 +
node.set('ancXmlAttribute', self.options.kindof)
  
 +
effect = C()
 +
effect.affect()
 
</source>
 
</source>

Version vom 18. November 2013, 21:04 Uhr

extension

xml element um tag erweitern

<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
	<_name>xml Attribute setzen</_name>
	<id>org.inkscape.ancXmlAttribute</id>
	
	<dependency type="executable" location="extensions">inkex.py</dependency>
	
	<param name="kindof" type="enum" _gui-text="Attribut Wert">
		<_item value="">...</_item>
		<_item value="text">Text</_item>
		<_item value="image">Bild</_item>
		<_item value="qrcode">qrcode</_item>
		<_item value="calendar">Kalender</_item>
	</param>

	<effect>
		<object-type>all</object-type>
		<effects-menu>
			<submenu _name="netz.coop"/>
		</effects-menu>
	</effect>

	<script>
		<command reldir="extensions" interpreter="python">ancXmlAttribute.py</command>
	</script>

</inkscape-extension>
#!/usr/bin/env python
import sys
sys.path.append('/usr/share/inkscape/extensions')
import inkex
from simplestyle import *

class C(inkex.Effect):
    def __init__(self):
        inkex.Effect.__init__(self)
        self.OptionParser.add_option(
			"-k", 
			"--kindof",
			action="store", 
			type="string", 
			dest="kindof", 
			default="text",
			help="spv3 Objektart:"
		)

    def effect(self):
		if self.selected:
			for id, node in self.selected.iteritems():
				node.set('ancXmlAttribute', self.options.kindof)

effect = C()
effect.affect()