]> git.saurik.com Git - wxWidgets.git/commitdiff
Will raise the SystemExit exception now on wxGTK since wxGTK can not
authorRobin Dunn <robin@alldunn.com>
Mon, 9 Apr 2001 21:15:44 +0000 (21:15 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 9 Apr 2001 21:15:44 +0000 (21:15 +0000)
save XPM files. <grumble>

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/tools/img2xpm.py

index e77109596875e4e800786a8558478edde7fefc7f..0f3874524ec8b0653a3087372898d1a90fd5c42f 100644 (file)
@@ -24,6 +24,10 @@ Options:
 
 import sys, os, glob, getopt, string
 from wxPython.wx import *
+
+if wxPlatform == "__WXGTK__":
+    raise SystemExit, "This tool can not be used on wxGTK until wxGTK can save XPM files."
+
 wxInitAllImageHandlers()
 
 
@@ -50,7 +54,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!"
 
 
 
@@ -91,6 +99,9 @@ def main(args):
 
 
 if __name__ == "__main__":
+    if wxPlatform == "__WXGTK__":
+        app = wxPySimpleApp()     # Blech!  the GUI needs initialized before
+                                  # bitmaps can be created...
     main(sys.argv[1:])