]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/tools/img2py.py
compilation fix
[wxWidgets.git] / wxPython / tools / img2py.py
index 5a3ad806ccaaadf579e368b3b8b22a2694d363ce..4b9204123fedb2ff87fb7599601276f353128d7e 100644 (file)
@@ -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")