[Commits] (capps) Added a mini calendar to the sidebar

commits at osafoundation.org commits at osafoundation.org
Thu Jul 1 17:16:43 PDT 2004


Commit by: capps
Modified files:
chandler/parcels/osaf/contentmodel/parcel.xml 1.34 1.35
chandler/parcels/osaf/framework/blocks/Views.py 1.29 1.30
chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py 1.20 1.21
chandler/parcels/osaf/framework/blocks/calendar/parcel.xml 1.3 1.4
chandler/parcels/osaf/views/content/parcel.xml 1.30 1.31
chandler/parcels/osaf/views/main/parcel.xml 1.55 1.56

Log message:
Added a mini calendar to the sidebar

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/parcel.xml.diff?r1=text&tr1=1.34&r2=text&tr2=1.35
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/Views.py.diff?r1=text&tr1=1.29&r2=text&tr2=1.30
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/calendar/CalendarBlocks.py.diff?r1=text&tr1=1.20&r2=text&tr2=1.21
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/calendar/parcel.xml.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/content/parcel.xml.diff?r1=text&tr1=1.30&r2=text&tr2=1.31
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/parcel.xml.diff?r1=text&tr1=1.55&r2=text&tr2=1.56

Index: chandler/parcels/osaf/framework/blocks/Views.py
diff -u chandler/parcels/osaf/framework/blocks/Views.py:1.29 chandler/parcels/osaf/framework/blocks/Views.py:1.30
--- chandler/parcels/osaf/framework/blocks/Views.py:1.29	Thu Jul  1 16:42:00 2004
+++ chandler/parcels/osaf/framework/blocks/Views.py	Thu Jul  1 17:16:41 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.29 $"
-__date__ = "$Date: 2004/07/01 23:42:00 $"
+__version__ = "$Revision: 1.30 $"
+__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"
 
