Allow generating only the UI for certain elements

This commit is contained in:
Lonami Exo 2017-05-09 17:36:36 +02:00
parent 0a78664589
commit 69397fcb97

View file

@ -1,6 +1,7 @@
#!/usr/bin/python3.6
import os
import sys
from subprocess import run, DEVNULL
multipliers = [0.75, 1.0, 1.25, 1.5, 2.0, 4.0]
@ -45,6 +46,7 @@ cells = [
inkscape_default_dpi = 90
svg = 'buttons.svg'
root = '../android/assets/ui'
gen_only = sys.argv[1:]
for multiplier in multipliers:
folder = os.path.join(root, f'x{multiplier}')
@ -53,6 +55,8 @@ for multiplier in multipliers:
dpi = int(inkscape_default_dpi * multiplier)
print('Generating assets for', folder)
for objectid in ids:
if gen_only and objectid not in gen_only:
continue
filename = os.path.join(folder, objectid + '.png')
# -z not to use the X server
# -i to select the given object id
@ -65,6 +69,8 @@ for multiplier in multipliers:
folder = os.path.join(folder, 'cells')
os.makedirs(folder, exist_ok=True)
for cellid in cells:
if gen_only and cellid not in gen_only:
continue
filename = os.path.join(folder, cellid + '.png')
run(f'inkscape -z -i{cellid} -j -e{filename} -d{dpi} {svg}',
shell=True, stdout=DEVNULL)