Title: [commits] (jeffrey) [11336] - First set of changes associated with bug 6233, implement new calendar look and feel
Revision
11336
Author
jeffrey
Date
2006-08-04 19:45:38 -0700 (Fri, 04 Aug 2006)

Log Message

- First set of changes associated with bug 6233, implement new calendar look and feel

The main changes are to round all calendar lozenges, and to move color information into
application.styles so Mimi can tweak to her heart's content.

Modified Paths

Diff

Modified: trunk/chandler/application/styles.conf (11335 => 11336)

--- trunk/chandler/application/styles.conf	2006-08-05 00:26:28 UTC (rev 11335)
+++ trunk/chandler/application/styles.conf	2006-08-05 02:45:38 UTC (rev 11336)
@@ -13,3 +13,54 @@
 SectionSample_triageStatus_now = #00cc00
 SectionSample_triageStatus_later = #ffcc00
 SectionSample_triageStatus_done = #555555
+
+[color]
+BlueHue = 210
+GreenHue = 120
+RoseHue = 0
+SalmonHue = 30
+PurpleHue = 270
+VioletHue = 240
+FuschiaHue = 330
+
+[calendarcanvas]
+
+######### Selected Lozenges ################
+
+SelectedGradientLeftSaturation    = 1.0
+SelectedGradientLeftValue         = 1.0
+
+SelectedGradientRightSaturation   = 0.8
+SelectedGradientRightValue        = 1.0
+
+SelectedOutlineSaturation         = 0.6
+SelectedOutlineValue              = 1.0
+
+SelectedTextSaturation            = 0.0
+SelectedTextValue                 = 1.0
+
+######### Unselected Lozenges ##############
+UnSelectedGradientLeftSaturation    = 0.8
+UnSelectedGradientLeftValue         = 1.0
+
+UnSelectedGradientRightSaturation   = 0.5
+UnSelectedGradientRightValue        = 1.0
+
+UnSelectedOutlineSaturation         = 0.6
+UnSelectedOutlineValue              = 1.0
+
+UnSelectedTextSaturation            = 0.0
+UnSelectedTextValue                 = 1.0
+
+########## Overlaid Lozenges ###############
+OverlayGradientLeftSaturation    = 0.4
+OverlayGradientLeftValue         = 1.0
+
+OverlayGradientRightSaturation   = 0.4
+OverlayGradientRightValue        = 1.0
+
+OverlayOutlineSaturation         = 0.3
+OverlayOutlineValue              = 1.0
+
+OverlayTextSaturation            = 0.67
+OverlayTextValue                 = 0.5

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

--- trunk/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py	2006-08-05 00:26:28 UTC (rev 11335)
+++ trunk/chandler/parcels/osaf/framework/blocks/calendar/CalendarCanvas.py	2006-08-05 02:45:38 UTC (rev 11336)
@@ -52,6 +52,7 @@
 from bisect import bisect
 import copy
 import logging
+from application import styles as confstyles
 
 from i18n import OSAFMessageFactory as _
 
@@ -66,6 +67,8 @@
 # used on any platform
 ENABLE_DEVICE_ORIGIN = False
 
+RADIUS = 8
+
 TRANSPARENCY_DASHES = [255, 255, 0, 0, 255, 255, 0, 0]
 
 def nth(iterable, n):
@@ -147,24 +150,29 @@
         return property(demangledTupleGetter)
 
     # these are all for when this calendar is the 'current' one
-    gradientLeft = tintedColor(0.4)
-    gradientRight = tintedColor(0.2)
-    outlineColor = tintedColor(0.6)
-    textColor = tintedColor(0.67, 0.6)
+    def get_style(name):
+        return (float(confstyles.cfg.get('calendarcanvas', name+'Saturation')),
+                float(confstyles.cfg.get('calendarcanvas', name+'Value')))
+                
+    gradientLeft  = tintedColor(*get_style('UnSelectedGradientLeft'))
+    gradientRight = tintedColor(*get_style('UnSelectedGradientRight'))
+    outlineColor  = tintedColor(*get_style('UnSelectedOutline'))
+    textColor     = tintedColor(*get_style('UnSelectedText'))
     defaultColors = tupleProperty(gradientLeft, gradientRight, outlineColor, textColor)
 
     # when a user selects a calendar event, use these
-    selectedGradientLeft = tintedColor(0.15)
-    selectedGradientRight = tintedColor(0.05)
-    selectedOutlineColor = tintedColor(0.6)
-    selectedTextColor = tintedColor(0.67, 0.6)
+    selectedGradientLeft  = tintedColor(*get_style('SelectedGradientLeft'))
+    selectedGradientRight = tintedColor(*get_style('SelectedGradientRight'))
+    selectedOutlineColor  = tintedColor(*get_style('SelectedOutline'))
+    selectedTextColor     = tintedColor(*get_style('SelectedText'))
     selectedColors = tupleProperty(selectedGradientLeft, selectedGradientRight, selectedOutlineColor, selectedTextColor)
     
     # 'visible' means that its not the 'current' calendar, but is still visible
