summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ab7cfa2)
raw | patch | inline | side by side (parent: ab7cfa2)
author | JazzyNico <nicoduf@yahoo.fr> | |
Tue, 31 Aug 2010 17:07:19 +0000 (19:07 +0200) | ||
committer | JazzyNico <nicoduf@yahoo.fr> | |
Tue, 31 Aug 2010 17:07:19 +0000 (19:07 +0200) |
* Number node cleanup.
* New help tab in color>randomize.
* Printing marks consistency fix.
* New help tab in color>randomize.
* Printing marks consistency fix.
index a6fdb72560ba9d5fe70c40c30ad772432d615ed4..82691f0f46c432446035695c9118a028b54111d8 100644 (file)
<dependency type="executable" location="extensions">coloreffect.py</dependency>
<dependency type="executable" location="extensions">color_randomize.py</dependency>
<dependency type="executable" location="extensions">simplestyle.py</dependency>
- <param name="hue" type="boolean" _gui-text="Hue">true</param>
- <param name="saturation" type="boolean" _gui-text="Saturation">true</param>
- <param name="lightness" type="boolean" _gui-text="Lightness">true</param>
+ <param name="tab" type="notebook">
+ <page name="Options" _gui-text="Options">
+ <param name="hue" type="boolean" _gui-text="Hue">true</param>
+ <param name="saturation" type="boolean" _gui-text="Saturation">true</param>
+ <param name="lightness" type="boolean" _gui-text="Lightness">true</param>
+ </page>
+ <page name="Help" _gui-text="Help">
+ <_param name="instructions" type="description" xml:space="preserve">Converts to HSL, randomizes hue and/or saturation and/or lightness and converts it back to RGB.</_param>
+ </page>
+ </param>
<effect>
<object-type>all</object-type>
<effects-menu>
<script>
<command reldir="extensions" interpreter="python">color_randomize.py</command>
</script>
-</inkscape-extension>
\ No newline at end of file
+</inkscape-extension>
index e27970e523e8128d0f2cc16130ae9048b5681562..9ac9fb55349786dd27879baca15ec13d16bce71a 100644 (file)
action="store", type="inkbool",
dest="lightness", default=True,
help="randomize lightness")
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab",
+ help="The selected UI-tab when OK was pressed")
def colmod(self,r,g,b):
hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)
index 1eca17030b98ef82347d72422e5180ae926ee0fc..190418cac3deca4050a7ced9a499fbbd6bc29abf 100644 (file)
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="tab" type="notebook">
<page name="Options" _gui-text="Options">
- <param name="fontsize" type="string" _gui-text="Font size:">20</param>
+ <param name="fontsize" type="string" _gui-text="Font size:">20px</param>
<param name="dotsize" type="string" _gui-text="Dot size:">10px</param>
<param name="start" type="int" min="0" max="1000" _gui-text="Starting dot number:">1</param>
<param name="step" type="int" min="0" max="1000" _gui-text="Step:">1</param>
</page>
<page name="Help" _gui-text="Help">
<_param name="instructions" type="description" xml:space="preserve">This extension replaces the selection's nodes with numbered dots according to the following options:
- * Font size: size of the node number labels.
- * Dot size: diameter of the dots placed at path nodes.
+ * Font size: size of the node number labels (20px, 12pt...).
+ * Dot size: diameter of the dots placed at path nodes (10px, 2mm...).
* Starting dot number: first number in the sequence, assigned to the first node of the path.
* Step: numbering step between two nodes.</_param>
</page>
index eb4aabd84c3ca2393c4ce654eabcfdfa8da6ef4f..c3d3671c46151a8249e1d5736e4844744680fe62 100755 (executable)
--- a/share/extensions/dots.py
+++ b/share/extensions/dots.py
def __init__(self):
inkex.Effect.__init__(self)
- self.OptionParser.add_option("--tab",
- action="store", type="string",
- dest="tab")
self.OptionParser.add_option("-d", "--dotsize",
action="store", type="string",
dest="dotsize", default="10px",
action="store", type="int",
dest="step", default="1",
help="Numbering step between two nodes")
-
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab",
+ help="The selected UI-tab when OK was pressed")
+
+ def effect(self):
+ selection = self.selected
+ if (selection):
+ for id, node in selection.iteritems():
+ if node.tag == inkex.addNS('path','svg'):
+ self.addDot(node)
+ else:
+ inkex.errormsg("Please select an object.")
+
def separateLastAndFirst(self, p):
# Separate the last and first dot if they are togheter
lastDot = -1
p[lastDot][1][-2] += x * inkex.unittouu(self.options.dotsize)
p[lastDot][1][-1] += y * inkex.unittouu(self.options.dotsize)
+ def addDot(self, node):
+ self.group = inkex.etree.SubElement( node.getparent(), inkex.addNS('g','svg') )
+ self.dotGroup = inkex.etree.SubElement( self.group, inkex.addNS('g','svg') )
+ self.numGroup = inkex.etree.SubElement( self.group, inkex.addNS('g','svg') )
+
+ try:
+ t = node.get('transform')
+ self.group.set('transform', t)
+ except:
+ pass
- def effect(self):
- for id, node in self.selected.iteritems():
- if node.tag == inkex.addNS('path','svg'):
- self.group = inkex.etree.SubElement( node.getparent(), inkex.addNS('g','svg') )
- self.dotGroup = inkex.etree.SubElement( self.group, inkex.addNS('g','svg') )
- self.numGroup = inkex.etree.SubElement( self.group, inkex.addNS('g','svg') )
-
- try:
- t = node.get('transform')
- self.group.set('transform', t)
- except:
- pass
-
- style = simplestyle.formatStyle({ 'stroke': 'none', 'fill': '#000' })
- a = []
- p = simplepath.parsePath(node.get('d'))
-
- self.separateLastAndFirst(p)
+ style = simplestyle.formatStyle({ 'stroke': 'none', 'fill': '#000' })
+ a = []
+ p = simplepath.parsePath(node.get('d'))
- num = self.options.start
- for cmd,params in p:
- if cmd != 'Z' and cmd != 'z':
- dot_att = {
- 'style': style,
- 'r': str( inkex.unittouu(self.options.dotsize) / 2 ),
- 'cx': str( params[-2] ),
- 'cy': str( params[-1] )
- }
- inkex.etree.SubElement(
- self.dotGroup,
- inkex.addNS('circle','svg'),
- dot_att )
- self.addText(
- self.numGroup,
- params[-2] + ( inkex.unittouu(self.options.dotsize) / 2 ),
- params[-1] - ( inkex.unittouu(self.options.dotsize) / 2 ),
- num )
- num += self.options.step
- node.getparent().remove( node )
+ self.separateLastAndFirst(p)
+ num = self.options.start
+ for cmd,params in p:
+ if cmd != 'Z' and cmd != 'z':
+ dot_att = {
+ 'style': style,
+ 'r': str( inkex.unittouu(self.options.dotsize) / 2 ),
+ 'cx': str( params[-2] ),
+ 'cy': str( params[-1] )
+ }
+ inkex.etree.SubElement(
+ self.dotGroup,
+ inkex.addNS('circle','svg'),
+ dot_att )
+ self.addText(
+ self.numGroup,
+ params[-2] + ( inkex.unittouu(self.options.dotsize) / 2 ),
+ params[-1] - ( inkex.unittouu(self.options.dotsize) / 2 ),
+ num )
+ num += self.options.step
+ node.getparent().remove( node )
def addText(self,node,x,y,text):
new = inkex.etree.SubElement(node,inkex.addNS('text','svg'))
index e652945d8073ef2504b9e1512638da4a0ce49b9d..4447a275ea14915215a8bcd9d3a73b1921c47ad6 100644 (file)
<_item value="canvas">Canvas</_item>
<_item value="selection">Selection</_item>
</param>
- <param name="unit" _gui-text="Unit" type="optiongroup" appearance="minimal">
+ <param name="unit" _gui-text="Unit:" type="optiongroup" appearance="minimal">
<option value="px">px</option>
<option value="pt">pt</option>
<option value="in">in</option>
index 775f6b6431f39e1efae7f2739f9ff95511bb9bc1..041025708bfd8dbdcd94eb9f42b59041f85ada1a 100644 (file)
def __init__(self):
inkex.Effect.__init__(self)
- self.OptionParser.add_option("--tab",
- action="store", type="string",
- dest="tab")
self.OptionParser.add_option("--where",
action="store", type="string",
dest="where_to_crop", default=True,
action="store", type="float",
dest="bleed_right", default=0,
help="Bleed Right Size")
-
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab",
+ help="The selected UI-tab when OK was pressed")
def draw_crop_line(self, x1, y1, x2, y2, name, parent):
style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width),