From 25f8fb989c8f31667d8ea7456ddcd72e0bd4545a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 26 Feb 2003 03:56:38 +0000 Subject: [PATCH] Provide both forms of wxLocale::Init to wxPython git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19317 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/fonts.i | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/wxPython/src/fonts.i b/wxPython/src/fonts.i index 884cce3f3b..dffe3ed4d2 100644 --- a/wxPython/src/fonts.i +++ b/wxPython/src/fonts.i @@ -724,18 +724,27 @@ public: wxLocale(int language = wxLANGUAGE_DEFAULT, int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); - bool Init(const wxString& szName, - const wxString& szShort = wxPyEmptyString, - const wxString& szLocale = wxPyEmptyString, - bool bLoadDefault = TRUE, - bool bConvertEncoding = FALSE); - - %name(InitLang) bool Init(int language = wxLANGUAGE_DEFAULT, - int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); - // restores old locale ~wxLocale(); + %name(Init1)bool Init(const wxString& szName, + const wxString& szShort = wxPyEmptyString, + const wxString& szLocale = wxPyEmptyString, + bool bLoadDefault = TRUE, + bool bConvertEncoding = FALSE); + + %name(Init2) bool Init(int language = wxLANGUAGE_DEFAULT, + int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); + + %pragma(python) addtoclass = " + def Init(self, *_args, **_kwargs): + if type(_args[0]) in [type(''), type(u'')]: + val = apply(self.Init1, _args, _kwargs) + else: + val = apply(self.Init2, _args, _kwargs) + return val + " + // Try to get user's (or OS's) prefered language setting. // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed