Code

Extensions. XAML export improvements.
[inkscape.git] / share / extensions / pathalongpath.py
index f02a69d50827f349861cdf909443395f288bae66..7a2fa09eabffe05ec601bc3a1b84a713dad89fed 100644 (file)
@@ -33,8 +33,9 @@ they move and rotate, deforming the pattern.
 
 import inkex, cubicsuperpath, bezmisc
 import pathmodifier,simpletransform
-
 import copy, math, re, random
+import gettext
+_ = gettext.gettext
 
 def flipxy(path):
     for pathcomp in path:
@@ -116,6 +117,10 @@ class PathAlongPath(pathmodifier.Diffeo):
                         action="store", type="inkbool", 
                         dest="duplicate", default=False,
                         help="duplicate pattern before deformation")
+        self.OptionParser.add_option("--tab",
+                        action="store", type="string",
+                        dest="tab",
+                        help="The selected UI-tab when OK was pressed")
 
     def prepareSelectionList(self):
 
@@ -193,7 +198,7 @@ class PathAlongPath(pathmodifier.Diffeo):
 
     def effect(self):
         if len(self.options.ids)<2:
-            inkex.debug("This extension requires that you select two paths.")
+            inkex.errormsg(_("This extension requires two selected paths."))
             return
         self.prepareSelectionList()
         self.options.wave = (self.options.kind=="Ribbon")
@@ -215,9 +220,11 @@ class PathAlongPath(pathmodifier.Diffeo):
         if self.options.vertical:
             #flipxy(bbox)...
             bbox=(-bbox[3],-bbox[2],-bbox[1],-bbox[0])
-            
+
         width=bbox[1]-bbox[0]
         dx=width+self.options.space
+        if dx < 0.01:
+            exit(_("The total length of the pattern is too small :\nPlease choose a larger object or set 'Space between copies' > 0"))
 
         for id, node in self.patterns.iteritems():
             if node.tag == inkex.addNS('path','svg') or node.tag=='path':
@@ -272,8 +279,9 @@ class PathAlongPath(pathmodifier.Diffeo):
 
                 node.set('d', cubicsuperpath.formatPath(newp))
 
-e = PathAlongPath()
-e.affect()
+if __name__ == '__main__':
+    e = PathAlongPath()
+    e.affect()
 
                     
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99