[Commits] (alecf) fix part of bug 2644 - enable visual selection of day/week, and set it to the value stored in the repository

commits at osafoundation.org commits at osafoundation.org
Thu Apr 14 09:25:04 PDT 2005


Commit by: alecf
Modified files:
chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py 1.64 1.65

Log message:
fix part of bug 2644 - enable visual selection of day/week, and set it to the value stored in the repository

Bugzilla links:
http://bugzilla.osafoundation.org/show_bug.cgi?id=2644

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py.diff?r1=text&tr1=1.64&r2=text&tr2=1.65

Index: chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py
diff -u chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.64 chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.65
--- chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.64	Wed Apr 13 17:23:05 2005
+++ chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py	Thu Apr 14 09:25:02 2005
@@ -1,8 +1,8 @@
 """ Canvas for calendaring blocks
 """
 
-__version__ = "$Revision: 1.64 $"
-__date__ = "$Date: 2005/04/14 00:23:05 $"
+__version__ = "$Revision: 1.65 $"
+__date__ = "$Date: 2005/04/14 16:25:02 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -736,6 +736,10 @@
             self.weekHeader.AppendItem(header, wx.colheader.COLUMNHEADER_JUST_Center, 5, bSortEnabled=False)
         self.Bind(wx.colheader.EVT_COLUMNHEADER_SELCHANGED, self.OnDayColumnSelect, self.weekHeader)
 
+        # set up initial selection
+        self.weekHeader.SetFlagVisibleSelection(True)
+        self.UpdateHeader()
+
         sizer.Add(self.weekHeader, 0, wx.EXPAND)
         
         # spacer below to set the minimum size of the event area
@@ -966,19 +970,22 @@
         # (this may change...)
         if (colIndex == 8):
             # re-fix selection so that the expand button doesn't stay selected
-            if self.parent.blockItem.dayMode:
-                # ugly back-calculation of the previously selected day
-                reldate = self.parent.blockItem.selectedDate - \
-                          self.parent.blockItem.rangeStart
-                self.weekHeader.SetSelectedItem(reldate.day+1)
-            else:
-                self.weekHeader.SetSelectedItem(0)
+            self.UpdateHeader()
             return self.parent.OnExpand()
         
         # all other cases mean a day was selected
         # OnDaySelect takes a zero-based day, and our first day is in column 1
         return self.parent.OnDaySelect(colIndex-1)
 
+    def UpdateHeader(self):
+        if self.parent.blockItem.dayMode:
+            # ugly back-calculation of the previously selected day
+            reldate = self.parent.blockItem.selectedDate - \
+                      self.parent.blockItem.rangeStart
+            self.weekHeader.SetSelectedItem(reldate.day+1)
+        else:
+            self.weekHeader.SetSelectedItem(0)
+
     def getDateTimeFromPosition(self, position):
         # bound the position by the available space that the user 
         # can see/scroll to



More information about the Commits mailing list