[Commits] (capps) Fixes Bug#1814: double clicking new event now selects that event. Also added a block definition for CollectionCanvas.

commits at osafoundation.org commits at osafoundation.org
Fri Sep 10 15:17:12 PDT 2004


Commit by: capps
Modified files:
chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py 1.6 1.7
chandler/parcels/osaf/framework/blocks/calendar/parcel.xml 1.6 1.7

Log message:
Fixes Bug#1814: double clicking new event now selects that event. Also added a block definition for CollectionCanvas.

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

Index: chandler/parcels/osaf/framework/blocks/calendar/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/calendar/parcel.xml:1.6 chandler/parcels/osaf/framework/blocks/calendar/parcel.xml:1.7
--- chandler/parcels/osaf/framework/blocks/calendar/parcel.xml:1.6	Mon Aug 30 19:31:29 2004
+++ chandler/parcels/osaf/framework/blocks/calendar/parcel.xml	Fri Sep 10 15:17:11 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.6 $ -->
-<!-- $Date: 2004/08/31 02:31:29 $-->
+<!-- $Revision: 1.7 $ -->
+<!-- $Date: 2004/09/10 22:17:11 $-->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -15,11 +15,15 @@
   <description>calendar blocks</description>
   <version>0.3</version>
 
-  <Kind itsName="CanvasMonth">
-    <classes key="python">osaf.framework.blocks.calendar.CalendarCanvas.MonthBlock</classes>
+  <Kind itsName="CollectionCanvas">
+    <classes key="python">osaf.framework.blocks.calendar.CollectionCanvas.CollectionBlock</classes>
     <superKinds itemref="blocks:RectangularChild"/>
-
     <attributes itemref="blocks:selection"/>
+  </Kind>
+
+  <Kind itsName="CanvasMonth">
+    <classes key="python">osaf.framework.blocks.calendar.CalendarCanvas.MonthBlock</classes>
+    <superKinds itemref="calBlocks:CollectionCanvas"/>
 
     <Attribute itsName="rangeStart">
       <type itemref="DateTime"/>
@@ -31,9 +35,7 @@
 
   <Kind itsName="CanvasWeek">
     <classes key="python">osaf.framework.blocks.calendar.CalendarCanvas.WeekBlock</classes>
-    <superKinds itemref="blocks:RectangularChild"/>
-
-    <attributes itemref="blocks:selection"/>
+    <superKinds itemref="calBlocks:CollectionCanvas"/>
 
     <Attribute itsName="rangeStart">
       <type itemref="DateTime"/>

Index: chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py
diff -u chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.6 chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.7
--- chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py:1.6	Wed Sep  8 21:52:06 2004
+++ chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py	Fri Sep 10 15:17:11 2004
@@ -1,8 +1,8 @@
 """ Canvas for calendaring blocks
 """
 
-__version__ = "$Revision: 1.6 $"
-__date__ = "$Date: 2004/09/09 04:52:06 $"
+__version__ = "$Revision: 1.7 $"
+__date__ = "$Date: 2004/09/10 22:17:11 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -209,7 +209,7 @@
         dc.SetBrush(wx.WHITE_BRUSH)
         dc.DrawRectangle((0, 0), (self.size.width, self.size.height))
         
-        startDay = self.parent.blockItem.getStartDay()
+        startDay = self.parent.blockItem.rangeStart
 
         # Draw the weekdays
         # @@@ Figure out the height of the text
@@ -328,7 +328,7 @@
         self._doDrawingCalculations(dc)
         self.canvasItemList = []
 
-        startDay = self.parent.blockItem.getStartDay()
+        startDay = self.parent.blockItem.rangeStart
         
         for day in range(self.parent.blockItem.daysPerView):
             currentDate = startDay + DateTime.RelativeDateTime(days=day)
@@ -379,8 +379,8 @@
             # event.duration = DateTime.DateTimeDelta(0, 0, 60)
             #     x, y = self.getPositionFromDateTime(newTime)
             #     eventRect = wx.Rect(x, y,
-            #                         self.dayWidth - 1,
-            #                         int(event.duration.hours * self.hourHeight) - 1)
+            #          self.dayWidth - 1,
+            #          int(event.duration.hours * self.hourHeight) - 1)
             pass
         else:
             # @@@ this code might want to live somewhere else, refactored
@@ -388,8 +388,10 @@
             event = Calendar.CalendarEvent()
             event.InitOutgoingAttributes()
             event.ChangeStart(newTime)
+            self.OnSelectItem(event)
 
-            # @@@ currently this is too slow, and the notification causes flicker
+            # @@@ Bug#1854 currently this is too slow,
+            # and the notification causes flicker
             Globals.repository.commit()
         return None
     
@@ -416,7 +418,7 @@
             self.Refresh()
 
     def getDateTimeFromPosition(self, position):
-        startDay = self.parent.blockItem.getStartDay()
+        startDay = self.parent.blockItem.rangeStart
         # @@@ fixes Bug#1831, but doesn't really address the root cause
         # (the window is drawn with (0,0) virtual size on mac)
         if self.dayWidth > 0:
@@ -450,17 +452,6 @@
         return wxWeekPanel(self.parentBlock.widget,
                            Block.Block.getWidgetID(self))
 
-    def getStartDay(self):
-        # @@@ note, need different logic for one day,
-        # or specific set of days instead of a week
-        if self.daysPerView == 7:
-            startDay = self.rangeStart + \
-                       DateTime.RelativeDateTime(days=-6,
-                                                 weekday=(DateTime.Sunday, 0))
-        else:
-            startDay = self.rangeStart
-        return startDay
-
     def setRange(self, date):
         if self.daysPerView == 7:
             # if in week mode, start at the beginning of the week
@@ -621,8 +612,10 @@
                                                 newTime.day,
                                                 event.startTime.hour,
                                                 event.startTime.minute))
+            self.OnSelectItem(event)
             
-            # @@@ currently this is too slow, and the notification causes flicker
+            # @@@ Bug#1854 currently this is too slow,
+            # and the notification causes flicker
             Globals.repository.commit()
         return None
 



More information about the Commits mailing list