- Revision
- 11317
- Author
- stearns
- Date
- 2006-08-02 18:20:29 -0700 (Wed, 02 Aug 2006)
Log Message
Some triage-status work...
- Fix bug 6313 (triage: new items should be 'now') by doing nothing (the initialValue for triageStatus was already 'now'.)
- Fix bug 6314 (triage: received email messages should be 'now') by setting incoming emails to 'now' if they were also events (the normal incoming-message case was already taken care of because new items were already 'now'.
- Fix bug 6319 (triage: clickable table cell).
- At Jeffrey's suggestion: each section's header row now appears if there are any items in the section; previously, you wouldn't see any section headers unless more than one section was called for.
- Also tweaked the widths of the icon columns to work around column header issues.
- Fix bug 6313 (triage: new items should be 'now') by doing nothing (the initialValue for triageStatus was already 'now'.)
- Fix bug 6314 (triage: received email messages should be 'now') by setting incoming emails to 'now' if they were also events (the normal incoming-message case was already taken care of because new items were already 'now'.
- Fix bug 6319 (triage: clickable table cell).
- At Jeffrey's suggestion: each section's header row now appears if there are any items in the section; previously, you wouldn't see any section headers unless more than one section was called for.
- Also tweaked the widths of the icon columns to work around column header issues.
Modified Paths
- trunk/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py
- trunk/chandler/parcels/osaf/mail/message.py
- trunk/chandler/parcels/osaf/pim/__init__.py
- trunk/chandler/parcels/osaf/pim/items.py
- trunk/chandler/parcels/osaf/views/main/Dashboard.py
- trunk/chandler/parcels/osaf/views/main/Sections.py
- trunk/chandler/parcels/osaf/views/main/summaryblocks.py
Diff
Modified: trunk/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -37,8 +37,8 @@ from PyICU import ICUError, ICUtzinfo, UnicodeString from osaf.framework.blocks.Block import (ShownSynchronizer, wxRectangularChild, debugName) -from osaf.pim.items import ContentItem, triageStatusNames -from application import schema +from osaf.pim.items import ContentItem +from application import schema, styles from application.dialogs import RecurrenceDialog, TimeZoneList from util.MultiStateButton import BitmapInfo, MultiStateBitmapCache @@ -470,16 +470,9 @@ Called by the attribute editor when it changes the underlying value; calls the callback function set by L{SetChangeCallback}. """ - # We shouldn't notify about the change if this item's gone... - if self.item.isDeleted(): - return - try: - callback = self.changeCallBack - except AttributeError: - pass - else: - if callback is not None: - callback() + callback = getattr(self, 'changeCallBack', None) + if callback and not self.item.isDeleted(): + callback() class DragAndDropTextCtrl(ShownSynchronizer, DragAndDrop.DraggableWidget, @@ -2268,15 +2261,47 @@ # logger.debug("Rebuilding DV timezone popup again") # see how often this happens. TimeZoneList.buildTZChoiceList(self.item.itsView, control, value) -class TriageAttributeEditor(ChoiceAttributeEditor): - """ - A pop-up control for the triageStatus attribute. Displays a - string, and then a control when clicked on. - """ - def GetChoices(self): - # would be nice if this came directly from the enum - return triageStatusNames - +class TriageAttributeEditor(BaseAttributeEditor): + def Draw (self, dc, rect, (item, attributeName), isInSelection=False): + # Get the value we'll draw, and its label + item = RecurrenceDialog.getProxy(u'ui', item, createNew=False) + value = getattr(item, attributeName, '') + label = value and pim.getTriageStatusName(value) or u'' + + # Paint our box in the right color + backgroundColor = styles.cfg.get('summary', 'SectionSample_%s_%s' + % (attributeName, value)) or '#000000' + dc.SetPen(wx.WHITE_PEN) + brush = wx.Brush(backgroundColor, wx.SOLID) + dc.SetBrush(brush) + dc.DrawRectangleRect(rect) + + # Draw the text + dc.SetBackgroundMode (wx.TRANSPARENT) + dc.SetTextForeground(wx.WHITE) + (labelWidth, labelHeight, labelDescent, ignored) = dc.GetFullTextExtent(label) + labelTop = rect.y + ((rect.height - labelHeight) / 2) + labelLeft = rect.x + ((rect.width - labelWidth) / 2) + dc.DrawText(label, labelLeft, labelTop) + + def OnMouseChange(self, event, cell, isIn, isDown, (item, attributeName)): + """ + Handle live changes of mouse state related to our cell. + """ + # Note down-ness changes; eat the event if the downness changed, and + # trigger an advance if appropriate. + if isDown != getattr(self, 'wasDown', False): + if isIn and not isDown: + oldValue = self.GetAttributeValue(item, attributeName) + newValue = pim.getNextTriageStatus(oldValue) + self.SetAttributeValue(item, attributeName, newValue) + if isDown: + self.wasDown = True + else: + del self.wasDown + else: + event.Skip() + class IconAttributeEditor (BaseAttributeEditor): """ Base class for an icon-based attribute editor; subclass and provide
Modified: trunk/chandler/parcels/osaf/mail/message.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/mail/message.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/mail/message.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -274,6 +274,9 @@ if mimePart.get_content_type() == "text/calendar": m = importIcalendarPayload(mimePart) if m is not None: + # In case we found an existing event to update, + # force its triageStatus to 'now' (bug 6314) + m.triageStatus = 'now' break if m is None:
Modified: trunk/chandler/parcels/osaf/pim/__init__.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/pim/__init__.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/pim/__init__.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -18,7 +18,8 @@ # from items import ( Calculated, ContentKind, ContentItem, ImportanceEnum, Group, Principal, - Project, Tag, TriageEnum, UserNotification + Project, Tag, TriageEnum, getTriageStatusName, getTriageStatusOrder, + getNextTriageStatus, UserNotification ) from notes import Note from contacts import Contact, ContactName
Modified: trunk/chandler/parcels/osaf/pim/items.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/pim/items.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/pim/items.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -56,16 +56,16 @@ values = "now", "later", "done" triageStatusNames = _(u"Now"), _(u"Later"), _(u"Done") +triageStatusNamesDict = dict(zip(TriageEnum.values, triageStatusNames)) def getTriageStatusName(value): - for i, triageValue in enumerate(TriageEnum.values): - if triageValue == value: - return triageStatusNames[i] - assert false - return u'' + return triageStatusNamesDict.get(value, u'') triageStatusOrder = dict((v, i) for i, v in enumerate(TriageEnum.values)) def getTriageStatusOrder(value): return triageStatusOrder[value] + +def getNextTriageStatus(value): + return TriageEnum.values[(triageStatusOrder[value]+1) % len(TriageEnum.values)] class Calculated(property): """
Modified: trunk/chandler/parcels/osaf/views/main/Dashboard.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/views/main/Dashboard.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/views/main/Dashboard.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -72,6 +72,11 @@ col = self.XToCol(unscrolledX) return (col, row) + def RebuildSections(self): + # If sections change, forget that we were over a cell. + if hasattr(self, 'overCell'): + del self.overCell + def OnMouseEvents (self, event): """ Handle the variety of raw mouse events cells get, passing them to
Modified: trunk/chandler/parcels/osaf/views/main/Sections.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/views/main/Sections.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/views/main/Sections.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -16,7 +16,8 @@ import wx from application import schema, styles from i18n import OSAFMessageFactory as _ -from osaf.framework.blocks import ControlBlocks, DrawingUtilities, Styles +from osaf.framework.blocks import (ControlBlocks, debugName, DrawingUtilities, + Styles) from osaf.framework.attributeEditors import BaseAttributeEditor from osaf.pim import ContentItem from osaf.pim.items import getTriageStatusName, getTriageStatusOrder @@ -69,8 +70,7 @@ rebuild the sections - this is relatively cheap as long as there aren't a lot of sections """ - #for (row, ignored, ignored) in self.sectionRows: - #self.SetCellSize(row, 0, 1, 1) + super(SectionedGridDelegate, self).RebuildSections() self.sectionRows = [] self.sectionLabels = [] self.sectionIndexes = [] @@ -92,8 +92,8 @@ self.sectionIndexes = get_divisions(self.blockItem.contents, key=lambda x: getTriageStatusOrder(getattr(x, indexName))) - # don't show section headers for zero or one section - if len(self.sectionIndexes) <= 1: + # don't show section headers unless we have at least one section + if len(self.sectionIndexes) == 0: return # now build the row-based sections - each entry in this array @@ -135,9 +135,6 @@ # dictionary that maps to a string label label = getTriageStatusName(sectionValue) self.sectionLabels.append(label) - - #for (row, ignored, ignored) in self.sectionRows: - #self.SetCellSize(row, 0, 1, self.GetNumberCols()) # make sure we're sane assert len(self.sectionRows) == len(self.sectionIndexes) @@ -239,7 +236,7 @@ linear search through the sections. Generally there aren't a lot of sections though so this should be reasonably fast. """ - if len(self.sectionIndexes) <= 1: + if len(self.sectionIndexes) == 0: return itemIndex sectionAdjust = len(self.sectionIndexes) - 1
Modified: trunk/chandler/parcels/osaf/views/main/summaryblocks.py (11316 => 11317)
--- trunk/chandler/parcels/osaf/views/main/summaryblocks.py 2006-08-03 00:36:04 UTC (rev 11316) +++ trunk/chandler/parcels/osaf/views/main/summaryblocks.py 2006-08-03 01:20:29 UTC (rev 11317) @@ -39,7 +39,7 @@ branchStub = detailblocks.DetailRoot) #detailContentsCollection = pim.ListCollection.update( #parcel, 'DetailContentsCollection') - + iconColumnWidth = 23 # temporarily not 20, to work around header bug 6168 SplitterWindow.template( 'TableSummaryViewTemplate', eventBoundary = True, @@ -54,13 +54,13 @@ icon = 'ColHTask', valueType = 'kind', kind = pim.TaskMixin.getKind(repositoryView), - width = 20, + width = iconColumnWidth, readOnly = True), Column.update(parcel, 'SumColMail', icon = 'ColHMail', valueType = 'kind', kind = pim.mail.MailMessageMixin.getKind(repositoryView), - width = 20, + width = iconColumnWidth, readOnly = True), Column.update(parcel, 'SumColWho', heading = _(u'Who'), @@ -77,7 +77,7 @@ icon = 'ColHEvent', valueType = 'kind', kind = pim.CalendarEventMixin.getKind(repositoryView), - width = 20, + width = iconColumnWidth, readOnly = True), Column.update(parcel, 'SumColDate', heading = _(u'Date'),
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
