summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Steiner <jimmac@gmail.com>2016-06-29 16:12:05 +0200
committerJakub Steiner <jimmac@gmail.com>2016-06-29 16:20:16 +0200
commit38c05dd04491374d6f99030a615a1005319c82a2 (patch)
tree37debdc914df959171d492954a439dd5a0a01ae4
parent0d6d4a952d8e74c5d1c19c3fe900186fe5b800e0 (diff)
downloadadwaita-icon-theme-wip/lasem-rendering.tar.gz
initial lasem renderingwip/lasem-rendering
-rwxr-xr-xrender-icon-theme.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/render-icon-theme.py b/render-icon-theme.py
index a36f3c257..24226fd65 100755
--- a/render-icon-theme.py
+++ b/render-icon-theme.py
@@ -6,8 +6,10 @@ import xml.sax
import subprocess
INKSCAPE = '/usr/bin/inkscape'
+LASEM = '/opt/gnome/bin/lasem-render-0.6'
OPTIPNG = '/usr/bin/optipng'
SRC = os.path.join('.', 'src', 'fullcolor')
+RENDERER = 'lasem'
inkscape_process = None
@@ -36,12 +38,17 @@ def start_inkscape():
wait_for_prompt(process)
return process
-def inkscape_render_rect(icon_file, rect, output_file):
- global inkscape_process
- if inkscape_process is None:
- inkscape_process = start_inkscape()
- wait_for_prompt(inkscape_process, '%s -i %s -e %s' % (icon_file, rect, output_file))
- optimize_png(output_file)
+def render_rect(icon_file, rect, output_file):
+ if RENDERER=='inkscape':
+ global inkscape_process
+ if inkscape_process is None:
+ inkscape_process = start_inkscape()
+ wait_for_prompt(inkscape_process, '%s -i %s -e %s' % (icon_file, rect, output_file))
+ optimize_png(output_file)
+ else:
+ subprocess.call([LASEM,icon_file, "-i", rect, "-o", output_file])
+ optimize_png(output_file)
+
class ContentHandler(xml.sax.ContentHandler):
ROOT = 0
@@ -127,13 +134,13 @@ class ContentHandler(xml.sax.ContentHandler):
os.makedirs(dir)
# Do a time based check!
if self.force or not os.path.exists(outfile):
- inkscape_render_rect(self.path, id, outfile)
+ render_rect(self.path, id, outfile)
sys.stdout.write('.')
else:
stat_in = os.stat(self.path)
stat_out = os.stat(outfile)
if stat_in.st_mtime > stat_out.st_mtime:
- inkscape_render_rect(self.path, id, outfile)
+ render_rect(self.path, id, outfile)
sys.stdout.write('.')
else:
sys.stdout.write('-')