More lib and demo patches to drop the wx prefix (Jeff has been busy!)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24965 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-12-22 19:09:54 +00:00
parent 88568e48e4
commit d4b73b1b8e
62 changed files with 865 additions and 580 deletions

View File

@@ -7,6 +7,10 @@
# Copyright: (c) 2002 by Will Sadkin, 2002
# License: wxWindows license
#----------------------------------------------------------------------------
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o V2.5 compatability update
#
"""
This module provides a useful debugging framework that supports
@@ -217,20 +221,22 @@ class Logger:
#------------------------------------------------------------
if __name__ == "__main__":
from wxPython.wx import *
wxLog_SetActiveTarget( wxLogStderr() )
import sys
import wx
wx.Log_SetActiveTarget( wx.LogStderr() )
logger = Logger('module')
dbg = logger.dbg
dbg(enable=1)
logger('test __call__ interface')
dbg('testing wxLog output to stderr:', wxlog=1, indent=1)
dbg('1,2,3...')
dbg('testing wxLogNull:')
devnull = wxLogNull()
dbg('testing wx.LogNull:')
devnull = wx.LogNull()
dbg('4,5,6...') # shouldn't print, according to doc...
del devnull
dbg('(resuming to wxLogStdErr)', '7,8,9...', indent=0)
dbg('disabling wxLog output, switching to stderr:')
dbg('(resuming to wx.LogStdErr)', '7,8,9...', indent=0)
dbg('disabling wx.Log output, switching to stderr:')
dbg(wxlog=0, stream=sys.stderr)
dbg(logger._outstream, 'switching back to stdout:')
dbg(stream=None)

View File

@@ -8,25 +8,31 @@
# Copyright: (c) 2002 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o V2.5 compatability update
#
import getopt
import glob
import os
import sys
import sys, os, glob, getopt
from wxPython.wx import *
import wx
def convert(file, maskClr, outputDir, outputName, outType, outExt):
if os.path.splitext(file)[1].lower() == ".ico":
icon = wxIcon(file, wxBITMAP_TYPE_ICO)
img = wxBitmapFromIcon(icon)
icon = wx.Icon(file, wx.BITMAP_TYPE_ICO)
img = wx.BitmapFromIcon(icon)
else:
img = wxBitmap(file, wxBITMAP_TYPE_ANY)
img = wx.Bitmap(file, wx.BITMAP_TYPE_ANY)
if not img.Ok():
return 0, file + " failed to load!"
else:
if maskClr:
om = img.GetMask()
mask = wxMaskColour(img, maskClr)
mask = wx.MaskColour(img, maskClr)
img.SetMask(mask)
if om is not None:
om.Destroy()
@@ -38,7 +44,7 @@ def convert(file, maskClr, outputDir, outputName, outType, outExt):
if img.SaveFile(newname, outType):
return 1, file + " converted to " + newname
else:
img = wxImageFromBitmap(img)
img = wx.ImageFromBitmap(img)
if img.SaveFile(newname, outType):
return 1, "ok"
else:

View File

@@ -8,6 +8,10 @@
# Copyright: (c) 2002 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o V2.5 compatability update
#
"""
img2png.py -- convert several image formats to PNG format
@@ -32,15 +36,16 @@ Options:
"""
import sys
import img2img
from wxPython import wx
import sys
import wx
import img2img
def main():
# some bitmap related things need to have a wxApp initialized...
if wx.wxGetApp() is None:
app = wx.wxPySimpleApp()
img2img.main(sys.argv[1:], wx.wxBITMAP_TYPE_PNG, ".png", __doc__)
if wx.GetApp() is None:
app = wx.PySimpleApp()
img2img.main(sys.argv[1:], wx.BITMAP_TYPE_PNG, ".png", __doc__)
if __name__ == '__main__':
main()

View File

@@ -8,6 +8,10 @@
# Copyright: (c) 2002 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o V2.5 compatability update
#
"""
@@ -54,12 +58,23 @@ Options:
# - Cliff Wells <LogiplexSoftware@earthlink.net>
# 20021206: Added catalog (-c) option.
#
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o V2.5 compatability update
#
import cPickle
import cStringIO
import getopt
import glob
import os
import sys
import tempfile
import zlib
import sys, os, glob, getopt, tempfile
import cPickle, cStringIO, zlib
import img2img
from wxPython import wx
import wx
import img2img
def crunch_data(data, compressed):
@@ -116,8 +131,8 @@ def main(args):
return
# some bitmap related things need to have a wxApp initialized...
if wx.wxGetApp() is None:
app = wx.wxPySimpleApp()
if wx.GetApp() is None:
app = wx.PySimpleApp()
append = 0
compressed = 1
@@ -154,7 +169,7 @@ def main(args):
# convert the image file to a temporary file
tfname = tempfile.mktemp()
ok, msg = img2img.convert(image_file, maskClr, None, tfname, wx.wxBITMAP_TYPE_PNG, ".png")
ok, msg = img2img.convert(image_file, maskClr, None, tfname, wx.BITMAP_TYPE_PNG, ".png")
if not ok:
print msg
return
@@ -198,9 +213,9 @@ def main(args):
out.write("#" + "-" * 70 + "\n")
if not append:
out.write("# This file was generated by %s\n#\n" % sys.argv[0])
out.write("from wxPython.wx import wxImageFromStream, wxBitmapFromImage\n")
out.write("from wx import ImageFromStream, BitmapFromImage\n")
if icon:
out.write("from wxPython.wx import wxEmptyIcon\n")
out.write("from wx import EmptyIcon\n")
if compressed:
out.write("import cStringIO, zlib\n\n\n")
else:
@@ -222,14 +237,14 @@ def main(args):
out.write("def get%sBitmap():\n"
" return wxBitmapFromImage(get%sImage())\n\n"
" return BitmapFromImage(get%sImage())\n\n"
"def get%sImage():\n"
" stream = cStringIO.StringIO(get%sData())\n"
" return wxImageFromStream(stream)\n\n"
" return ImageFromStream(stream)\n\n"
% tuple([imgName] * 4))
if icon:
out.write("def get%sIcon():\n"
" icon = wxEmptyIcon()\n"
" icon = EmptyIcon()\n"
" icon.CopyFromBitmap(get%sBitmap())\n"
" return icon\n\n"
% tuple([imgName] * 2))

View File

@@ -8,6 +8,10 @@
# Copyright: (c) 2002 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o V2.5 compatability update
#
"""
img2xpm.py -- convert several image formats to XPM
@@ -31,16 +35,17 @@ Options:
the -o option.
"""
import sys
import sys
import img2img
from wxPython import wx
import wx
import img2img
def main():
# some bitmap related things need to have a wxApp initialized...
if wx.wxGetApp() is None:
app = wx.wxPySimpleApp()
img2img.main(sys.argv[1:], wx.wxBITMAP_TYPE_XPM, ".xpm", __doc__)
if wx.GetApp() is None:
app = wx.PySimpleApp()
img2img.main(sys.argv[1:], wx.BITMAP_TYPE_XPM, ".xpm", __doc__)
if __name__ == '__main__':