Title: [commits] (jeffrey) [16129] - Check in Davor's new shading for non-business-hours patch,
Revision
16129
Author
jeffrey
Date
2007-12-14 15:46:47 -0800 (Fri, 14 Dec 2007)

Log Message

- Check in Davor's new shading for non-business-hours patch,
bug 11172, r=me

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py (16128 => 16129)

--- trunk/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py	2007-12-14 21:41:21 UTC (rev 16128)
+++ trunk/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py	2007-12-14 23:46:47 UTC (rev 16129)
@@ -1622,8 +1622,9 @@
         y = 0
         (width, height) = (drawInfo.columnWidths[dayNum+1],
                            self.size.height)
-        dc.SetBrush(styles.todayBrush)
-        dc.DrawRectangle(x,y,width, height)
+        gc = wx.GraphicsContext.Create(dc)
+        gc.SetBrush(styles.todayBrush)
+        gc.DrawRectangle(x,y,width, height)
 
     def DrawDayLines(self, dc):
         """
@@ -2139,8 +2140,9 @@
  
         self.majorLinePen = wx.Pen(self.majorLineColor)
         self.minorLinePen = wx.Pen(self.minorLineColor)
-        self.selectionBrush = wx.Brush(wx.Colour(229, 229, 229))
-        self.todayBrush = wx.Brush(wx.Colour(242,242,242))
+        self.selectionBrush = wx.Brush(wx.Colour(0, 0, 0, 28))
+        self.nonWorkingHoursBrush = wx.Brush(wx.Colour(0,0,0, 8))
+        self.todayBrush = wx.Brush(wx.Colour(0,95,237, 23))
 
         # gradient cache
         self.brushes = Gradients()

Modified: trunk/chandler/parcels/osaf/framework/blocks/calendar/TimedCanvas.py (16128 => 16129)

--- trunk/chandler/parcels/osaf/framework/blocks/calendar/TimedCanvas.py	2007-12-14 21:41:21 UTC (rev 16128)
+++ trunk/chandler/parcels/osaf/framework/blocks/calendar/TimedCanvas.py	2007-12-14 23:46:47 UTC (rev 16129)
@@ -361,8 +361,25 @@
         # at the bottom of the virtual window.
         dc.DrawRectangle(0, 0, width1, height + 10)
 
+        # hardcode this for now - eventually this should be a preference
+        workdayHourStart = 9 # 9am
+        workdayHourEnd = 17  # 5pm
+        
+        # Shade non-working hours
+        gc = wx.GraphicsContext.Create(dc)
+        gc.SetBrush(styles.nonWorkingHoursBrush)
+        gc.DrawRectangle(self.xOffset,
+                         0,
+                         width1,
+                         workdayHourStart * self.hourHeight)
+        gc.DrawRectangle(self.xOffset,
+                         workdayHourEnd * self.hourHeight,
+                         width1,
+                         24 * self.hourHeight)
+        # not needed: dc.SetBrush(wx.WHITE_BRUSH)
+        
         self.ShadeToday(dc)
-        self.DrawBackgroundSelection(dc)
+        self.DrawBackgroundSelection(gc)
 
         # Set text properties for legend
         dc.SetTextForeground(styles.legendColor)
@@ -437,22 +454,18 @@
         pen.SetCap(wx.CAP_BUTT)
         dc.SetPen(pen)
         
-        # hardcode this for now - eventually this should be a preference
-        workdayHourStart = 9 # 9am
-        workdayHourEnd = 17  # 5pm
-        
         dc.DrawLine(legendBorderX, workdayHourStart*hourHeight,
                     legendBorderX, workdayHourEnd * hourHeight + 1)
         
 
-    def DrawBackgroundSelection(self, dc):
+    def DrawBackgroundSelection(self, gc):
         # draw selection stuff (highlighting)
         if (self._bgSelectionStartTime and self._bgSelectionEndTime):
             
-            dc.DrawRectangleList(list(self.GenerateBoundsRects(self._bgSelectionStartTime,
-                                                               self._bgSelectionEndTime)),
-                                 wx.TRANSPARENT_PEN,
-                                 self.blockItem.calendarContainer.selectionBrush)
+            gc.SetBrush(self.blockItem.calendarContainer.selectionBrush)
+            boundsRects = self.GenerateBoundsRects(self._bgSelectionStartTime, self._bgSelectionEndTime)
+            for rect in boundsRects:
+                gc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
 
     @staticmethod
     def sortByStartTime(event1, event2):




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to