diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2010-08-31 17:07:19 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2010-08-31 17:07:19 +0000 |
| commit | 3fe874dd534b869edfef586ee1f7fff3f42856f3 (patch) | |
| tree | fa92814b2d6ef8da24ed86a1ec338bd21ca8eaa3 | |
| parent | Extensions. Number dots improvements (Bug #615313). (diff) | |
| download | inkscape-3fe874dd534b869edfef586ee1f7fff3f42856f3.tar.gz inkscape-3fe874dd534b869edfef586ee1f7fff3f42856f3.zip | |
Extensions:
* Number node cleanup.
* New help tab in color>randomize.
* Printing marks consistency fix.
(bzr r9736)
| -rw-r--r-- | share/extensions/color_randomize.inx | 15 | ||||
| -rw-r--r-- | share/extensions/color_randomize.py | 4 | ||||
| -rw-r--r-- | share/extensions/dots.inx | 6 | ||||
| -rwxr-xr-x | share/extensions/dots.py | 90 | ||||
| -rw-r--r-- | share/extensions/printing-marks.inx | 2 | ||||
| -rw-r--r-- | share/extensions/printing-marks.py | 8 |
6 files changed, 71 insertions, 54 deletions
diff --git a/share/extensions/color_randomize.inx b/share/extensions/color_randomize.inx index a6fdb7256..82691f0f4 100644 --- a/share/extensions/color_randomize.inx +++ b/share/extensions/color_randomize.inx @@ -5,9 +5,16 @@ <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> @@ -17,4 +24,4 @@ <script> <command reldir="extensions" interpreter="python">color_randomize.py</command> </script> -</inkscape-extension>
\ No newline at end of file +</inkscape-extension> diff --git a/share/extensions/color_randomize.py b/share/extensions/color_randomize.py index e27970e52..9ac9fb553 100644 --- a/share/extensions/color_randomize.py +++ b/share/extensions/color_randomize.py @@ -16,6 +16,10 @@ class C(coloreffect.ColorEffect): 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) diff --git a/share/extensions/dots.inx b/share/extensions/dots.inx index 1eca17030..190418cac 100644 --- a/share/extensions/dots.inx +++ b/share/extensions/dots.inx @@ -6,15 +6,15 @@ <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> diff --git a/share/extensions/dots.py b/share/extensions/dots.py index eb4aabd84..c3d3671c4 100755 --- a/share/extensions/dots.py +++ b/share/extensions/dots.py @@ -22,9 +22,6 @@ class Dots(inkex.Effect): 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", @@ -41,7 +38,20 @@ class Dots(inkex.Effect): 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 @@ -62,47 +72,43 @@ class Dots(inkex.Effect): 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')) diff --git a/share/extensions/printing-marks.inx b/share/extensions/printing-marks.inx index e652945d8..4447a275e 100644 --- a/share/extensions/printing-marks.inx +++ b/share/extensions/printing-marks.inx @@ -19,7 +19,7 @@ <_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> diff --git a/share/extensions/printing-marks.py b/share/extensions/printing-marks.py index 775f6b643..041025708 100644 --- a/share/extensions/printing-marks.py +++ b/share/extensions/printing-marks.py @@ -36,9 +36,6 @@ class Printing_Marks (inkex.Effect): 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, @@ -91,7 +88,10 @@ class Printing_Marks (inkex.Effect): 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), |
