Code

Updated the JessyInk extensions to version 1.5.4.
authorHannes Hochreiner <hannes@hochreiner.net>
Fri, 29 Oct 2010 17:09:35 +0000 (19:09 +0200)
committerHannes Hochreiner <hannes@hochreiner.net>
Fri, 29 Oct 2010 17:09:35 +0000 (19:09 +0200)
15 files changed:
share/extensions/jessyInk_autoTexts.py
share/extensions/jessyInk_effects.inx
share/extensions/jessyInk_effects.py
share/extensions/jessyInk_export.py
share/extensions/jessyInk_install.py
share/extensions/jessyInk_keyBindings.inx
share/extensions/jessyInk_keyBindings.py
share/extensions/jessyInk_masterSlide.py
share/extensions/jessyInk_mouseHandler.py
share/extensions/jessyInk_summary.inx
share/extensions/jessyInk_summary.py
share/extensions/jessyInk_transitions.inx
share/extensions/jessyInk_transitions.py
share/extensions/jessyInk_video.py
share/extensions/jessyInk_view.py

index a9873e2fcfe2c7cebe30fb5d98d60bc451a053c7..57566888f8dd3654a37cfe80785a887af7a2f08b 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_AutoTexts(inkex.Effect):
        def __init__(self):
@@ -38,19 +40,19 @@ class JessyInk_AutoTexts(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 len(self.selected) == 0:
-                       sys.stderr.write("To assign an effect, please select an object.\n")
+                       inkex.errormsg(_("To assign an effect, please select an object.\n\n"))
 
                for id, node in self.selected.items():
                        nodes = node.xpath("./svg:tspan", namespaces=inkex.NSS)
 
                        if len(nodes) != 1:
-                               sys.stderr.write("Node with id '" + str(id) + "' is not a suitable text node and was therefore ignored.\n")
+                               inkex.errormsg(_("Node with id '{0}' is not a suitable text node and was therefore ignored.\n\n").format(str(id)))
                        else:
                                if self.options.autoText == "slideTitle":
                                        nodes[0].set("{" + inkex.NSS["jessyink"] + "}autoText","slideTitle")
index a0ff98ae91951f363a741b1072e9eda32484cc23..3a8a03df87687098777904e808b160f18c63cb06 100644 (file)
@@ -6,7 +6,7 @@
   <dependency type="executable" location="extensions">jessyInk_effects.py</dependency>
   <param name="tab" type="notebook">
     <page name="settings" _gui-text="Settings">
-                       <_param name="effectInLabel" type="groupheader">Build-in effect</_param>
+                       <_param name="effectInLabel" type="description">Build-in effect</_param>
                        <param name="effectInOrder" type="int" min="1" max="100" _gui-text="Order:">1</param>
                        <param name="effectInDuration" precision="1" type="float" min="0.1" max="10.0" _gui-text="Duration in seconds:">0.8</param>
                        <param name="effectIn" type="optiongroup" _gui-text="Type:">
@@ -15,7 +15,7 @@
         <_option value="fade">Fade</_option>
         <_option value="pop">Pop</_option>
                        </param>
-                       <_param name="effectOutLabel" type="groupheader">Build-out effect</_param>
+                       <_param name="effectOutLabel" type="description">Build-out effect</_param>
                        <param name="effectOutOrder" type="int" min="1" max="100" _gui-text="Order:">1</param>
                        <param name="effectOutDuration" precision="1" type="float" min="0.1" max="10.0" _gui-text="Duration in seconds:">0.8</param>
                        <param name="effectOut" type="optiongroup" _gui-text="Type:">
index 862e55001e8d82991ff0befa53cc62f528fb9a53..336d0ee4e9dfce6dc3667080a2bf1b78ee31cbd1 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_Effects(inkex.Effect):
        def __init__(self):
@@ -43,13 +45,13 @@ class JessyInk_Effects(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 len(self.selected) == 0:
-                       sys.stderr.write("No object selected. Please select the object you want to assign an effect to and then press apply.\n")
+                       inkex.errormsg(_("No object selected. Please select the object you want to assign an effect to and then press apply.\n"))
 
                for id, node in self.selected.items():
                        if (self.options.effectIn == "appear") or (self.options.effectIn == "fade") or (self.options.effectIn == "pop"):
index 6f9bf9eccb1e6ef14589a60de066eb8edef92f4f..65247ab7eb0de843c858479d8b0f7e58a4e43b11 100755 (executable)
@@ -30,6 +30,8 @@ import os
 import zipfile
 import glob
 import re
+import gettext
+_ = gettext.gettext
 
 def propStrToDict(inStr):
        dictio = {}
@@ -77,7 +79,7 @@ class MyEffect(inkex.Effect):
                self.inkscapeCommand = self.findInkscapeCommand()
 
                if (self.inkscapeCommand == None):
-                       sys.stderr.write("Could not find Inkscape command.\n")
+                       inkex.errormsg(_("Could not find Inkscape command.\n"))
                        sys.exit(1)
 
        def output(self):
@@ -91,7 +93,7 @@ class MyEffect(inkex.Effect):
                scriptNodes = self.document.xpath("//svg:script[@jessyink:version]", namespaces=inkex.NSS)
 
                if len(scriptNodes) != 0:
-                       sys.stderr.write("The JessyInk-script is present in this SVG file. This indicates that the presentation has not been properly exported. Please visit code.goolge.com/p/jessyink to find information on how to export a JessyInk presentation.\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"))
 
                zipFileDesc, zpFile = tempfile.mkstemp(suffix=".zip", prefix="jessyInk__")
 
index f966152893ca423e38fc5622419bb336fcfc3060..331b2d232e913691c78778cb32f1a5696d58c8d3 100755 (executable)
@@ -60,7 +60,7 @@ class JessyInk_Install(inkex.Effect):
                scriptElm = inkex.etree.Element(inkex.addNS("script", "svg"))
                scriptElm.text = open(os.path.join(os.path.dirname(__file__),   "jessyInk.js")).read()
                scriptElm.set("id","JessyInk")
-               scriptElm.set("{" + inkex.NSS["jessyink"] + "}version", "1.5.1")
+               scriptElm.set("{" + inkex.NSS["jessyink"] + "}version", '1.5.4')
                self.document.getroot().append(scriptElm)
 
                # Remove "jessyInkInit()" in the "onload" attribute, if present.
index 96507912705a682ce1dca047d955ca2a9f1a89d5..843957c0d39fe248acb9654d8f0e376bfd39f2bf 100644 (file)
                        <param name="slide_addSlide" type="string" _gui-text="Add slide:">n</param>
                        <param name="slide_toggleProgressBar" type="string" _gui-text="Toggle progress bar:">p</param>
                        <param name="slide_resetTimer" type="string" _gui-text="Reset timer:">t</param>
+                       <param name="slide_export" type="string" _gui-text="Export presentation:">e</param>
                </page>
     <page name="settings" _gui-text="Drawing mode">
-                       <param name="drawing_switchToSlideMode" type="string" _gui-text="Switch to slide mode:">d</param>
+                       <param name="drawing_switchToSlideMode" type="string" _gui-text="Switch to slide mode:">ESCAPE, d</param>
                        <param name="drawing_pathWidthDefault" type="string" _gui-text="Set path width to default:">0</param>
                        <param name="drawing_pathWidth1" type="string" _gui-text="Set path width to 1:">1</param>
                        <param name="drawing_pathWidth3" type="string" _gui-text="Set path width to 3:">3</param>
index 45c0fe2ef6331e92f402cbb4db2f1bda809e5606..3f2ed34e9edface5fa1926276c43f13601974393 100755 (executable)
@@ -25,10 +25,12 @@ 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_CustomKeyBindings(inkex.Effect):
        modes = ('slide', 'index', 'drawing')
-       keyCodes = ('LEFT', 'RIGHT', 'DOWN', 'UP', 'HOME', 'END', 'ENTER', 'SPACE', 'PAGE_UP', 'PAGE_DOWN')
+       keyCodes = ('LEFT', 'RIGHT', 'DOWN', 'UP', 'HOME', 'END', 'ENTER', 'SPACE', 'PAGE_UP', 'PAGE_DOWN', 'ESCAPE')
        slideActions = {}
        slideCharCodes = {}
        slideKeyCodes = {}
@@ -57,6 +59,7 @@ class JessyInk_CustomKeyBindings(inkex.Effect):
                self.OptionParser.add_option('--slide_addSlide', action = 'callback', type = 'string', callback = self.slideOptions, default = '')
                self.OptionParser.add_option('--slide_toggleProgressBar', action = 'callback', type = 'string', callback = self.slideOptions, default = '')
                self.OptionParser.add_option('--slide_resetTimer', action = 'callback', type = 'string', callback = self.slideOptions, default = '')
+               self.OptionParser.add_option('--slide_export', action = 'callback', type = 'string', callback = self.slideOptions, default = '')
                self.OptionParser.add_option('--drawing_switchToSlideMode', action = 'callback', type = 'string', callback = self.drawingOptions, default = '')
                self.OptionParser.add_option('--drawing_pathWidthDefault', action = 'callback', type = 'string', callback = self.drawingOptions, default = '')
                self.OptionParser.add_option('--drawing_pathWidth1', action = 'callback', type = 'string', callback = self.drawingOptions, default = '')
@@ -105,6 +108,7 @@ class       JessyInk_CustomKeyBindings(inkex.Effect):
                self.slideActions["addSlide"] = "slideAddSlide(activeSlide);"
                self.slideActions["toggleProgressBar"] = "slideToggleProgressBarVisibility();"
                self.slideActions["resetTimer"] = "slideResetTimer();"
+               self.slideActions["export"] = "slideUpdateExportLayer();"
 
                self.drawingActions["switchToSlideMode"] = "drawingSwitchToSlideMode();"
                self.drawingActions["pathWidthDefault"] = "drawingResetPathWidth();"
@@ -178,10 +182,10 @@ class     JessyInk_CustomKeyBindings(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"))
 
                # Remove old master slide property
                for node in self.document.xpath("//svg:g[@jessyink:customKeyBindings='customKeyBindings']", namespaces=inkex.NSS):
index 9089215d96dfa13f3a5e9704e91436254f6334a6..41f0f8c7134080b737ad38d898c71cd7932f708c 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_MasterSlide(inkex.Effect):
        def __init__(self):
@@ -38,10 +40,10 @@ class JessyInk_MasterSlide(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"))
 
                # Remove old master slide property
                for node in self.document.xpath("//*[@jessyink:masterSlide='masterSlide']", namespaces=inkex.NSS):
@@ -51,9 +53,9 @@ class JessyInk_MasterSlide(inkex.Effect):
                if self.options.layerName != "":
                        nodes = self.document.xpath("//*[@inkscape:groupmode='layer' and @inkscape:label='" + self.options.layerName + "']", namespaces=inkex.NSS)
                        if len(nodes) == 0:
-                               sys.stderr.write("Layer not found. Removed current master slide selection.\n")
+                               inkex.errormsg(_("Layer not found. Removed current master slide selection.\n"))
                        elif len(nodes) > 1:
-                               sys.stderr.write("More than one layer with this name found. Removed current master slide selection.\n")
+                               inkex.errormsg(_("More than one layer with this name found. Removed current master slide selection.\n"))
                        else:
                                nodes[0].set("{" + inkex.NSS["jessyink"] + "}masterSlide","masterSlide")
 
index a0c06c196eeec8c98cc87205ff3e8c100a8cdf7c..f35a65bf55661440bce70a31e95d4617bef3b828 100755 (executable)
@@ -27,6 +27,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_CustomMouseHandler(inkex.Effect):
        def __init__(self):
@@ -40,10 +42,10 @@ class       JessyInk_CustomMouseHandler(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"))
 
                # Remove old mouse handler
                for node in self.document.xpath("//jessyink:mousehandler", namespaces=inkex.NSS):
index 37bc206fc78fd651bfa54d663258634444a27495..e661efd3e03611d2b1f7b375ff458b520c720b73 100644 (file)
@@ -6,7 +6,8 @@
   <dependency type="executable" location="extensions">jessyInk_summary.py</dependency>
   <param name="tab" type="notebook">
     <page name="help" _gui-text="Help">
-                       <_param name="help_text" type="description">This extension allows you to obtain information about the JessyInk script, effects and transitions contained in this SVG file. Please see code.google.com/p/jessyink for more details.</_param>
+                       <_param name="help_text" type="description">This extension allows you to obtain information about the JessyInk script, effects and transitions contained in this SVG file. Please see code.google.com/p/jessyink for more details.
+                       </_param>
     </page>
        </param>
   <effect>
index 56cec0308fb5c2b8fad7d275b429ae91f7c31305..f4b3d8d3815840591476dd6ba6a74073c4655936 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
 
 def propStrToList(str):
        list = []
@@ -56,19 +58,17 @@ class JessyInk_Summary(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"))
 
                # Find the script node, if present
                for node in self.document.xpath("//svg:script[@id='JessyInk']", namespaces=inkex.NSS):
-                       sys.stderr.write("JessyInk script ")
-
                        if node.get("{" + inkex.NSS["jessyink"] + "}version"):
-                               sys.stderr.write("version " + node.get("{" + inkex.NSS["jessyink"] + "}version") + " ")
-
-                       sys.stderr.write("installed.\n")
+                               inkex.errormsg(_("JessyInk script version {0} installed.").format(node.get("{" + inkex.NSS["jessyink"] + "}version")))
+                       else:
+                               inkex.errormsg(_("JessyInk script installed."))
        
                slides = []
                masterSlide = None 
@@ -80,50 +80,47 @@ class JessyInk_Summary(inkex.Effect):
                                slides.append(node)
 
                if masterSlide is not None:
-                       sys.stderr.write("\nMaster slide:\n")
+                       inkex.errormsg(_("\nMaster slide:"))
                        self.describeNode(masterSlide, "\t", "<the number of the slide>", str(len(slides)), "<the title of the slide>")
 
                slideCounter = 1
 
                for slide in slides:
-                       sys.stderr.write("\nSlide " + str(slideCounter) + ":\n")
+                       inkex.errormsg(_("\nSlide {0!s}:").format(slideCounter))
                        self.describeNode(slide, "\t", str(slideCounter), str(len(slides)), slide.get("{" + inkex.NSS["inkscape"] + "}label"))
                        slideCounter += 1
 
        def describeNode(self, node, prefix, slideNumber, numberOfSlides, slideTitle):
-               sys.stderr.write(prefix + "Layer name: " + node.get("{" + inkex.NSS["inkscape"] + "}label") + "\n")
+               inkex.errormsg(_(u"{0}Layer name: {1}").format(prefix, node.get("{" + inkex.NSS["inkscape"] + "}label")))
                
                # Display information about transitions.
                transitionInAttribute = node.get("{" + inkex.NSS["jessyink"] + "}transitionIn")
                if transitionInAttribute:
                        transInDict = propListToDict(propStrToList(transitionInAttribute))
-                       sys.stderr.write(prefix + "Transition in: " + transInDict["name"])
 
                        if (transInDict["name"] != "appear") and transInDict.has_key("length"):
-                               sys.stderr.write(" (" + str(int(transInDict["length"]) / 1000.0) + " s)")
-
-                       sys.stderr.write("\n")
+                               inkex.errormsg(_("{0}Transition in: {1} ({2!s} s)").format(prefix, transInDict["name"], int(transInDict["length"]) / 1000.0))
+                       else:
+                               inkex.errormsg(_("{0}Transition in: {1}").format(prefix, transInDict["name"]))
 
                transitionOutAttribute = node.get("{" + inkex.NSS["jessyink"] + "}transitionOut")
                if transitionOutAttribute:
                        transOutDict = propListToDict(propStrToList(transitionOutAttribute))
-                       sys.stderr.write(prefix + "Transition out: " + transOutDict["name"])
 
                        if (transOutDict["name"] != "appear") and transOutDict.has_key("length"):
-                               sys.stderr.write(" (" + str(int(transOutDict["length"]) / 1000.0) + " s)")
-
-                       sys.stderr.write("\n")
+                               inkex.errormsg(_("{0}Transition out: {1} ({2!s} s)").format(prefix, transOutDict["name"], int(transOutDict["length"]) / 1000.0))
+                       else:
+                               inkex.errormsg(_("{0}Transition out: {1}").format(prefix, transOutDict["name"]))
 
                # Display information about auto-texts.
                autoTexts = {"slideNumber" : slideNumber, "numberOfSlides" : numberOfSlides, "slideTitle" : slideTitle}
                autoTextNodes = node.xpath(".//*[@jessyink:autoText]", namespaces=inkex.NSS)
                
                if (len(autoTextNodes) > 0):
-                       sys.stderr.write("\n" + prefix + "Auto-texts:\n")
+                       inkex.errormsg(_("\n{0}Auto-texts:").format(prefix))
                        
                        for atNode in autoTextNodes:
-                               sys.stderr.write(prefix + "\t\"" + atNode.text + "\" (object id \"" + atNode.getparent().get("id") + "\") will be replaced by")
-                               sys.stderr.write(" \"" + autoTexts[atNode.get("{" + inkex.NSS["jessyink"] + "}autoText")] + "\".\n")
+                               inkex.errormsg(_("{0}\t\"{1}\" (object id \"{2}\") will be replaced by \"{3}\".").format(prefix, atNode.text, atNode.getparent().get("id"), autoTexts[atNode.get("{" + inkex.NSS["jessyink"] + "}autoText")]))
 
                # Collect information about effects.
                effects = {}
@@ -165,29 +162,31 @@ class JessyInk_Summary(inkex.Effect):
 
                # Display information about effects.
                for orderItem in order:
+                       tmpStr = ""
+
                        if orderNumber == 0:
-                               sys.stderr.write("\n" + prefix + "Initial effect (order number " + effects[orderItem][0]["order"]  + "):\n")
+                               tmpStr += _("\n{0}Initial effect (order number {1}):").format(prefix, effects[orderItem][0]["order"])
                        else:
-                               sys.stderr.write("\n" + prefix + "Effect " + str(orderNumber) + " (order number " + effects[orderItem][0]["order"]  + "):\n")
+                               tmpStr += _("\n{0}Effect {1!s} (order number {2}):").format(prefix, orderNumber, effects[orderItem][0]["order"])
                
                        for item in effects[orderItem]:
                                if item["type"] == "view":
-                                       sys.stderr.write(prefix + "\tView will be set according to object \"" + item["id"] + "\"")
+                                       tmpStr += _("{0}\tView will be set according to object \"{1}\"").format(prefix, item["id"])
                                else:
-                                       sys.stderr.write(prefix + "\tObject \"" + item["id"] + "\"")
+                                       tmpStr += _("{0}\tObject \"{1}\"").format(prefix, item["id"])
        
                                        if item["direction"] == "in":
-                                               sys.stderr.write(" will appear")
+                                               tmpStr += _(" will appear")
                                        elif item["direction"] == "out":
-                                               sys.stderr.write(" will disappear")
+                                               tmpStr += _(" will disappear")
        
                                if item["name"] != "appear":
-                                       sys.stderr.write(" using effect \"" + item["name"] + "\"")
+                                       tmpStr += _(" using effect \"{0}\"").format(item["name"])
                                        
                                if item.has_key("length"):
-                                       sys.stderr.write(" in " + str(int(item["length"]) / 1000.0) + " s")
+                                       tmpStr += _(" in {0!s} s").format(int(item["length"]) / 1000.0)
 
-                               sys.stderr.write(".\n")
+                               inkex.errormsg(tmpStr + ".\n")
 
                        orderNumber += 1
 
index bf794e9cf1c427c620a716d6c70cbbc955c227b9..1599d2c20cf90f316d26cbdcab5bbbaf05d1db28 100644 (file)
@@ -7,7 +7,7 @@
   <param name="tab" type="notebook">
     <page name="settings" _gui-text="Settings">
                        <param name="layerName" type="string" _gui-text="Name of layer:"></param>
-                       <_param name="effectInLabel" type="groupheader">Transition in effect</_param>
+                       <_param name="effectInLabel" type="description">Transition in effect</_param>
                        <param name="effectInDuration" precision="1" type="float" min="0.1" max="10.0" _gui-text="Duration in seconds:">0.8</param>
                        <param name="effectIn" type="optiongroup" _gui-text="Type:">
         <_option value="default">Default</_option>
@@ -15,7 +15,7 @@
         <_option value="fade">Fade</_option>
         <_option value="pop">Pop</_option>
                        </param>
-                       <_param name="effectOutLabel" type="groupheader">Transition out effect</_param>
+                       <_param name="effectOutLabel" type="description">Transition out effect</_param>
                        <param name="effectOutDuration" precision="1" type="float" min="0.1" max="10.0" _gui-text="Duration in seconds:">0.8</param>
                        <param name="effectOut" type="optiongroup" _gui-text="Type:">
         <_option value="default">Default</_option>
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()
index 1d4ae0ee3a0e47ce9cc3072422a48ebfc589b864..222670b35fe4f9ada3a8371a28079c3519136aed 100755 (executable)
@@ -29,6 +29,8 @@ import os
 import re
 from lxml import etree
 from copy import deepcopy
+import gettext
+_ = gettext.gettext
 
 class JessyInk_Effects(inkex.Effect):
        def __init__(self):
@@ -41,20 +43,20 @@ class JessyInk_Effects(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"))
 
                baseView = self.document.xpath("//sodipodi:namedview[@id='base']", namespaces=inkex.NSS)
 
                if len(baseView) != 1:
-                       sys.stderr.write("Could not obtain the selected layer for inclusion of the video element.\n\n")
+                       inkex.errormsg(_("Could not obtain the selected layer for inclusion of the video element.\n\n"))
 
                layer = self.document.xpath("//svg:g[@id='" + baseView[0].attrib["{" + inkex.NSS["inkscape"] + "}current-layer"] + "']", namespaces=inkex.NSS)
 
                if (len(layer) != 1):
-                       sys.stderr.write("Could not obtain the selected layer for inclusion of the video element.\n\n")
+                       inkex.errormsg(_("Could not obtain the selected layer for inclusion of the video element.\n\n"))
 
                # Parse template file.
                tmplFile = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'jessyInk_video.svg'), 'r')
index 639cb6b474d79d5373d30b78b4cb42906c37d32f..ba9c4a6867101a74bbe6cad90828c3dbc5ea2f1d 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
 
 def propStrToList(str):
        list = []
@@ -59,10 +61,10 @@ class JessyInk_Effects(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"))
 
                rect = None
 
@@ -70,11 +72,11 @@ class JessyInk_Effects(inkex.Effect):
                        if rect == None:
                                rect = node
                        else:
-                               sys.stderr.write("More than one object selected. Please select only one object.\n")
+                               inkex.errormsg(_("More than one object selected. Please select only one object.\n"))
                                exit()
 
                if rect == None:
-                       sys.stderr.write("No object selected. Please select the object you want to assign a view to and then press apply.\n")
+                       inkex.errormsg(_("No object selected. Please select the object you want to assign a view to and then press apply.\n"))
                        exit()
 
                if not self.options.removeView: