[Commits] (pavlov) cleanup of zaobao.. support multiple views and make use of the sidebar

commits at osafoundation.org commits at osafoundation.org
Tue Feb 3 14:32:16 PST 2004


Commit by: pavlov
Modified files:
osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py 1.8 1.9
osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml 1.12 1.13
osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml 1.1 1.2
osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml 1.8 1.9
osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml 1.3 1.4

Log message:
cleanup of zaobao.. support multiple views and make use of the sidebar


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py.diff?r1=text&tr1=1.8&r2=text&tr2=1.9
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml.diff?r1=text&tr1=1.12&r2=text&tr2=1.13
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml.diff?r1=text&tr1=1.1&r2=text&tr2=1.2
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml.diff?r1=text&tr1=1.8&r2=text&tr2=1.9
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml.diff?r1=text&tr1=1.3&r2=text&tr2=1.4

Index: osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml:1.12 osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml:1.13
--- osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml:1.12	Mon Jan 26 12:35:53 2004
+++ osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/parcel.xml	Tue Feb  3 14:31:41 2004
@@ -168,6 +168,10 @@
   <!-- view related stuff -->
 
 
+  <Kind itemName="ZaoBaoList">
+    <classes key="python">OSAF.examples.zaobao.blocks.ZaoBaoList</classes>
+    <superKinds itemref="docSchema:TreeList"/>
+  </Kind>  
 
   <Kind itemName="ZaoBaoTreeList">
     <classes key="python">OSAF.examples.zaobao.blocks.ZaoBaoTreeList</classes>

Index: osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml:1.1 osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml:1.2
--- osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml:1.1	Mon Feb  2 08:35:56 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/locations/parcel.xml	Tue Feb  3 14:31:42 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.1 $ -->
-<!-- $Date: 2004/02/02 16:35:56 $ -->
+<!-- $Revision: 1.2 $ -->
+<!-- $Date: 2004/02/03 22:31:42 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -38,7 +38,7 @@
 
   <Node itemName="ZaoBao">
     <displayName>ZaoBao</displayName>
-    <item itemref="zaobao:ZaoBaoTab"/>
+    <item itemref="zaobao:ZaoBaoView"/>
   </Node>
 
 </core:Parcel>

Index: osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml:1.3 osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml:1.4
--- osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml:1.3	Mon Feb  2 16:49:58 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/zaobao/parcel.xml	Tue Feb  3 14:31:45 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.3 $ -->
-<!-- $Date: 2004/02/03 00:49:58 $ -->
+<!-- $Revision: 1.4 $ -->
+<!-- $Date: 2004/02/03 22:31:45 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -19,6 +19,9 @@
   <zb:RSSChannel itemName="osaf">
     <zb:url>http://www.osafoundation.org/rss/2.0/</zb:url>
   </zb:RSSChannel>
+  <zb:RSSChannel itemName="ted">
+    <zb:url>http://www.sauria.com/blog?flav=rss</zb:url>
+  </zb:RSSChannel>
 
   <!-- Queries -->
   <Query itemName="myQuery">
@@ -35,42 +38,17 @@
   </CharacterStyle>  
 
   <!-- Events -->
-  <ChoiceEvent itemName="MyDumbEvent">
-    <dispatchEnum>SendToBlock</dispatchEnum>
-    <dispatchToBlock itemref="doc:ItemList"/>
-    <methodName>OnDumbEvent</methodName>
-    <choice>Buttons</choice>
-  </ChoiceEvent>
 
   <!-- Menus -->
-  <Menu itemName="ZBMenu">
-    <title>ZaoBao</title>
-    <operation>InsertBefore</operation>
-    <menuLocation></menuLocation>
-    <itemLocation></itemLocation>
-    <helpString></helpString>
-  </Menu>
 
   <!-- Menu Items -->
-  <MenuItem itemName="BlankItem">
-    <title>Do Something...</title>
-    <operation>InsertBefore</operation>
-    <menuLocation>ZBMenu</menuLocation>
-    <itemLocation></itemLocation>
-    <menuItemKind>Normal</menuItemKind>
-    <accel></accel>
-    <event itemref="doc:MyDumbEvent"/>
-    <helpString></helpString>
-  </MenuItem>
-
 
-  <!-- The view itself -->
 
-  <zb:ZaoBaoTreeList itemName="ItemList">
-    <contentSpec itemref="doc:myQuery"/>
+  <!-- The main ZaoBao view -->
 
+  <zb:ZaoBaoTreeList itemName="ZaoBaoTreeList">
     <hideRoot>True</hideRoot>
-    <noLines>False</noLines>
+    <noLines>True</noLines>
     <useButtons>True</useButtons>
 
     <columnHeadings>Subject</columnHeadings>
@@ -109,7 +87,7 @@
     <characterStyle itemref="doc:HeaderCharacterStyle"/>
   </EditText>
 
-  <BoxContainer itemName="ZaoBaoTab">
+  <BoxContainer itemName="ZaoBaoView">
     <eventBoundary>True</eventBoundary>
     <open>True</open>
     <size>200,100</size>
@@ -119,13 +97,64 @@
     <stretchFactor>1.0</stretchFactor>
     <orientationEnum>Vertical</orientationEnum>
 
-    <childrenBlocks itemref="doc:ZBMenu"/>
-    <childrenBlocks itemref="doc:BlankItem"/>
-
-    <childrenBlocks itemref="doc:ItemList"/>
+    <childrenBlocks itemref="doc:ZaoBaoTreeList"/>
     <childrenBlocks itemref="doc:ItemView"/>
     <childrenBlocks itemref="doc:NewChannel"/>
 
   </BoxContainer>
