Added an option to also ouput a function to create a wxIcon from the data.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-01-28 23:08:47 +00:00
parent 033424480e
commit 7fa0effc0e

View File

@ -28,6 +28,8 @@ Options:
-u Don't use compression. Leaves the data uncompressed. -u Don't use compression. Leaves the data uncompressed.
-i Also output a function to return the image as a wxIcon.
""" """
@ -111,9 +113,10 @@ def main(args):
compressed = 1 compressed = 1
maskClr = None maskClr = None
imgName = "" imgName = ""
icon = 0
try: try:
opts, fileArgs = getopt.getopt(args, "aun:m:") opts, fileArgs = getopt.getopt(args, "auin:m:")
except getopt.GetoptError: except getopt.GetoptError:
print __doc__ print __doc__
return return
@ -127,6 +130,8 @@ def main(args):
imgName = val imgName = val
elif opt == "-m": elif opt == "-m":
maskClr = val maskClr = val
elif opt == "-i":
icon = 1
if len(fileArgs) != 2: if len(fileArgs) != 2:
print __doc__ print __doc__
@ -154,6 +159,8 @@ def main(args):
if not append: if not append:
out.write("# This file was generated by %s\n#\n" % sys.argv[0]) out.write("# This file was generated by %s\n#\n" % sys.argv[0])
out.write("from wxPython.wx import wxBitmapFromXPMData, wxImageFromBitmap\n") out.write("from wxPython.wx import wxBitmapFromXPMData, wxImageFromBitmap\n")
if icon:
out.write("from wxPython.wx import wxIconFromXPMData\n")
if compressed: if compressed:
out.write("import cPickle, zlib\n\n\n") out.write("import cPickle, zlib\n\n\n")
else: else:
@ -174,6 +181,11 @@ def main(args):
"def get%sImage():\n" "def get%sImage():\n"
" return wxImageFromBitmap(get%sBitmap())\n\n" " return wxImageFromBitmap(get%sBitmap())\n\n"
% tuple([imgName] * 4)) % tuple([imgName] * 4))
if icon:
out.write("def get%sIcon():\n"
" return wxIconFromXPMData(get%sData())\n\n"
% tuple([imgName] * 2))
if imgName: if imgName:
n_msg = ' using "%s"' % imgName n_msg = ' using "%s"' % imgName