Title: [commits] (john) [11297] Fix bug exposed by tinderbox
Revision
11297
Author
john
Date
2006-08-01 09:40:56 -0700 (Tue, 01 Aug 2006)

Log Message

Fix bug exposed by tinderbox

Modified Paths

Diff

Modified: trunk/chandler/application/Utility.py (11296 => 11297)

--- trunk/chandler/application/Utility.py	2006-08-01 09:58:46 UTC (rev 11296)
+++ trunk/chandler/application/Utility.py	2006-08-01 16:40:56 UTC (rev 11297)
@@ -33,7 +33,7 @@
 # with your name (and some helpful text). The comment's really there just to
 # cause Subversion to warn you of a conflict when you update, in case someone 
 # else changes it at the same time you do (that's why it's on the same line).
-SCHEMA_VERSION = "228" #john: Renamed "My" Collections to Dashboard
+SCHEMA_VERSION = "229" #john: Fix bug in renaming "My" Collections to Dashboard
 
 logger = None # initialized in initLogging()
 

Modified: trunk/chandler/parcels/osaf/views/main/SideBar.py (11296 => 11297)

--- trunk/chandler/parcels/osaf/views/main/SideBar.py	2006-08-01 09:58:46 UTC (rev 11296)
+++ trunk/chandler/parcels/osaf/views/main/SideBar.py	2006-08-01 16:40:56 UTC (rev 11297)
@@ -736,6 +736,11 @@
     # cell. A height of zero uses the height of the cell
     editRectOffsets = schema.Sequence (schema.Integer, required = True)
 
+    """
+      A dictionary mapping a filterKind string to display name of the Kind.
+    """
+    kindToDisplayName = schema.Mapping (schema.Text)
+
     schema.addClouds(
         copying = schema.Cloud(
             byRef = [filterKind],
@@ -997,37 +1002,40 @@
         selectionRanges = self.contents.getSelectionRanges()
         if selectionRanges is None or len(selectionRanges) != 1:
             event.arguments['Enable'] = False
-            return
-
-        selectedItem = self.contents.getFirstSelectedItem()
-        if selectedItem is not None:
-            if hasattr (UserCollection(selectedItem), "displayNameAlternatives"):
-                collectionName = self.getNameAlternative (selectedItem)
+        else:
+            selectedItem = self.contents.getFirstSelectedItem()
+            if selectedItem is not None:
+                if hasattr (UserCollection(selectedItem), "displayNameAlternatives"):
+                    collectionName = self.getNameAlternative (selectedItem)
+                else:
+                    collectionName = selectedItem.getItemDisplayName()
             else:
-                collectionName = selectedItem.getItemDisplayName()
-        else:
-            collectionName = ""
+                collectionName = ""
 
-        arguments = {'collection': collectionName,
-                     'kind': self.getNameAlternative (schema.ns('osaf.pim', self.itsView).allCollection)}
-
-        if selectedItem is None:
-            enabled = False
-            menuTitle = _(u'Keep out of %(kind)s') % arguments
-        elif UserCollection(selectedItem).outOfTheBoxCollection:
-            enabled = False
-            menuTitle = _(u'Keep "%(collection)s" out of %(kind)s') % arguments
-        else:
-            enabled = True
-            mine = schema.ns('osaf.pim', self.itsView).mine
-            if selectedItem not in mine.sources:
-                menuTitle = _(u'Add "%(collection)s" to %(kind)s') % arguments
+            if self.filterKind is None:
+                key = "None"
             else:
+                key = os.path.basename (str (self.filterKind.itsPath))
+            arguments = {'collection': collectionName,
+                         'kind': self.kindToDisplayName[key]}
+    
+            if selectedItem is None:
+                enabled = False
+                menuTitle = _(u'Keep out of %(kind)s') % arguments
+            elif UserCollection(selectedItem).outOfTheBoxCollection:
+                enabled = False
                 menuTitle = _(u'Keep "%(collection)s" out of %(kind)s') % arguments
+            else:
+                enabled = True
+                mine = schema.ns('osaf.pim', self.itsView).mine
+                if selectedItem not in mine.sources:
+                    menuTitle = _(u'Add "%(collection)s" to %(kind)s') % arguments
+                else:
+                    menuTitle = _(u'Keep "%(collection)s" out of %(kind)s') % arguments
+    
+            event.arguments ['Text'] = menuTitle
+            event.arguments['Enable'] = enabled
 
-        event.arguments ['Text'] = menuTitle
-        event.arguments['Enable'] = enabled
-
     def getNameAlternative (self, item):
         """
         Chandler has a very confusing feature that some collection's names change

Modified: trunk/chandler/parcels/osaf/views/main/mainblocks.py (11296 => 11297)

--- trunk/chandler/parcels/osaf/views/main/mainblocks.py	2006-08-01 09:58:46 UTC (rev 11296)
+++ trunk/chandler/parcels/osaf/views/main/mainblocks.py	2006-08-01 16:40:56 UTC (rev 11297)
@@ -76,7 +76,11 @@
         elementDelegate = 'osaf.views.main.SideBar.SidebarElementDelegate',
         hideColumnHeadings = True,
         defaultEditableAttribute = u'displayName',
-        filterKind = osaf.pim.calendar.Calendar.CalendarEventMixin.getKind(repositoryView)).install(parcel)
+        filterKind = osaf.pim.calendar.Calendar.CalendarEventMixin.getKind(repositoryView),
+        kindToDisplayName = {'None': _(u'My items'),
+                             'MailMessageMixin': _(u'My mail'),
+                             'CalendarEventMixin': _(u'My calendar'),
+                             'TaskMixin': _(u'My tasks')}).install(parcel)
     Sidebar.contents.selectItem (pim_ns.allCollection)
 
     ApplicationBar = Toolbar.template(




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

Reply via email to