]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/tools/img2xpm.py
Changed WXUNUSED to WXUNUSED_UNLESS_DEBUG
[wxWidgets.git] / wxPython / tools / img2xpm.py
index e77109596875e4e800786a8558478edde7fefc7f..0f71d510560e0cee953f09f6af98eaa8c346bba8 100644 (file)
@@ -8,7 +8,7 @@ Usage:
 
 Options:
 
-    -o <dir>       The directory to place the .xmp file(s), defaults to
+    -o <dir>       The directory to place the .xpm file(s), defaults to
                    the current directory.
 
     -m <#rrggbb>   If the original image has a mask or transparency defined
@@ -24,8 +24,13 @@ Options:
 
 import sys, os, glob, getopt, string
 from wxPython.wx import *
+
 wxInitAllImageHandlers()
 
+if wxPlatform == "__WXGTK__":
+    app = wxPySimpleApp()     # Blech!  the GUI needs initialized before
+                              # bitmaps can be created...
+
 
 def convert(file, maskClr, outputDir, outputName):
     if string.lower(os.path.splitext(file)[1]) == ".ico":
@@ -50,7 +55,11 @@ def convert(file, maskClr, outputDir, outputName):
         if img.SaveFile(newname, wxBITMAP_TYPE_XPM):
             return 1, file + " converted to " + newname
         else:
-            return 0, file + " failed to save!"
+            img = wxImageFromBitmap(img)
+            if img.SaveFile(newname, wxBITMAP_TYPE_XPM):
+                return 1, "ok"
+            else:
+                return 0, file + " failed to save!"