-    visibleGradientLeft = tintedColor(0.15)
-    visibleGradientRight = tintedColor(0.15)
-    visibleOutlineColor = tintedColor(0.3)
-    visibleTextColor = tintedColor(0.4, 0.85)
+    visibleGradientLeft  = tintedColor(*get_style('OverlayGradientLeft'))
+    visibleGradientRight = tintedColor(*get_style('OverlayGradientRight'))
+    visibleOutlineColor  = tintedColor(*get_style('OverlayOutline'))
+    visibleTextColor     = tintedColor(*get_style('OverlayText'))
+                                       
     visibleColors = tupleProperty(visibleGradientLeft, visibleGradientRight, visibleOutlineColor, visibleTextColor)
 
 
@@ -290,7 +298,7 @@
         size = self.GetBoundsRects()[0].GetSize()
 
         # now offset to account for the time	
-        size -= (13, self.timeHeight + self.textMargin*2)	
+        size -= (16, self.timeHeight + self.textMargin*2 + 3)
         return size
 
 
@@ -374,10 +382,10 @@
         isAnyTimeOrAllDay = self.GetAnyTimeOrAllDay()	
         # Draw one event - an event consists of one or more bounds	
        
-        clipRect = None	
-        (cx,cy,cwidth,cheight) = dc.GetClippingBox()	
-        if not cwidth == cheight == 0:	
-            clipRect = (cx,cy,cwidth,cheight)	
+        clipRect = None
+        (cx,cy,cwidth,cheight) = dc.GetClippingBox()
+        if not cwidth == cheight == 0:
+            clipRect = (cx,cy,cwidth,cheight)
         
         gradientLeft, gradientRight, outlineColor, textColor = \
             self.getEventColors(selected)
@@ -394,10 +402,8 @@
                     
                 brush = styles.brushes.GetGradientBrush(brushOffset,
                                                         itemRect.width,
-                                                        gradientLeft, gradientRight)	
-                dc.SetBrush(brush)	
-                dc.SetPen(wx.Pen(outlineColor))	
-           
+                                                        gradientLeft, gradientRight)
+
                 # properly round the corners - first and last	
                 # boundsRect gets some rounding, and they	
                 # may actually be the same boundsRect	
@@ -410,12 +416,15 @@
                 if rectIndex == len(self.GetBoundsRects())-1:	
                     hasBottomRightRounded = True	
            
-                # anyTime-but-not-allday or zero-duration events get fully rounded
-                isAllDay = getattr(item, 'allDay', False)
-                isAnyTime = getattr(item, 'anyTime', False)
-                duration = getattr(item, 'duration', 0)
-                hasLeftRounded = ((isAnyTime or not duration) and not isAllDay)
+                hasLeftRounded = True #always rounding left side
+                                
+                # new, smaller itemRect
+                itemRect = wx.Rect(itemRect.x, itemRect.y,
+                                   itemRect.width - 2, itemRect.height - 2)
                 
+                # draw the normal canvas item
+                dc.SetBrush(brush)
+                dc.SetPen(wx.Pen(outlineColor))
                 self.DrawEventRectangle(dc, itemRect, brush,
                                         hasLeftRounded,
                                         hasTopRightRounded,
@@ -433,8 +442,7 @@
                 self.textOffset = wx.Point(self.textMargin, self.textMargin)
                 
                 if hasLeftRounded:
-                    cornerRadius = 8
-                    self.textOffset.x += cornerRadius
+                    self.textOffset.x += RADIUS
                 else:
                     self.textOffset.x += 3
     
@@ -444,7 +452,7 @@
     
                 width = itemRect.width - self.textOffset.x - (self.textMargin)
                 
-                # only draw date/time on first item	
+                # only draw date/time on first item
                 if drawEventText:
                     # only draw time on timed events
                     if not isAnyTimeOrAllDay:
@@ -477,6 +485,7 @@
                         availableSpace = timeHeight*2 + timeBottomMargin + \
                                          self.textOffset.y*2
                         if (availableSpace < itemRect.height):
+                            
                             timeRect = (x, y, width, timeHeight)
                             
                             dc.SetFont(styles.eventTimeFont)
@@ -506,13 +515,11 @@
                                 itemRect.height - lostHeight - self.textOffset.y)
            
                     dc.SetFont(styles.eventLabelFont)
+                    drawingItem = item
                     if selected:
-                        proxy = RecurrenceDialog.getProxy(u'ui', item)
-                        DrawWrappedText(dc, proxy.displayName, textRect,
-                                        styles.eventLabelMeasurements)
-                    else:
-                        DrawWrappedText(dc, item.displayName, textRect,
-                                        styles.eventLabelMeasurements)
+                        drawingItem = RecurrenceDialog.getProxy(u'ui', item)
+                    DrawWrappedText(dc, drawingItem.displayName, textRect,
+                                    styles.eventLabelMeasurements)
        
         dc.DestroyClippingRegion()	
         if clipRect:	
@@ -536,8 +543,7 @@
                  hasTopRightRounded and hasBottomRightRounded) or
                 not hasLeftRounded)
 
