Code

Extensions. Number dots improvements (Bug #615313).
authorJazzyNico <nicoduf@yahoo.fr>
Tue, 31 Aug 2010 06:56:30 +0000 (08:56 +0200)
committerJazzyNico <nicoduf@yahoo.fr>
Tue, 31 Aug 2010 06:56:30 +0000 (08:56 +0200)
share/extensions/dots.inx
share/extensions/dots.py

index 4655f838b8722f8156324ea23dddbda5d73dfdb5..1eca17030b98ef82347d72422e5180ae926ee0fc 100644 (file)
@@ -4,8 +4,22 @@
     <id>org.ekips.filter.dots</id>
        <dependency type="executable" location="extensions">dots.py</dependency>
        <dependency type="executable" location="extensions">inkex.py</dependency>
-       <param name="fontsize" type="string" _gui-text="Font size">20</param>
-       <param name="dotsize" type="string" _gui-text="Dot size">10px</param>
+       <param name="tab" type="notebook">
+        <page name="Options" _gui-text="Options">
+               <param name="fontsize" type="string" _gui-text="Font size:">20</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.
+    * Starting dot number: first number in the sequence, assigned to the first node of the path.
+    * Step: numbering step between two nodes.</_param>
+        </page>
+    </param>        
+
     <effect>
                <object-type>path</object-type>
                 <effects-menu>
index aa33b39ac7d0b3460943c182e4cb7b76659a6e04..eb4aabd84c3ca2393c4ce654eabcfdfa8da6ef4f 100755 (executable)
@@ -22,6 +22,9 @@ 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",
@@ -30,8 +33,15 @@ class Dots(inkex.Effect):
                         action="store", type="string",
                         dest="fontsize", default="20",
                         help="Size of node label numbers")
-
-
+        self.OptionParser.add_option("-s", "--start",
+                        action="store", type="int",
+                        dest="start", default="1",
+                        help="First number in the sequence, assigned to the first node")
+        self.OptionParser.add_option("-t", "--step",
+                        action="store", type="int",
+                        dest="step", default="1",
+                        help="Numbering step between two nodes")
+                        
     def separateLastAndFirst(self, p):
         # Separate the last and first dot if they are togheter
         lastDot = -1
@@ -72,7 +82,7 @@ class Dots(inkex.Effect):
 
                 self.separateLastAndFirst(p)
 
-                num = 1
+                num = self.options.start
                 for cmd,params in p:
                     if cmd != 'Z' and cmd != 'z':
                         dot_att = {
@@ -90,7 +100,7 @@ class Dots(inkex.Effect):
                           params[-2] + ( inkex.unittouu(self.options.dotsize) / 2 ),
                           params[-1] - ( inkex.unittouu(self.options.dotsize) / 2 ),
                           num )
-                        num += 1
+                        num += self.options.step
                 node.getparent().remove( node )