[Commits] (capps) added am/pm string to the topmost hour in the
scrolled week/day view
commits at osafoundation.org
commits at osafoundation.org
Wed Sep 1 18:29:08 PDT 2004
Commit by: capps
Modified files:
chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py 1.3 1.4
Log message:
added am/pm string to the topmost hour in the scrolled week/day view
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
Index: chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py
diff -u chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.3 chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.4
--- chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.3 Wed Sep 1 15:20:30 2004
+++ chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py Wed Sep 1 18:29:07 2004
@@ -1,8 +1,8 @@
""" Canvas for calendaring blocks
"""
-__version__ = "$Revision: 1.3 $"
-__date__ = "$Date: 2004/09/01 22:20:30 $"
+__version__ = "$Revision: 1.4 $"
+__date__ = "$Date: 2004/09/02 01:29:07 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -197,6 +197,12 @@
def __init__(self, *arguments, **keywords):
super (wxWeekColumnCanvas, self).__init__ (*arguments, **keywords)
+ self.Bind(wx.EVT_SCROLLWIN, self.OnScroll)
+
+ def OnScroll(self, event):
+ self.Refresh()
+ event.Skip()
+
def wxSynchronizeWidget(self):
self.Refresh()
@@ -228,6 +234,11 @@
dc.SetTextForeground(self.bigFontColor)
dc.SetFont(self.bigFont)
+ # Use topTime to draw am/pm on the topmost hour
+ topCoordinate = self.CalcUnscrolledPosition((0,0))
+ topTime = self.getDateTimeFromPosition(wx.Point(topCoordinate[0],
+ topCoordinate[1]))
+
# Draw the lines separating hours
for hour in range(24):
@@ -235,12 +246,18 @@
if (hour > 0):
if (hour == 1):
hourString = "am 1"
- elif (hour > 12):
- hourString = str(hour - 12)
- elif (hour == 12):
+ elif (hour == 12):
hourString = "pm 12"
+ elif (hour > 12):
+ if (hour == (topTime.hour + 1)): # topmost hour
+ hourString = "pm %s" % str(hour - 12)
+ else:
+ hourString = str(hour - 12)
else:
- hourString = str(hour)
+ if (hour == (topTime.hour + 1)): # topmost hour
+ hourString = "am %s" % str(hour)
+ else:
+ hourString = str(hour)
wText, hText = dc.GetTextExtent(hourString)
dc.DrawText(hourString,
(self.xOffset - wText - 5,
@@ -440,6 +457,7 @@
def OnSize(self, event):
self.Refresh()
+ event.Skip()
def wxSynchronizeWidget(self):
self.monthButton.SetLabel(self.blockItem.rangeStart.Format("%B %Y"))
More information about the Commits
mailing list