]>
Commit | Line | Data |
---|---|---|
1 | """ | |
2 | A simple script to encode all the images the XRCed needs into a Python module | |
3 | """ | |
4 | ||
5 | import sys, os, glob | |
6 | from wx.tools import img2py | |
7 | ||
8 | def main(): | |
9 | output = 'images.py' | |
10 | ||
11 | # get the list of PNG files | |
12 | files = glob.glob('src-images/*.png') | |
13 | files.sort() | |
14 | ||
15 | # Truncate the inages module | |
16 | open(output, 'w') | |
17 | ||
18 | # call img2py on each file | |
19 | for file in files: | |
20 | ||
21 | # extract the basename to be used as the image name | |
22 | name = os.path.splitext(os.path.basename(file))[0] | |
23 | ||
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()) | |
30 | ||
31 | ||
32 | if __name__ == "__main__": | |
33 | main() | |
34 |