X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96bfd05319f9e393843e84ca5274d85ff248bad4..a49afa93ca428a2236d5bc76f628241036f01629:/wxPython/tools/img2py.py diff --git a/wxPython/tools/img2py.py b/wxPython/tools/img2py.py index d6e7a0f0af..5a3ad806cc 100644 --- a/wxPython/tools/img2py.py +++ b/wxPython/tools/img2py.py @@ -32,7 +32,7 @@ Options: -import sys, os, glob, getopt, tempfile +import sys, os, glob, getopt, tempfile, string import cPickle, cStringIO, zlib import img2xpm @@ -40,11 +40,20 @@ import img2xpm def crunch_data(data, compressed): # convert the lines to a Python list, pickle it and compress the result. lines = [] - for line in data[2:]: # skip the first two lines - lines.append(line[1:-3]) # chop one char from the front and three from the end + for line in data: + if line[0] == "\"": + # the line is typically (but not always): + # [quote] [quote][comma][newline] + + # chop one char from the front + line = line[1:] + + # now find the final quote and truncate there + quote = string.rfind(line, "\"") + + # and append the remaining data to our list + lines.append(line[:quote]) - # chop one extra char from the last line - lines[-1] = lines[-1][:-1] # pickle, crunch and convert it to a form suitable for embedding in code data = cPickle.dumps(lines)