Commit b8bfcc54 authored by Christian Hergert's avatar Christian Hergert

icons: fix alias for pattern svgs

parent 58d3f5dd
......@@ -164,23 +164,11 @@
<file>16x16/apps/org.gnome.Builder-symbolic.symbolic.png</file>
<file>32x32/apps/org.gnome.Builder-symbolic.symbolic.png</file>
<file>48x48/apps/org.gnome.Builder-symbolic.symbolic.png</file>
<file>98x98/actions/pattern-browse.symbolic.png</file>
<file>98x98/actions/pattern-cli.symbolic.png</file>
<file>98x98/actions/pattern-gnome.symbolic.png</file>
<file>98x98/actions/pattern-grid.symbolic.png</file>
<file>98x98/actions/pattern-legacy.symbolic.png</file>
<file>98x98/actions/pattern-library.symbolic.png</file>
<file>196x196/actions/pattern-browse.symbolic.png</file>
<file>196x196/actions/pattern-cli.symbolic.png</file>
<file>196x196/actions/pattern-gnome.symbolic.png</file>
<file>196x196/actions/pattern-grid.symbolic.png</file>
<file>196x196/actions/pattern-legacy.symbolic.png</file>
<file>196x196/actions/pattern-library.symbolic.png</file>
<file>294x294/actions/pattern-browse.symbolic.png</file>
<file>294x294/actions/pattern-cli.symbolic.png</file>
<file>294x294/actions/pattern-gnome.symbolic.png</file>
<file>294x294/actions/pattern-grid.symbolic.png</file>
<file>294x294/actions/pattern-legacy.symbolic.png</file>
<file>294x294/actions/pattern-library.symbolic.png</file>
<file alias="scalable/actions/pattern-legacy.svg">scalable/patterns/pattern-legacy.svg</file>
<file alias="scalable/actions/pattern-browse.svg">scalable/patterns/pattern-browse.svg</file>
<file alias="scalable/actions/pattern-library.svg">scalable/patterns/pattern-library.svg</file>
<file alias="scalable/actions/pattern-grid.svg">scalable/patterns/pattern-grid.svg</file>
<file alias="scalable/actions/pattern-cli.svg">scalable/patterns/pattern-cli.svg</file>
<file alias="scalable/actions/pattern-gnome.svg">scalable/patterns/pattern-gnome.svg</file>
</gresource>
</gresources>
#!/usr/bin/env python3
import os
import shutil
import sys
_resources = {}
_aliases = {}
def addResource(directory, name):
if directory not in _resources:
......@@ -17,6 +19,10 @@ def gtkEncodeSymbolicSvg(outdir, path, size):
print(cmd)
os.system(cmd)
# These just need to be aliased properly
for name in os.listdir('scalable/patterns'):
_aliases[os.path.join('scalable/actions', name)] = os.path.join('scalable/patterns', name)
# These need to be scaled as symbolic icons into
# 16 and their 2x and 3x counterparts
for dirname in ('actions', 'apps'):
......@@ -28,18 +34,6 @@ for dirname in ('actions', 'apps'):
symbolic_name = name[:-4] + '.symbolic.png'
addResource(outdir, symbolic_name)
# These need to be scaled as symbolic icons into
# 98x98 and 2x/3x.
for name in os.listdir('scalable/patterns'):
for size in (98, 196, 294):
outdir = '%dx%d/actions' % (size, size)
# GTK won't locate the icons in "patterns", so
# we instead put them in "actions".
path = os.path.join('scalable/patterns', name)
gtkEncodeSymbolicSvg(outdir, path, size)
symbolic_name = name[:-4] + '.symbolic.png'
addResource(outdir, symbolic_name)
# Now generate our updated .gresources.xml
with open("icons.gresource.xml", "w") as stream:
stream.write('''<?xml version="1.0" encoding="UTF-8"?>
......@@ -51,6 +45,8 @@ with open("icons.gresource.xml", "w") as stream:
names.sort()
for name in names:
stream.write(' <file>%s/%s</file>\n' % (dirname, name))
for alias, name in _aliases.items():
stream.write(' <file alias="%s">%s</file>\n' % (alias, name))
stream.write(''' </gresource>
</gresources>
''')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment