From bddab5e98b4381a706546c0b7ebd6ab1982041e3 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 9 Apr 2001 21:15:44 +0000 Subject: [PATCH] Will raise the SystemExit exception now on wxGTK since wxGTK can not save XPM files. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/tools/img2xpm.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wxPython/tools/img2xpm.py b/wxPython/tools/img2xpm.py index e771095968..0f3874524e 100644 --- a/wxPython/tools/img2xpm.py +++ b/wxPython/tools/img2xpm.py @@ -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:]) -- 2.45.2