]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_datetime.i
add default action methods
[wxWidgets.git] / wxPython / src / _datetime.i
index d5d47b6e2b7a2c55ecba19cf171f0a36d121da00..4bba1d2124c447e3a3d8a82beec2960906cc7527 100644 (file)
@@ -363,11 +363,24 @@ public:
     static wxString GetWeekDayName(WeekDay weekday,
                                    NameFlags flags = Name_Full);
 
-    DocDeclAStr(
-        static void, GetAmPmStrings(wxString *OUTPUT, wxString *OUTPUT),
-        "GetAmPmStrings() -> (am, pm)",
-        "Get the AM and PM strings in the current locale (may be empty)", "");
-
+    %extend {
+        DocAStr(
+            GetAmPmStrings,
+            "GetAmPmStrings() -> (am, pm)",
+            "Get the AM and PM strings in the current locale (may be empty)", "");
+        static PyObject* GetAmPmStrings() {
+            wxString am;
+            wxString pm;
+            wxDateTime::GetAmPmStrings(&am, &pm);
+            wxPyBlock_t blocked = wxPyBeginBlockThreads();
+            PyObject* tup = PyTuple_New(2);
+            PyTuple_SET_ITEM(tup, 0, wx2PyString(am));
+            PyTuple_SET_ITEM(tup, 1, wx2PyString(pm));
+            wxPyEndBlockThreads(blocked);
+            return tup;
+        }
+    }
+                
         // return True if the given country uses DST for this year
     static bool IsDSTApplicable(int year = Inv_Year,
                                 Country country = Country_Default);