@@ -27,6 +27,7 @@
             print "Calling %s" % methodName
             """
 
+
             member (notification)
             return True
         

Index: chandler/parcels/osaf/framework/blocks/calendar/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/calendar/parcel.xml:1.3 chandler/parcels/osaf/framework/blocks/calendar/parcel.xml:1.4
--- chandler/parcels/osaf/framework/blocks/calendar/parcel.xml:1.3	Mon Jun 21 17:52:01 2004
+++ chandler/parcels/osaf/framework/blocks/calendar/parcel.xml	Thu Jul  1 17:16:41 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.3 $ -->
-<!-- $Date: 2004/06/22 00:52:01 $-->
+<!-- $Revision: 1.4 $ -->
+<!-- $Date: 2004/07/02 00:16:41 $-->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -41,6 +41,7 @@
     <attributes itemref="calBlocks:MonthBlock/offset"/>
     <attributes itemref="calBlocks:MonthBlock/rangeStart"/>
     <attributes itemref="calBlocks:MonthBlock/rangeIncrement"/>
+    <attributes itemref="blocks:characterStyle"/>
   </Kind>
 
   <Kind itsName="WeekBlock">
@@ -69,6 +70,12 @@
     <attributes itemref="calBlocks:WeekBlock/offset"/>
     <attributes itemref="calBlocks:WeekBlock/rangeStart"/>
     <attributes itemref="calBlocks:WeekBlock/rangeIncrement"/>
+    <attributes itemref="blocks:characterStyle"/>
+  </Kind>
+
+  <Kind itsName="MiniCalendar">
+    <classes key="python">osaf.framework.blocks.calendar.CalendarBlocks.MiniCalendar</classes>
+    <superKinds itemref="blocks:RectangularChild"/>
   </Kind>
 
 </Parcel>

Index: chandler/parcels/osaf/views/main/parcel.xml
diff -u chandler/parcels/osaf/views/main/parcel.xml:1.55 chandler/parcels/osaf/views/main/parcel.xml:1.56
--- chandler/parcels/osaf/views/main/parcel.xml:1.55	Thu Jul  1 00:34:12 2004
+++ chandler/parcels/osaf/views/main/parcel.xml	Thu Jul  1 17:16:42 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.55 $ -->
-<!-- $Date: 2004/07/01 07:34:12 $ -->
+<!-- $Revision: 1.56 $ -->
+<!-- $Date: 2004/07/02 00:16:42 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -13,7 +13,8 @@
              xmlns:events="http://osafoundation.org/parcels/osaf/framework/blocks/Events"
              xmlns:repository="http://osafoundation.org/parcels/osaf/views/repositoryviewer"
              xmlns:demo="http://osafoundation.org/parcels/osaf/views/demo"
-             xmlns:content="http://osafoundation.org/parcels/osaf/views/content">
+             xmlns:content="http://osafoundation.org/parcels/osaf/views/content"
+	     xmlns:calendar="http://osafoundation.org/parcels/osaf/framework/blocks/calendar">
 
   <core:version>0.3</core:version>
 
@@ -395,7 +396,19 @@
     <border>3.0, 3.0, 3.0, 3.0</border>
   </TabbedContainer>  
 
-  <Tree itsName="Sidebar">
+  <calendar:MiniCalendar itsName="MiniCalendar"/>
+
+  <BoxContainer itsName="Sidebar">
+    <!-- Layout children -->
+    <childrenBlocks itemref="doc:SidebarTree"/>
+    <childrenBlocks itemref="doc:MiniCalendar"/>
+
+    <!-- Attributes -->
+    <orientationEnum>Vertical</orientationEnum>
+    <border>2.0, 2.0, 2.0, 2.0</border>
+  </BoxContainer>
+
+  <Tree itsName="SidebarTree">
     <!-- Attributes -->
     <elementDelegate>osaf.views.main.SideBar.SideBarDelegate</elementDelegate>
     <selection itemref="doc:InView"/>

Index: chandler/parcels/osaf/contentmodel/parcel.xml
diff -u chandler/parcels/osaf/contentmodel/parcel.xml:1.34 chandler/parcels/osaf/contentmodel/parcel.xml:1.35
--- chandler/parcels/osaf/contentmodel/parcel.xml:1.34	Thu Jun 24 17:23:54 2004
+++ chandler/parcels/osaf/contentmodel/parcel.xml	Thu Jul  1 17:16:40 2004
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
 <!-- Parcel manifest for Pim Schema -->
-<!-- $Revision: 1.34 $ -->
-<!-- $Date: 2004/06/25 00:23:54 $ -->
+<!-- $Revision: 1.35 $ -->
+<!-- $Date: 2004/07/02 00:16:40 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -243,7 +243,7 @@
     <core:displayName>Named Collection</core:displayName>
     <core:attributes itemref="rule"/>
     <core:attributes itemref="inclusions"/>
-    <core:attributes itemref="exclusions/"/>
+    <core:attributes itemref="exclusions"/>
     <core:classes key="python">osaf.contentmodel.ItemCollection.ItemCollection</core:classes>
   </core:Kind>
 
@@ -251,7 +251,7 @@
     <core:superKinds itemref="ItemCollection"/>
     <core:displayName>Ad-Hoc Collection</core:displayName>
     <core:attributes itemref="inclusions"/>
-    <core:attributes itemref="exclusions/"/>
+    <core:attributes itemref="exclusions"/>
     <core:classes key="python">osaf.contentmodel.ItemCollection.ItemCollection</core:classes>
   </core:Kind>
 

Index: chandler/parcels/osaf/views/content/parcel.xml
diff -u chandler/parcels/osaf/views/content/parcel.xml:1.30 chandler/parcels/osaf/views/content/parcel.xml:1.31
--- chandler/parcels/osaf/views/content/parcel.xml:1.30	Thu Jul  1 00:47:02 2004
+++ chandler/parcels/osaf/views/content/parcel.xml	Thu Jul  1 17:16:41 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.30 $ -->
-<!-- $Date: 2004/07/01 07:47:02 $ -->
+<!-- $Revision: 1.31 $ -->
+<!-- $Date: 2004/07/02 00:16:41 $ -->
 <!-- Copyright (c) 2004 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.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'])
 



More information about the Commits mailing list