|
foundation.org/Chandler_0.1_license_terms.htm -->
@@ -117,6 +117,12 @@
<columnWidths>170</columnWidths>
</List>
+ <!-- Calendar Blocks -->
+ <CharacterStyle itsName="CalendarTitle">
+ <fontStyle>bold</fontStyle>
+ <fontSize>10.0</fontSize>
+ </CharacterStyle>
+
<!-- Month -->
<calendarBlocks:MonthBlock itsName="SummaryMonth">
<contents itemref="view:calendarItemCollection"/>
@@ -125,7 +131,7 @@
<weeksPerView>6</weeksPerView>
<offset>60</offset>
- <subscribeWhenVisibleEvents itemref="events:SelectedDateChanged"/>
+ <characterStyle itemref="view:CalendarTitle"/>
</calendarBlocks:MonthBlock>
<!-- Week -->
@@ -136,7 +142,7 @@
<hoursPerView>24</hoursPerView>
<offset>40</offset>
- <subscribeWhenVisibleEvents itemref="events:SelectedDateChanged"/>
+ <characterStyle itemref="view:CalendarTitle"/>
</calendarBlocks:WeekBlock>
<!-- Mixed List -->
Index: chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py
diff -u chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py:1.20 chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py:1.21
--- chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py:1.20 Thu Jul 1 00:21:11
2004
+++ chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py Thu Jul 1 17:16:41
2004
@@ -1,12 +1,13 @@
""" Calendar Blocks
"""
-__version__ = "$Revision: 1.20 $"
-__date__ = "$Date: 2004/07/01 07:21:11 $"
+__version__ = "$Revision: 1.21 $"
+__date__ = "$Date: 2004/07/02 00:16:41 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
import wx
+import wx.calendar
from mx import DateTime
import application.SimpleCanvas as SimpleCanvas
@@ -335,8 +336,7 @@
dayWidth = property(getDayWidth)
dayHeight = property(getDayHeight)
- def onSelectedDateChanged(self, notification):
- print "selected date changed"
+ def onSelectedDateChangedEvent(self, notification):
self.updateRange(notification.data['start'])
self.widget.Refresh()
@@ -363,4 +363,67 @@
+class wxMiniCalendar(wx.calendar.CalendarCtrl):
+ def __init__(self, *arguments, **keywords):
+ super (wxMiniCalendar, self).__init__(*arguments, **keywords)
+ self.Bind(wx.calendar.EVT_CALENDAR_SEL_CHANGED,
+ self.OnSelectionChanged)
+
+ def wxSynchronizeWidget(self):
+ self.SetWindowStyle(wx.calendar.CAL_SUNDAY_FIRST |
+ wx.calendar.CAL_SHOW_SURROUNDING_WEEKS)
+
+ def OnSelectionChanged(self, event):
+ self.blockItem.Post(Globals.repository.findPath('//parcels/osaf/framework/blocks/Events/SelectedDateChanged'),
+ {'start': self.getSelectedDate(),
+ 'item': self.blockItem })
+
+ def getSelectedDate(self):
+ wxdate = self.GetDate()
+ mxdate = DateTime.DateTime(wxdate.GetYear(),
+ wxdate.GetMonth() + 1,
+ wxdate.GetDay())
+ return mxdate
+
+ def setSelectedDate(self, mxdate):
+ wxdate = wx.DateTimeFromDMY(mxdate.day,
+ mxdate.month - 1,
+ mxdate.year)
+ self.SetDate(wxdate)
+
+
+ def setSelectedDateRange(self, mxstart, mxend):
+ self.resetMonth()
+ self.setSelectedDate(mxstart)
+
+ if (mxstart.month != mxend.month):
+ endday = mxstart.days_in_month + 1
+ else:
+ endday = mxend.day + 1
+
+ for day in range(mxstart.day, endday):
+ attr = wx.CalendarDateAttr(wx.WHITE, wx.BLUE, wx.WHITE,
+ wx.SWISS_FONT)
+ self.SetAttr(day, attr)
+
+ today = DateTime.today()
+ if ((today.year == mxstart.year) and (today.month == mxstart.month)):
+ self.SetHoliday(today.day)
+
+ self.Refresh()
+
+ def resetMonth(self):
+ for day in range(1,32):
+ self.ResetAttr(day)
+
+class MiniCalendar(Block.RectangularChild):
+ def __init__(self, *arguments, **keywords):
+ super (MiniCalendar, self).__init__(*arguments, **keywords)
+
+ def instantiateWidget(self):
+ return wxMiniCalendar(self.parentBlock.widget,
+ Block.Block.getWidgetID(self))
+
+ def onSelectedDateChangedEvent(self, notification):
+ self.widget.setSelectedDate(notification.data['start'])
|
|