Code

fixes: menu, name, encoding
authorbuliabyak <buliabyak@users.sourceforge.net>
Fri, 24 Nov 2006 02:16:33 +0000 (02:16 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Fri, 24 Nov 2006 02:16:33 +0000 (02:16 +0000)
share/extensions/G2Pngs.inx [deleted file]
share/extensions/G2Pngs.py [deleted file]
share/extensions/Makefile.am
share/extensions/g2pngs.inx [new file with mode: 0644]
share/extensions/g2pngs.py [new file with mode: 0644]

diff --git a/share/extensions/G2Pngs.inx b/share/extensions/G2Pngs.inx
deleted file mode 100644 (file)
index cd81bea..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<inkscape-extension>
-    <_name>Groups to Pngs</_name>
-    <id>org.ekips.filter.G2Pngs</id>
-       <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
-       <dependency type="executable" location="extensions">G2Pngs.py</dependency>
-       <dependency type="executable" location="extensions">inkex.py</dependency>
-        <param name="directory" type="string" _gui-text="Directory">/home/</param>
-        <param name="layers" type="boolean" _gui-text="Save layers only"></param>
-    <effect>
-                <extension>.png</extension>
-                <mimetype>application/x-png</mimetype>
-                <_filetypename>Export each group to a png</_filetypename>
-                <_filetypetooltip>Export each group to a png</_filetypetooltip>
-                <dataloss>TRUE</dataloss>
-                <effects-menu>
-                    <submenu _name="Recursive actions"/>
-                </effects-menu>
-    </effect>
-    <script>
-        <command reldir="extensions" interpreter="python">G2Pngs.py</command>
-    </script>
-</inkscape-extension>
diff --git a/share/extensions/G2Pngs.py b/share/extensions/G2Pngs.py
deleted file mode 100644 (file)
index 8c4c5d9..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python 
-'''
-Copyright (C) 2006 Aaron Spike, aaron@ekips.org
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-TODO :
-specify save format, scale, and if it is a layer or g export
-
-RELEASE NOTE
-- accepte l'export des calques
-- dossier par défaut = dossier utilisateur
-- crée le dossier spécifié s'il n'existe pas
-
-'''
-import inkex
-import sys, os, tempfile
-
-class MyEffect(inkex.Effect):
-        def __init__(self):
-                inkex.Effect.__init__(self)
-               self.OptionParser.add_option("-d", "--directory",
-                                               action="store", type="string", 
-                                               dest="directory", default=os.path.expanduser("~"),
-                                               help="Existing destination directory")
-               self.OptionParser.add_option("-l", "--layers",
-                                               action="store", type="inkbool", 
-                                               dest="layers", default=False,
-                                               help="Save layers with their groups")
-               '''self.OptionParser.add_option("-s", "--scale",
-                                               action="store", type="float", 
-                                               dest="scale", default=100,
-                                               help="Scales the group at the specified value")
-               self.OptionParser.add_option("-f", "--format",
-                                               action="store", type="string", 
-                                               dest="format", default="png",
-                                               help="Save at the specified format [only PNG implemented yet]") 
-               '''
-       def output(self):
-               pass
-       
-       def effect(self):
-               svg_file = self.args[-1]
-               node = inkex.xml.xpath.Evaluate('/svg',self.document)[0]
-               '''docname = node.attributes.getNamedItemNS(inkex.NSS[u'sodipodi'],'docname').value[:-4]'''
-
-               #create os temp dir
-               '''tmp_dir = tempfile.mkdtemp()'''
-               directory = self.options.directory
-               """area = '--export-area-canvas'"""
-               pngs = []
-               if self.options.layers:
-                       path = "/svg/*[name()='g' or @style][@id]"
-               else:
-                       path = "/svg/g/*[name()='g' or @style][@id]"
-               
-               for node in inkex.xml.xpath.Evaluate(path,self.document):
-                       id = node.attributes.getNamedItem('id').value
-                       name = "%s.png" % id
-                       filename = os.path.join(directory, name)
-                       command = "inkscape -i %s -e %s %s " % (id, filename, svg_file)
-                       f = os.popen(command,'r')
-                       f.read()
-                       f.close()
-                       pngs.append(filename)
-
-e = MyEffect()
-e.affect()
\ No newline at end of file
index be3e3d1183b51ac951b90737ace5131f7bfb1484..97935125b10ab3beb9e3c0b2b839e2e5e215e7fa 100644 (file)
@@ -77,7 +77,8 @@ extensions = \
        color_lesshue.py\
        pathalongpath.py\
        rubberstretch.py\
-       pathmodifier.py
+       pathmodifier.py\
+       g2pngs.py
 
 
 otherstuff = \
@@ -150,7 +151,8 @@ modules = \
        color_lesslight.inx\
        color_morehue.inx\
        color_lesshue.inx\
-       pathalongpath.inx
+       pathalongpath.inx\
+       g2pngs.inx
 
 
 extension_SCRIPTS = \
diff --git a/share/extensions/g2pngs.inx b/share/extensions/g2pngs.inx
new file mode 100644 (file)
index 0000000..b3c1ffb
--- /dev/null
@@ -0,0 +1,18 @@
+<inkscape-extension>
+    <_name>Groups to PNGs</_name>
+    <id>org.inkscape.output.g2PNGs</id>
+       <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
+       <dependency type="executable" location="extensions">g2pngs.py</dependency>
+       <dependency type="executable" location="extensions">inkex.py</dependency>
+        <param name="directory" type="string" _gui-text="Directory">/home/</param>
+        <param name="layers" type="boolean" _gui-text="Save layers only"></param>
+    <effect>
+                <object-type>all</object-type>
+                <effects-menu>
+                      <submenu _name="Export"/>
+                </effects-menu>
+    </effect>
+    <script>
+        <command reldir="extensions" interpreter="python">g2pngs.py</command>
+    </script>
+</inkscape-extension>
diff --git a/share/extensions/g2pngs.py b/share/extensions/g2pngs.py
new file mode 100644 (file)
index 0000000..c6af84a
--- /dev/null
@@ -0,0 +1,80 @@
+#!/usr/bin/env python 
+'''
+Copyright (C) 2006 Aaron Spike, aaron@ekips.org
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+TODO :
+specify save format, scale, and if it is a layer or g export
+
+RELEASE NOTE
+- accepte l'export des calques
+- dossier par defaut = dossier utilisateur
+- cree le dossier specifie s'il n'existe pas
+
+'''
+import inkex
+import sys, os, tempfile
+
+class MyEffect(inkex.Effect):
+        def __init__(self):
+                inkex.Effect.__init__(self)
+               self.OptionParser.add_option("-d", "--directory",
+                                               action="store", type="string", 
+                                               dest="directory", default=os.path.expanduser("~"),
+                                               help="Existing destination directory")
+               self.OptionParser.add_option("-l", "--layers",
+                                               action="store", type="inkbool", 
+                                               dest="layers", default=False,
+                                               help="Save layers with their groups")
+               '''self.OptionParser.add_option("-s", "--scale",
+                                               action="store", type="float", 
+                                               dest="scale", default=100,
+                                               help="Scales the group at the specified value")
+               self.OptionParser.add_option("-f", "--format",
+                                               action="store", type="string", 
+                                               dest="format", default="png",
+                                               help="Save at the specified format [only PNG implemented yet]") 
+               '''
+       def output(self):
+               pass
+       
+       def effect(self):
+               svg_file = self.args[-1]
+               node = inkex.xml.xpath.Evaluate('/svg',self.document)[0]
+               '''docname = node.attributes.getNamedItemNS(inkex.NSS[u'sodipodi'],'docname').value[:-4]'''
+
+               #create os temp dir
+               '''tmp_dir = tempfile.mkdtemp()'''
+               directory = self.options.directory
+               """area = '--export-area-canvas'"""
+               pngs = []
+               if self.options.layers:
+                       path = "/svg/*[name()='g' or @style][@id]"
+               else:
+                       path = "/svg/g/*[name()='g' or @style][@id]"
+               
+               for node in inkex.xml.xpath.Evaluate(path,self.document):
+                       id = node.attributes.getNamedItem('id').value
+                       name = "%s.png" % id
+                       filename = os.path.join(directory, name)
+                       command = "inkscape -i %s -e %s %s " % (id, filename, svg_file)
+                       f = os.popen(command,'r')
+                       f.read()
+                       f.close()
+                       pngs.append(filename)
+
+e = MyEffect()
+e.affect()
\ No newline at end of file