+
+
+
+
+
+
+
+
+  <!-- Example single channel view -->
+
+  <zb:ZaoBaoList itemName="ChannelList">
+    <contentSpec itemref="doc:myQuery"/>
+
+    <hideRoot>True</hideRoot>
+    <noLines>True</noLines>
+    <useButtons>True</useButtons>
+
+    <columnHeadings>Subject</columnHeadings>
+    <columnWidths>300</columnWidths>
+    <columnHeadings>Date</columnHeadings>
+    <columnWidths>150</columnWidths>
+
+    <size>600,200</size>
+    <minimumSize>400,100</minimumSize>
+    <border>0.0, 0.0, 0.0, 0.0</border>
+    <alignmentEnum>grow</alignmentEnum>
+    <stretchFactor>1.0</stretchFactor>
+  </zb:ZaoBaoList>
+
+  <zb:ZaoBaoItemView itemName="ChannelItemView">
+    <url></url>
+    <open>True</open>
+    <size>100,50</size>
+    <minimumSize>100,50</minimumSize>
+    <border>0.0, 0.0, 0.0, 0.0</border>
+    <alignmentEnum>grow</alignmentEnum>
+    <stretchFactor>1.0</stretchFactor>
+  </zb:ZaoBaoItemView>
+
+  <BoxContainer itemName="ZaoBaoChannelView">
+    <eventBoundary>True</eventBoundary>
+    <open>True</open>
+    <size>200,100</size>
+    <minimumSize>200,100</minimumSize>
+    <border>2.0, 2.0, 2.0, 2.0</border>
+    <alignmentEnum>grow</alignmentEnum>
+    <stretchFactor>1.0</stretchFactor>
+    <orientationEnum>Vertical</orientationEnum>
+
+    <childrenBlocks itemref="doc:ChannelList"/>
+    <childrenBlocks itemref="doc:ChannelItemView"/>
+
+  </BoxContainer>
+
 
 </core:Parcel>

Index: osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.8 osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.9
--- osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml:1.8	Tue Feb  3 13:25:30 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/main/parcel.xml	Tue Feb  3 14:31:43 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.8 $ -->
-<!-- $Date: 2004/02/03 21:25:30 $ -->
+<!-- $Revision: 1.9 $ -->
+<!-- $Date: 2004/02/03 22:31:43 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -293,7 +293,13 @@
 
   <Node itemName="ZaoBao">
     <displayName>ZaoBao</displayName>
-    <item itemref="zaobao:ZaoBaoTab"/>
+    <item itemref="zaobao:ZaoBaoView"/>
+    <children itemref="doc:OSAFNews"/>
+  </Node>
+
+  <Node itemName="OSAFNews">
+    <displayName>OSAF News</displayName>
+    <item itemref="zaobao:ZaoBaoChannelView"/>
   </Node>
 
   <Node itemName="CalendarView">

Index: osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py:1.8 osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py:1.9
--- osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py:1.8	Mon Feb  2 17:05:14 2004
+++ osaf/chandler/Chandler/parcels/OSAF/examples/zaobao/blocks.py	Tue Feb  3 14:31:41 2004
@@ -5,7 +5,7 @@
 from OSAF.framework.notifications.Notification import Notification
 from OSAF.examples.zaobao.RSSData import ZaoBaoParcel
 
-class ZaoBaoTreeList(TreeList):
+class ZaoBaoList(TreeList):
     def _addChildNode(self, node, child, hasKids):
         displayName = child.getAttributeValue('displayName',
                                               default='<Untitled>')
@@ -15,14 +15,57 @@
         node.AddChildNode(child, names, hasKids)
 
     def GetTreeData(self, node):
+        item = node.GetData()
+
+        # handle the root node case
+        if item == None:
+            node.AddRootNode(Globals.repository, ['//'], True)
+            return
+
+        # add all the children to the list
         repository = self.getRepository()
         try:
             cs = self.contentSpec.data.split('.')
-            c = repository.find(str(cs[0]))
-            c.getAttributeValue(str(cs[1]), default=None)
+            channel = repository.find(str(cs[0]))
+            items = channel.getAttributeValue(str(cs[1]), default=[])
         except:
-            pass
+            print 'error getting items'
+            return
+
+        for item in items:
+            self._addChildNode(node, item, False)
+
+
+    def OnGoToURI(self, notification):
+        wxTreeListWindow = Globals.association[self.getUUID()]
+        wxTreeListWindow.GoToURI(notification.data['URI'])
+
+    def OnEnterPressedEvent(self, notification):
+        from OSAF.examples.zaobao.RSSData import RSSChannel
+        Globals.repository.commit()
 
+        url = notification.GetData()['text']
+        if len(url) == 0:
+            return
+
+        chan = RSSChannel()        
+        chan.url = url
+
+        import ZaoBaoAgent
+        ZaoBaoAgent.UpdateChannel(chan)
+        Globals.repository.commit()
+
+
+class ZaoBaoTreeList(TreeList):
+    def _addChildNode(self, node, child, hasKids):
+        displayName = child.getAttributeValue('displayName',
+                                              default='<Untitled>')
+        date = child.getAttributeValue('date', default='')
+
+        names = [displayName, str(date)]
+        node.AddChildNode(child, names, hasKids)
+
+    def GetTreeData(self, node):
         item = node.GetData()
         if item:
             chanKind = ZaoBaoParcel.getRSSChannelKind()
@@ -88,7 +131,7 @@
                 HTMLText = HTMLText + '</a>\n'
 
             desc = item.getAttributeValue('description', default=displayName)
-            desc = desc.replace("<", "&lt;").replace(">", "&gt;")
+            #desc = desc.replace("<", "&lt;").replace(">", "&gt;")
             HTMLText = HTMLText + '<p>' + desc + '</p>\n\n'
 
             HTMLText = HTMLText + '</body></html>\n'



More information about the Commits mailing list