X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7905ec5558bb5fe7bcaab231503112a6bf815580..761df41e86ceeed56d32c038a6c9f88554d4f47a:/wxPython/tools/img2py.py?ds=inline diff --git a/wxPython/tools/img2py.py b/wxPython/tools/img2py.py index 5a3ad806cc..4b9204123f 100644 --- a/wxPython/tools/img2py.py +++ b/wxPython/tools/img2py.py @@ -38,7 +38,7 @@ import img2xpm def crunch_data(data, compressed): - # convert the lines to a Python list, pickle it and compress the result. + # convert the lines to a Python list, pickle it and optionally compress the result. lines = [] for line in data: if line[0] == "\"": @@ -68,6 +68,7 @@ def crunch_data(data, compressed): c = i = 0 word = "" octdigits = "01234567" + hexdigits = "0123456789abcdef" while i < len(data): if data[i] != "\\": word = data[i] @@ -79,9 +80,16 @@ def crunch_data(data, compressed): break word = data[i:i+n] i = i + n + elif data[i+1] == 'x': + for n in range(2, 5): + if data[i+n] not in hexdigits: + break + word = data[i:i+n] + i = i + n else: word = data[i:i+2] i = i + 2 + l = len(word) if c + l >= 78-1: fp.write("\\\n")