X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aeee37c362c178e4b79702e8e61869cd9dcb65ff..303f572ea95a88622fd93b33008de75f756ff068:/wxPython/src/_datetime.i diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index 4805236239..4bba1d2124 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -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); @@ -708,14 +721,15 @@ public: inline wxDateTime& operator-=(const wxDateSpan& diff); +// inline bool operator<(const wxDateTime& dt) const; +// inline bool operator<=(const wxDateTime& dt) const; +// inline bool operator>(const wxDateTime& dt) const; +// inline bool operator>=(const wxDateTime& dt) const; +// inline bool operator==(const wxDateTime& dt) const; +// inline bool operator!=(const wxDateTime& dt) const; + %nokwargs __add__; %nokwargs __sub__; - %nokwargs __lt__; - %nokwargs __le__; - %nokwargs __gt__; - %nokwargs __ge__; - %nokwargs __eq__; - %nokwargs __ne__; %extend { wxDateTime __add__(const wxTimeSpan& other) { return *self + other; } wxDateTime __add__(const wxDateSpan& other) { return *self + other; } @@ -724,14 +738,9 @@ public: wxDateTime __sub__(const wxTimeSpan& other) { return *self - other; } wxDateTime __sub__(const wxDateSpan& other) { return *self - other; } -// bool __lt__(const wxDateTime* other) { return other ? (*self < *other) : false; } -// bool __le__(const wxDateTime* other) { return other ? (*self <= *other) : false; } -// bool __gt__(const wxDateTime* other) { return other ? (*self > *other) : true; } -// bool __ge__(const wxDateTime* other) { return other ? (*self >= *other) : true; } - - // These fall back to just comparing pointers if other is NULL, or if - // either operand is invalid. + // either operand is invalid. This allows Python comparrisons to None + // to not assert and to return a sane value for the compare. bool __lt__(const wxDateTime* other) { if (!other || !self->IsValid() || !other->IsValid()) return self < other; return (*self < *other); @@ -759,6 +768,9 @@ public: } } + + + // ------------------------------------------------------------------------ // conversion from text: all conversions from text return -1 on failure,