]> git.saurik.com Git - wxWidgets.git/commitdiff
Extended the wx.calendar.CalendarCtrl class with methods that get/set
authorRobin Dunn <robin@alldunn.com>
Fri, 10 Sep 2004 20:53:21 +0000 (20:53 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 10 Sep 2004 20:53:21 +0000 (20:53 +0000)
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

wxPython/docs/CHANGES.txt
wxPython/src/calendar.i

index 3fd43e8a02c400e8f62c672a6972e4ad817d306c..26b214a2b19f513f15bc3c6f6de7450c6b9cb6b7 100644 (file)
@@ -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. 
+
 
 
 
index d26c1de916488dfddb67ed3651e6274a064c2850..e9bfb8bc4def6ec885d116ee36f16558dc44c503 100644 (file)
@@ -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 %{