]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/tools/XRCed/encode_bitmaps.py
Allow AutoCompletion for items in collections too
[wxWidgets.git] / wxPython / wx / tools / XRCed / encode_bitmaps.py
CommitLineData
68ae5821
RD
1"""
2A simple script to encode all the images the XRCed needs into a Python module
3"""
1fded56b 4
d14a1e28 5import sys, os, glob
68ae5821 6from wx.tools import img2py
d14a1e28 7
68ae5821
RD
8def main():
9 output = 'images.py'
d14a1e28 10
68ae5821
RD
11 # get the list of PNG files
12 files = glob.glob('src-images/*.png')
13 files.sort()
d14a1e28 14
68ae5821
RD
15 # Truncate the inages module
16 open(output, 'w')
d14a1e28 17
68ae5821
RD
18 # call img2py on each file
19 for file in files:
d14a1e28 20
68ae5821
RD
21 # extract the basename to be used as the image name
22 name = os.path.splitext(os.path.basename(file))[0]
d14a1e28 23
68ae5821
RD
24 # encode it
25 if file == files[0]:
26 cmd = "-u -i -n %s %s %s" % (name, file, output)
27 else:
28 cmd = "-a -u -i -n %s %s %s" % (name, file, output)
29 img2py.main(cmd.split())
d14a1e28
RD
30
31
68ae5821
RD
32if __name__ == "__main__":
33 main()
1fded56b 34