-        radius = 8
-        diameter = radius * 2
+        diameter = RADIUS * 2
 
         dc.DestroyClippingRegion()
         dc.SetClippingRect(rect)
@@ -558,22 +564,22 @@
 
         # left/right clipping
         if not hasLeftRounded:
-            x -= radius
-            width += radius
+            x -= RADIUS
+            width += RADIUS
 
         if clipRightSide:
-            width += radius;
+            width += RADIUS;
             
         # top/bottom clipping
         if not hasBottomRightRounded:
-            height += radius
+            height += RADIUS
 
         if not hasTopRightRounded:
-            y -= radius
-            height += radius
+            y -= RADIUS
+            height += RADIUS
 
         # finally draw the clipped rounded rect
-        dc.DrawRoundedRectangle(x,y,width,height,radius)
+        dc.DrawRoundedRectangle(x,y,width,height,RADIUS)
         
         # draw the lefthand and possibly top & bottom borders
         if not hasLeftRounded:

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

--- trunk/chandler/parcels/osaf/framework/blocks/calendar/TimedCanvas.py	2006-08-05 00:26:28 UTC (rev 11335)
+++ trunk/chandler/parcels/osaf/framework/blocks/calendar/TimedCanvas.py	2006-08-05 02:45:38 UTC (rev 11336)
@@ -1012,7 +1012,7 @@
         
 class TimedCanvasItem(CalendarCanvasItem):
     resizeBufferSize = 5
-    textMargin = 4
+    textMargin = 2
     
     RESIZE_MODE_START = 1
     RESIZE_MODE_END = 2

Modified: trunk/chandler/parcels/osaf/framework/blocks/detail/Detail.py (11335 => 11336)

--- trunk/chandler/parcels/osaf/framework/blocks/detail/Detail.py	2006-08-05 00:26:28 UTC (rev 11335)
+++ trunk/chandler/parcels/osaf/framework/blocks/detail/Detail.py	2006-08-05 02:45:38 UTC (rev 11336)
@@ -620,9 +620,9 @@
         return () # we won't be visible if this happens.
 
     # Collect the names and join them into a list
-    collectionNames = _(", ").join(sorted([coll.displayName 
-                                           for coll in item.appearsIn
-                                           if hasattr(coll, 'displayName')]))
+    collectionNames = _(", ").join(sorted(coll.displayName 
+                                          for coll in item.appearsIn
+                                          if hasattr(coll, 'displayName')))
     return collectionNames
     
 class AppearsInAEBlock(DetailSynchronizedAttributeEditorBlock):

Modified: trunk/chandler/parcels/osaf/sharing/__init__.py (11335 => 11336)

--- trunk/chandler/parcels/osaf/sharing/__init__.py	2006-08-05 00:26:28 UTC (rev 11335)
+++ trunk/chandler/parcels/osaf/sharing/__init__.py	2006-08-05 02:45:38 UTC (rev 11336)
@@ -701,7 +701,6 @@
         progressMonitor = None
         callback = None
 
-
     (useSSL, host, port, path, query, fragment) = splitUrl(url)
 
     ticket = ""

Modified: trunk/chandler/parcels/osaf/usercollections.py (11335 => 11336)

--- trunk/chandler/parcels/osaf/usercollections.py	2006-08-05 00:26:28 UTC (rev 11335)
+++ trunk/chandler/parcels/osaf/usercollections.py	2006-08-05 02:45:38 UTC (rev 11336)
@@ -21,6 +21,8 @@
 
 from i18n import OSAFMessageFactory as _
 
+import colorsys
+from application import styles
 
 class CollectionColors(schema.Item):
     """
@@ -81,15 +83,17 @@
 
 # Collection colors
 # in the form 'Color', _('LocalizableColorString'), 360-degree based hue
-import colorsys
-collectionHues = [('Blue', _(u'Blue'), 210),
-                  ('Green', _(u'Green'), 120),
-                  ('Rose', _(u'Rose'), 0),
-                  ('Salmon', _(u'Salmon'), 30),
-                  ('Purple', _(u'Purple'), 270),
-                  ('Violet', _(u'Violet'), 240),
-                  ('Fuschia', _(u'Fuschia'), 330)]
 
+collectionHues = \
+    [('Blue',    _(u'Blue'),    float(styles.cfg.get('color', 'BlueHue'))),
+     ('Green',   _(u'Green'),   float(styles.cfg.get('color', 'GreenHue'))),
+     ('Rose',    _(u'Rose'),    float(styles.cfg.get('color', 'RoseHue'))),
+     ('Salmon',  _(u'Salmon'),  float(styles.cfg.get('color', 'SalmonHue'))),
+     ('Purple',  _(u'Purple'),  float(styles.cfg.get('color', 'PurpleHue'))),
+     ('Violet',  _(u'Violet'),  float(styles.cfg.get('color', 'VioletHue'))),
+     ('Fuschia', _(u'Fuschia'), float(styles.cfg.get('color', 'FuschiaHue')))]
+
+
 def installParcel(parcel, oldVersion=None):
 
     collectionColors = CollectionColors.update(parcel, 'collectionColors',




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

Reply via email to