summaryrefslogtreecommitdiffstats
path: root/share/extensions
diff options
context:
space:
mode:
authorSlagvi Public <JandotDarowskiattgmaildottcom>2013-09-21 22:15:43 +0000
committerSlagvi Public <JandotDarowskiattgmaildottcom>2013-09-21 22:15:43 +0000
commitfebaf7e22bf572e36e9511505aa77551be274c91 (patch)
tree0f825ed22433afd6563c43fba733a8651e05f79d /share/extensions
parentFixed segfault on copying text. (diff)
parentSmall style fixes. (diff)
downloadinkscape-febaf7e22bf572e36e9511505aa77551be274c91.tar.gz
inkscape-febaf7e22bf572e36e9511505aa77551be274c91.zip
Merge gsoc procedural templates work.
(bzr r12570)
Diffstat (limited to 'share/extensions')
-rw-r--r--share/extensions/Makefile.am2
-rw-r--r--share/extensions/empty_page.inx34
-rw-r--r--share/extensions/empty_page.py44
3 files changed, 80 insertions, 0 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am
index cc9b6b517..ffbe1ec77 100644
--- a/share/extensions/Makefile.am
+++ b/share/extensions/Makefile.am
@@ -54,6 +54,7 @@ extensions = \
edge3d.py \
embedimage.py \
embed_raster_in_svg.pl \
+ empty_page.py \
eqtexsvg.py \
export_gimp_palette.py \
extractimage.py \
@@ -238,6 +239,7 @@ modules = \
edge3d.inx \
embedimage.inx \
embedselectedimages.inx \
+ empty_page.inx \
eps_input.inx \
eqtexsvg.inx \
export_gimp_palette.inx \
diff --git a/share/extensions/empty_page.inx b/share/extensions/empty_page.inx
new file mode 100644
index 000000000..f3f60f796
--- /dev/null
+++ b/share/extensions/empty_page.inx
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape">
+ <_name>Empty Page</_name>
+ <id>org.inkscape.render.empty_page</id>
+ <dependency type="executable" location="extensions">empty_page.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+
+ <param name="size" _gui-text="Page size:" type="enum">
+ <item value="a3">A3</item>
+ <item value="a4">A4</item>
+ <item value="a5">A5</item>
+ <item value="letter">letter</item>
+ </param>
+
+ <param name="orientation" _gui-text="Page orientation:" type="enum">
+ <item value="horizontal">Horizontal</item>
+ <item value="vertical">Vertical</item>
+ </param>
+
+ <effect needs-live-preview="false">
+ <object-type>all</object-type>
+ <effects-menu hidden="true" />
+ </effect>
+ <inkscape:_templateinfo>
+ <inkscape:_name>Empty page</inkscape:_name>
+ <inkscape:author>Jan Darowski</inkscape:author>
+ <inkscape:_shortdesc>Empty page of chosen size.</inkscape:_shortdesc>
+ <inkscape:date>2013-09-10</inkscape:date>
+ <inkscape:_keywords>empty sheet a4 a3 a5 letter</inkscape:_keywords>
+ </inkscape:_templateinfo>
+ <script>
+ <command reldir="extensions" interpreter="python">empty_page.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/empty_page.py b/share/extensions/empty_page.py
new file mode 100644
index 000000000..dc16bab97
--- /dev/null
+++ b/share/extensions/empty_page.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+import inkex
+
+class C(inkex.Effect):
+ def __init__(self):
+ inkex.Effect.__init__(self)
+ self.OptionParser.add_option("-s", "--size", action="store", type="string", dest="page_size", default="a4", help="Page size")
+ self.OptionParser.add_option("-o", "--orientation", action="store", type="string", dest="page_orientation", default="vertical", help="Page orientation")
+
+ def effect(self):
+ root = self.document.getroot()
+ root.set("width", "12in")
+ root.set("height", "12in")
+ if self.options.page_size == "a4" and self.options.page_orientation == "vertical":
+ root.set("width", "210mm")
+ root.set("height", "297mm")
+ if self.options.page_size == "a4" and self.options.page_orientation == "horizontal":
+ root.set("height", "210mm")
+ root.set("width", "297mm")
+
+ if self.options.page_size == "a5" and self.options.page_orientation == "vertical":
+ root.set("width", "148mm")
+ root.set("height", "210mm")
+ if self.options.page_size == "a5" and self.options.page_orientation == "horizontal":
+ root.set("width", "210mm")
+ root.set("height", "148mm")
+
+ if self.options.page_size == "a3" and self.options.page_orientation == "vertical":
+ root.set("width", "297mm")
+ root.set("height", "420mm")
+ if self.options.page_size == "a3" and self.options.page_orientation == "horizontal":
+ root.set("width", "420mm")
+ root.set("height", "297mm")
+
+ if self.options.page_size == "letter" and self.options.page_orientation == "vertical":
+ root.set("width", "8.5in")
+ root.set("height", "11in")
+ if self.options.page_size == "letter" and self.options.page_orientation == "horizontal":
+ root.set("width", "11in")
+ root.set("height", "8.5in")
+
+c = C()
+c.affect()