Now that XPMs can be written in wxGTK, updated my conversion tools to
actually do it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,7 +32,7 @@ Options:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import sys, os, glob, getopt, tempfile
|
import sys, os, glob, getopt, tempfile, string
|
||||||
import cPickle, cStringIO, zlib
|
import cPickle, cStringIO, zlib
|
||||||
import img2xpm
|
import img2xpm
|
||||||
|
|
||||||
@@ -40,11 +40,20 @@ import img2xpm
|
|||||||
def crunch_data(data, compressed):
|
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 compress the result.
|
||||||
lines = []
|
lines = []
|
||||||
for line in data[2:]: # skip the first two lines
|
for line in data:
|
||||||
lines.append(line[1:-3]) # chop one char from the front and three from the end
|
if line[0] == "\"":
|
||||||
|
# the line is typically (but not always):
|
||||||
|
# [quote] <data> [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
|
# pickle, crunch and convert it to a form suitable for embedding in code
|
||||||
data = cPickle.dumps(lines)
|
data = cPickle.dumps(lines)
|
||||||
|
@@ -25,11 +25,8 @@ Options:
|
|||||||
import sys, os, glob, getopt, string
|
import sys, os, glob, getopt, string
|
||||||
from wxPython.wx import *
|
from wxPython.wx import *
|
||||||
|
|
||||||
if wxPlatform == "__WXGTK__":
|
|
||||||
raise SystemExit, "This tool can not be used on wxGTK until wxGTK can save XPM files."
|
|
||||||
|
|
||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
|
app = wxPySimpleApp() # just to let global initialization to take place...
|
||||||
|
|
||||||
def convert(file, maskClr, outputDir, outputName):
|
def convert(file, maskClr, outputDir, outputName):
|
||||||
if string.lower(os.path.splitext(file)[1]) == ".ico":
|
if string.lower(os.path.splitext(file)[1]) == ".ico":
|
||||||
|
Reference in New Issue
Block a user