Extended the wx.calendar.CalendarCtrl class with methods that get/set
a Python datetime or date object. (These will only work with Python 2.3+) The methods are PySetDate, PyGetDate, PySetLowerDateLimit, PySetUpperDateLimit, PySetDateRange, PyGetLowerDateLimit, and PyGetUpperDateLimit. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,7 +16,8 @@ wx.grid.Grid fix allowing DoGetBestSize to be called before CreateGrid
|
||||
wxMac fix for not sending a native click to a control if it is not
|
||||
enabled (does an enable itself)
|
||||
|
||||
Added wx.lib.ogl.DrawnShape
|
||||
Added wx.lib.ogl.DrawnShape, and fixed various little bugs in the new
|
||||
OGL.
|
||||
|
||||
Added support to XRC and XRCed for the 3-state checkbox flags and also
|
||||
for wx.ToggleButton. Updated the generic window styles supported by
|
||||
@@ -58,6 +59,17 @@ Added wx.Frame.RequestUserAttention which, if the platform suports it,
|
||||
will do something (such as flash the task bar item) to suggest to the
|
||||
user that they should look at that window.
|
||||
|
||||
"Fixed" wx.grid.Grid.SetDefaultEditor and SetDefaultRenderer by making
|
||||
them register the editor or renderer for the "string" data type.
|
||||
|
||||
Added depth param to wx.Image.ConvertToBitmap.
|
||||
|
||||
Extended the wx.calendar.CalendarCtrl class with methods that get/set
|
||||
a Python datetime or date object. (These will only work with Python
|
||||
2.3+) The methods are PySetDate, PyGetDate, PySetLowerDateLimit,
|
||||
PySetUpperDateLimit, PySetDateRange, PyGetLowerDateLimit, and
|
||||
PyGetUpperDateLimit.
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -119,6 +119,15 @@ public:
|
||||
void SetWeekDay(const wxDateTime::WeekDay wd);
|
||||
wxDateTime::WeekDay GetWeekDay() const;
|
||||
|
||||
%pythoncode {
|
||||
def PySetDate(self, date):
|
||||
"""takes datetime.datetime or datetime.date object"""
|
||||
self.SetDate(_py2wx(date))
|
||||
|
||||
def PyGetDate(self):
|
||||
"""returns datetime.date object"""
|
||||
return _wx2py(self.GetDate())
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -409,9 +418,54 @@ The result codes are:
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
|
||||
%pythoncode {
|
||||
def PySetDate(self, date):
|
||||
"""takes datetime.datetime or datetime.date object"""
|
||||
self.SetDate(_py2wx(date))
|
||||
|
||||
def PyGetDate(self):
|
||||
"""returns datetime.date object"""
|
||||
return _wx2py(self.GetDate())
|
||||
|
||||
def PySetLowerDateLimit(self, date):
|
||||
"""takes datetime.datetime or datetime.date object"""
|
||||
self.SetLowerDateLimit(_py2wx(date))
|
||||
|
||||
def PySetUpperDateLimit(self, date):
|
||||
"""takes datetime.datetime or datetime.date object"""
|
||||
self.SetUpperDateLimit(_py2wx(date))
|
||||
|
||||
def PySetDateRange(self, lowerdate, upperdate):
|
||||
"""takes datetime.datetime or datetime.date objects"""
|
||||
self.PySetLowerDateLimit(lowerdate)
|
||||
self.PySetUpperDateLimit(upperdate)
|
||||
|
||||
def PyGetLowerDateLimit(self):
|
||||
"""returns datetime.date object"""
|
||||
return _wx2py(self.GetLowerDateLimit())
|
||||
|
||||
def PyGetUpperDateLimit(self):
|
||||
"""returns datetime.date object"""
|
||||
return _wx2py(self.GetUpperDateLimit())
|
||||
}
|
||||
};
|
||||
|
||||
%pythoncode {
|
||||
def _py2wx(date):
|
||||
import datetime
|
||||
assert isinstance(date, (datetime.datetime, datetime.date))
|
||||
tt = date.timetuple()
|
||||
dmy = (tt[2], tt[1]-1, tt[0])
|
||||
return wx.DateTimeFromDMY(*dmy)
|
||||
|
||||
def _wx2py(date):
|
||||
import datetime
|
||||
assert isinstance(date, wx.DateTime)
|
||||
ymd = map(int, date.FormatISODate().split('-'))
|
||||
return datetime.date(*ymd)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
Reference in New Issue
Block a user