Allow generating only the UI for certain elements
This commit is contained in:
parent
0a78664589
commit
69397fcb97
1 changed files with 6 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python3.6
|
#!/usr/bin/python3.6
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from subprocess import run, DEVNULL
|
from subprocess import run, DEVNULL
|
||||||
|
|
||||||
multipliers = [0.75, 1.0, 1.25, 1.5, 2.0, 4.0]
|
multipliers = [0.75, 1.0, 1.25, 1.5, 2.0, 4.0]
|
||||||
|
@ -45,6 +46,7 @@ cells = [
|
||||||
inkscape_default_dpi = 90
|
inkscape_default_dpi = 90
|
||||||
svg = 'buttons.svg'
|
svg = 'buttons.svg'
|
||||||
root = '../android/assets/ui'
|
root = '../android/assets/ui'
|
||||||
|
gen_only = sys.argv[1:]
|
||||||
|
|
||||||
for multiplier in multipliers:
|
for multiplier in multipliers:
|
||||||
folder = os.path.join(root, f'x{multiplier}')
|
folder = os.path.join(root, f'x{multiplier}')
|
||||||
|
@ -53,6 +55,8 @@ for multiplier in multipliers:
|
||||||
dpi = int(inkscape_default_dpi * multiplier)
|
dpi = int(inkscape_default_dpi * multiplier)
|
||||||
print('Generating assets for', folder)
|
print('Generating assets for', folder)
|
||||||
for objectid in ids:
|
for objectid in ids:
|
||||||
|
if gen_only and objectid not in gen_only:
|
||||||
|
continue
|
||||||
filename = os.path.join(folder, objectid + '.png')
|
filename = os.path.join(folder, objectid + '.png')
|
||||||
# -z not to use the X server
|
# -z not to use the X server
|
||||||
# -i to select the given object id
|
# -i to select the given object id
|
||||||
|
@ -65,6 +69,8 @@ for multiplier in multipliers:
|
||||||
folder = os.path.join(folder, 'cells')
|
folder = os.path.join(folder, 'cells')
|
||||||
os.makedirs(folder, exist_ok=True)
|
os.makedirs(folder, exist_ok=True)
|
||||||
for cellid in cells:
|
for cellid in cells:
|
||||||
|
if gen_only and cellid not in gen_only:
|
||||||
|
continue
|
||||||
filename = os.path.join(folder, cellid + '.png')
|
filename = os.path.join(folder, cellid + '.png')
|
||||||
run(f'inkscape -z -i{cellid} -j -e{filename} -d{dpi} {svg}',
|
run(f'inkscape -z -i{cellid} -j -e{filename} -d{dpi} {svg}',
|
||||||
shell=True, stdout=DEVNULL)
|
shell=True, stdout=DEVNULL)
|
||||||
|
|
Loading…
Reference in a new issue