X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8feec28c876b20dd98f1c73c694493ab2973226f..6caa0f5cd18fe9fb39c207d5f31fa5633479a822:/wxPython/src/_core_ex.py diff --git a/wxPython/src/_core_ex.py b/wxPython/src/_core_ex.py index 2cd3fe4b6f..bd9ecf759e 100644 --- a/wxPython/src/_core_ex.py +++ b/wxPython/src/_core_ex.py @@ -30,6 +30,24 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION: import warnings warnings.warn("wxPython/wxWidgets release number mismatch") + +def version(): + """Returns a string containing version and port info""" + ctype = wx.USE_UNICODE and 'unicode' or 'ansi' + if wx.Platform == '__WXMSW__': + port = 'msw' + elif wx.Platform == '__WXMAC__': + port = 'mac' + elif wx.Platform == '__WXGTK__': + port = 'gtk' + if 'gtk2' in wx.PlatformInfo: + port = 'gtk2' + else: + port = '?' + + return "%s (%s-%s)" % (wx.VERSION_STRING, port, ctype) + + #---------------------------------------------------------------------------- # Set wxPython's default string<-->unicode conversion encoding from @@ -49,7 +67,10 @@ if default == 'ascii': import locale import codecs try: - default = locale.getdefaultlocale()[1] + if hasattr(locale, 'getpreferredencoding'): + default = locale.getpreferredencoding() + else: + default = locale.getdefaultlocale()[1] codecs.lookup(default) except (ValueError, LookupError, TypeError): default = _sys.getdefaultencoding() @@ -248,7 +269,7 @@ class CallLater: class FutureCall(CallLater): - """A compatibility alias for `FutureCall`.""" + """A compatibility alias for `CallLater`.""" #---------------------------------------------------------------------------- # Control which items in this module should be documented by epydoc.