from jmwright 72b67da
This commit is contained in:
30
collect_icons.py
Normal file
30
collect_icons.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from glob import glob
|
||||
from subprocess import call
|
||||
from os import remove
|
||||
|
||||
TEMPLATE = \
|
||||
'''<RCC>
|
||||
<qresource prefix="/images">
|
||||
{}
|
||||
</qresource>
|
||||
</RCC>'''
|
||||
|
||||
ITEM_TEMPLATE = '<file>{}</file>'
|
||||
|
||||
QRC_OUT = 'icons.qrc'
|
||||
RES_OUT = 'src/icons_res.py'
|
||||
TOOL = 'pyrcc5'
|
||||
|
||||
items = []
|
||||
|
||||
for i in glob('icons/*.svg'):
|
||||
items.append(ITEM_TEMPLATE.format(i))
|
||||
|
||||
|
||||
qrc_text = TEMPLATE.format('\n'.join(items))
|
||||
|
||||
with open(QRC_OUT,'w') as f:
|
||||
f.write(qrc_text)
|
||||
|
||||
call([TOOL,QRC_OUT,'-o',RES_OUT])
|
||||
remove(QRC_OUT)
|
||||
Reference in New Issue
Block a user