Rename wx.Platform* to wx.Port*. Renable wx.PySimpleApp with a deprecation wrapper.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2010-12-04 00:28:19 +00:00
parent 84c12b120b
commit a16f7ef06b
3 changed files with 37 additions and 33 deletions

View File

@@ -178,11 +178,10 @@ logged in on the main display of your Mac."""
def OnPreInit(self):
"""
Things that must be done after _BootstrapApp has done its
thing, but would be nice if they were already done by the time
that OnInit is called.
Things that must be done after _BootstrapApp has done its thing, but
would be nice if they were already done by the time that OnInit is
called.
"""
print 'OnPreInit'
## wx.StockGDI._initStockObjects()
@@ -224,9 +223,9 @@ logged in on the main display of your Mac."""
def SetOutputWindowAttributes(self, title=None, pos=None, size=None):
"""
Set the title, position and/or size of the output window if
the stdio has been redirected. This should be called before
any output would cause the output window to be created.
Set the title, position and/or size of the output window if the stdio
has been redirected. This should be called before any output would
cause the output window to be created.
"""
if self.stdioWin:
if title is not None:
@@ -236,28 +235,28 @@ logged in on the main display of your Mac."""
if size is not None:
self.stdioWin.size = size
## #----------------------------------------------------------------------------
#----------------------------------------------------------------------------
## # TODO: Move this someplace else?
## def deprecated(func):
## def new_func(*args, **kwargs):
## import warnings
## warnings.warn("Call to deprecated function %s." % func.__name__,
## category=DeprecationWarning)
## return func(*args, **kwargs)
## new_func.__name__ = func.__name__
## new_func.__doc__ = func.__doc__
## new_func.__dict__.update(func.__dict__)
## return new_func
# TODO: Move this someplace else?
def deprecated(func):
def new_func(*args, **kwargs):
import warnings
warnings.warn("Call to deprecated item %s." % func.__name__,
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
## @deprecated
## class PySimpleApp(App):
## """
## This class is deprecated. Please use wx.App isntead.
## """
## def __init__(self, *args, **kw):
## App.__init__(self, *args, **kw)
@deprecated
class PySimpleApp(App):
"""
This class is deprecated. Please use wx.App instead.
"""
def __init__(self, *args, **kw):
App.__init__(self, *args, **kw)
## #----------------------------------------------------------------------------

View File

@@ -15,19 +15,19 @@ del _core
def version():
"""Returns a string containing version and port info"""
if wx.Platform == '__WXMSW__':
if wx.Port == '__WXMSW__':
port = 'msw'
elif wx.Platform == '__WXMAC__':
if 'wxOSX-carbon' in wx.PlatformInfo:
elif wx.Port == '__WXMAC__':
if 'wxOSX-carbon' in wx.PortInfo:
port = 'osx-carbon'
else:
port = 'osx-cocoa'
elif wx.Platform == '__WXGTK__':
elif wx.Port == '__WXGTK__':
port = 'gtk'
if 'gtk2' in wx.PlatformInfo:
if 'gtk2' in wx.PortInfo:
port = 'gtk2'
else:
port = '?'
port = '???'
return "%s %s" % (wx.VERSION_STRING, port)

View File

@@ -19,6 +19,11 @@ class App(unittest2.TestCase):
app = MyApp()
self.assertTrue(app.onInit_called)
def test_version(self):
v = wx.version()
def test_PySimpleApp(self):
app = wx.PySimpleApp()
#---------------------------------------------------------------------------