Code

Updated the JessyInk extensions to version 1.5.4.
[inkscape.git] / share / extensions / jessyInk_transitions.py
index d35477d2070de7d73c2e57719d3fadd63dc1139a..77953216876b4e52d2a720f3e9b61898ae1758f3 100755 (executable)
@@ -25,6 +25,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
 
 # We will use the inkex module with the predefined Effect base class.
 import inkex
+import gettext
+_ = gettext.gettext
 
 class JessyInk_Transitions(inkex.Effect):
        def __init__(self):
@@ -42,17 +44,17 @@ class JessyInk_Transitions(inkex.Effect):
 
        def effect(self):
                # Check version.
-               scriptNodes = self.document.xpath("//svg:script[@jessyink:version='1.5.1']", namespaces=inkex.NSS)
+               scriptNodes = self.document.xpath("//svg:script[@jessyink:version='1.5.4']", namespaces=inkex.NSS)
 
                if len(scriptNodes) != 1:
-                       sys.stderr.write("The JessyInk script is not installed in this SVG file or has a different version than the JessyInk extensions. Please select \"install/update...\" from the \"JessyInk\" sub-menu of the \"Effects\" menu to install or update the JessyInk script.\n\n")
+                       inkex.errormsg(_("The JessyInk script is not installed in this SVG file or has a different version than the JessyInk extensions. Please select \"install/update...\" from the \"JessyInk\" sub-menu of the \"Extensions\" menu to install or update the JessyInk script.\n\n"))
 
                if self.options.layerName != "":
-                       nodes = self.document.xpath("//*[@inkscape:groupmode='layer' and @inkscape:label='" + self.options.layerName + "']", namespaces=inkex.NSS)
+                       nodes = self.document.xpath(unicode("//*[@inkscape:groupmode='layer' and @inkscape:label='" + self.options.layerName + "']", 'utf-8'), namespaces=inkex.NSS)
                        if len(nodes) == 0:
-                               sys.stderr.write("Layer not found.\n")
+                               inkex.errormsg(_("Layer not found.\n"))
                        elif len(nodes) > 1:
-                               sys.stderr.write("More than one layer with this name found.\n")
+                               inkex.errormsg(_("More than one layer with this name found.\n"))
                        else:
                                if self.options.effectIn == "default":
                                        if nodes[0].get("{" + inkex.NSS["jessyink"] + "}transitionIn"):
@@ -65,7 +67,7 @@ class JessyInk_Transitions(inkex.Effect):
                                else:
                                        nodes[0].set("{" + inkex.NSS["jessyink"] + "}transitionOut","name:" + self.options.effectOut + ";length:" + str(int(self.options.effectOutDuration * 1000)))
                else:
-                       sys.stderr.write("Please enter a layer name.\n")
+                       inkex.errormsg(_("Please enter a layer name.\n"))
 
 # Create effect instance
 effect = JessyInk_Transitions()