[Commits] (donn) Added Test menu for Lisa: "Share collection"

commits at osafoundation.org commits at osafoundation.org
Sat Aug 14 16:58:07 PDT 2004


Commit by: donn
Modified files:
chandler/parcels/osaf/views/main/Main.py 1.32 1.33
chandler/parcels/osaf/views/main/parcel.xml 1.88 1.89

Log message:
Added Test menu for Lisa: "Share collection"
--------------------------------------------
   * Also replaced onGenerateContentItemsEvent which was aparently removed by accident

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/Main.py.diff?r1=text&tr1=1.32&r2=text&tr2=1.33
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/parcel.xml.diff?r1=text&tr1=1.88&r2=text&tr2=1.89

Index: chandler/parcels/osaf/views/main/parcel.xml
diff -u chandler/parcels/osaf/views/main/parcel.xml:1.88 chandler/parcels/osaf/views/main/parcel.xml:1.89
--- chandler/parcels/osaf/views/main/parcel.xml:1.88	Wed Aug 11 19:22:22 2004
+++ chandler/parcels/osaf/views/main/parcel.xml	Sat Aug 14 16:58:06 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.88 $ -->
-<!-- $Date: 2004/08/12 02:22:22 $ -->
+<!-- $Revision: 1.89 $ -->
+<!-- $Date: 2004/08/14 23:58:06 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -147,6 +147,11 @@
     <dispatchToBlock itemref="doc:NavigationBar"/>
   </BlockEvent>
 
+  <BlockEvent itsName="ShareCollection">
+    <dispatchEnum>SendToBlock</dispatchEnum>
+    <dispatchToBlock itemref="doc:MainView"/>
+  </BlockEvent>
+  
   <ModifyContentsEvent itsName="AddAllAdditionalViews">
     <dispatchEnum>SendToBlock</dispatchEnum>
     <dispatchToBlock itemref="doc:Sidebar"/>
@@ -315,6 +320,7 @@
     <childrenBlocks itemref="doc:GenerateNoteItem"/>
     <childrenBlocks itemref="doc:ImportContactItem"/>
     <childrenBlocks itemref="doc:SharingSubscribeToCollectionItem"/>
+    <childrenBlocks itemref="doc:ShareCollectionItem"/>
     <childrenBlocks itemref="doc:EditMailAccountItem"/>
     <childrenBlocks itemref="doc:GetNewMailItem"/>
     <childrenBlocks itemref="doc:CheckRepositoryItem"/>
@@ -826,6 +832,13 @@
     <helpString>import Contacts from contacts.csv</helpString>
   </MenuItem>
 
+  <MenuItem itsName="ShareCollectionItem">
+    <blockName>ShareCollectionItem</blockName>
+    <title>Share collection</title>
+    <event itemref="doc:ShareCollection"/>
+    <helpString>Enable sharing a collection</helpString>
+  </MenuItem>
+
   <MenuItem itsName="SharingSubscribeToCollectionItem">
     <blockName>SharingSubscribeToCollection</blockName>
     <title>Subscribe to Collection...</title>
@@ -1027,7 +1040,7 @@
   </Menu>
 
   <MenuItem itsName="ItemSeparator2">
-    <blockName>ItemSeparator1</blockName>
+    <blockName>ItemSeparator2</blockName>
     <menuItemKind>Separator</menuItemKind>
   </MenuItem>
 
@@ -1479,6 +1492,7 @@
     <subscribeWhenVisibleEvents itemref="doc:NewCalendarEvent"/>
     <subscribeWhenVisibleEvents itemref="doc:NewNote"/>
     <subscribeWhenVisibleEvents itemref="doc:NewContact"/>
+    <subscribeWhenVisibleEvents itemref="doc:ShareCollection"/>
 
     <!-- Attributes -->
     <orientationEnum>Vertical</orientationEnum>

Index: chandler/parcels/osaf/views/main/Main.py
diff -u chandler/parcels/osaf/views/main/Main.py:1.32 chandler/parcels/osaf/views/main/Main.py:1.33
--- chandler/parcels/osaf/views/main/Main.py:1.32	Fri Aug 13 07:41:03 2004
+++ chandler/parcels/osaf/views/main/Main.py	Sat Aug 14 16:58:06 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.32 $"
-__date__ = "$Date: 2004/08/13 14:41:03 $"
+__version__ = "$Revision: 1.33 $"
+__date__ = "$Date: 2004/08/14 23:58:06 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -141,6 +141,12 @@
 
     # Test Methods
 
+    def onGenerateContentItemsEvent(self, notification): 
+        GenerateItems.GenerateNotes(2) 
+        GenerateItems.generateCalendarEventItems(2, 30) 
+        GenerateItems.GenerateContacts(2) 
+        Globals.repository.commit() 
+
     def onGenerateCalendarEventItemsEvent(self, notification):
         GenerateItems.generateCalendarEventItems(10, 30)
         Globals.repository.commit()
@@ -184,3 +190,43 @@
                               pageLocation, False, False)
         splash.Show(True)
 
+    def getSidebarSelectedCollection (self):
+        """
+          Return the sidebar's selected item collection.
+
+          The sidebar is a table, whose contents is a collection.
+        The selection is a table (one of the splitters), 
+        whose contents is a collection.
+        """
+        sidebarPath = '//parcels/osaf/views/main/Sidebar'
+        sidebar = Globals.repository.findPath (sidebarPath)
+        selectedBlock = sidebar.selection
+        assert selectedBlock, "No selected block in the Sidebar"
+        try:
+            selectionContents = selectedBlock.contents
+        except AttributeError:
+            selectionContents = None
+        return selectionContents
+
+    def onShareCollectionEvent (self, notification):
+        """
+        Stub for Lisa - Share the collection selected
+        in the sidebar.
+        """
+        collection = self.getSidebarSelectedCollection ()
+        if collection:
+            print 'Share collection "%s"' % collection.displayName
+
+    def onShareCollectionEventUpdateUI (self, notification):
+        """
+        Update the menu to reflect the selected collection name
+        """
+        collection = self.getSidebarSelectedCollection ()
+        notification.data ['Enable'] = collection is not None
+        if collection:
+            menuTitle = 'Share collection "%s"' \
+                    % collection.displayName
+        else:
+            menuTitle = 'Share a collection'
+        notification.data ['Text'] = menuTitle
+



More information about the Commits mailing list