[Commits] (alecf) Land most of ZaoBao 0.5 changes:
commits at osafoundation.org
commits at osafoundation.org
Thu Feb 3 18:17:35 PST 2005
Commit by: alecf
Modified files:
chandler/parcels/osaf/examples/zaobao/blocks.py 1.32 1.33
chandler/parcels/osaf/examples/zaobao/parcel.xml 1.29 1.30
chandler/parcels/osaf/examples/zaobao/RSSData.py 1.26 1.27
chandler/parcels/osaf/views/zaobao/parcel.xml 1.33 1.34
chandler/parcels/osaf/views/main/Main.py 1.116 1.117
chandler/parcels/osaf/views/main/parcel.xml 1.164 1.165
chandler/parcels/osaf/views/content/parcel.xml 1.89 1.90
chandler/parcels/osaf/framework/blocks/detail/Detail.py 1.83 1.84
chandler/parcels/osaf/framework/blocks/detail/parcel.xml 1.62 1.63
Log message:
Land most of ZaoBao 0.5 changes:
- read-only view in the detail view
- HTML content area for feed contents
- Integration into sidebar - ability to New->ZaoBao channel to add a new URL
- make it so that we only add new RSSItems, rather than blowing away, and then recreating, new RSSItems every startup
- remove default list of 3 RSS feeds
- also, change detail view classes slightly so that we can have a readonly static text attribute that displays an attribute's content
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/examples/zaobao/blocks.py.diff?r1=text&tr1=1.32&r2=text&tr2=1.33
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/examples/zaobao/parcel.xml.diff?r1=text&tr1=1.29&r2=text&tr2=1.30
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/examples/zaobao/RSSData.py.diff?r1=text&tr1=1.26&r2=text&tr2=1.27
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/zaobao/parcel.xml.diff?r1=text&tr1=1.33&r2=text&tr2=1.34
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/Main.py.diff?r1=text&tr1=1.116&r2=text&tr2=1.117
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/parcel.xml.diff?r1=text&tr1=1.164&r2=text&tr2=1.165
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/content/parcel.xml.diff?r1=text&tr1=1.89&r2=text&tr2=1.90
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/Detail.py.diff?r1=text&tr1=1.83&r2=text&tr2=1.84
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/parcel.xml.diff?r1=text&tr1=1.62&r2=text&tr2=1.63
Index: chandler/parcels/osaf/examples/zaobao/blocks.py
diff -u chandler/parcels/osaf/examples/zaobao/blocks.py:1.32 chandler/parcels/osaf/examples/zaobao/blocks.py:1.33
--- chandler/parcels/osaf/examples/zaobao/blocks.py:1.32 Tue Feb 1 09:30:15 2005
+++ chandler/parcels/osaf/examples/zaobao/blocks.py Thu Feb 3 18:17:31 2005
@@ -1,8 +1,8 @@
""" ZaoBao blocks
"""
-__version__ = "$Revision: 1.32 $"
-__date__ = "$Date: 2005/02/01 17:30:15 $"
+__version__ = "$Revision: 1.33 $"
+__date__ = "$Date: 2005/02/04 02:17:31 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -129,6 +129,8 @@
content = displayName
#desc = desc.replace("<", "<").replace(">", ">")
HTMLText = HTMLText + '<p>' + content + '</p>\n\n'
+ #should find a good way to localize "more..."
+ HTMLText = HTMLText + '<br><a href="' + item.link + '">more...</a>'
HTMLText = HTMLText + '</body></html>\n'
Index: chandler/parcels/osaf/examples/zaobao/RSSData.py
diff -u chandler/parcels/osaf/examples/zaobao/RSSData.py:1.26 chandler/parcels/osaf/examples/zaobao/RSSData.py:1.27
--- chandler/parcels/osaf/examples/zaobao/RSSData.py:1.26 Thu Jan 27 13:01:48 2005
+++ chandler/parcels/osaf/examples/zaobao/RSSData.py Thu Feb 3 18:17:31 2005
@@ -1,10 +1,11 @@
-__revision__ = "$Revision: 1.26 $"
-__date__ = "$Date: 2005/01/27 21:01:48 $"
+__revision__ = "$Revision: 1.27 $"
+__date__ = "$Date: 2005/02/04 02:17:31 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
import application
from osaf.contentmodel.ContentModel import ContentItem
+from osaf.contentmodel.ItemCollection import ItemCollection
import mx.DateTime
import feedparser
@@ -50,7 +51,7 @@
return channel
-class RSSChannel(ContentItem):
+class RSSChannel(ItemCollection):
myKindID = None
myKindPath = "//parcels/osaf/examples/zaobao/RSSChannel"
@@ -58,15 +59,16 @@
super(RSSChannel, self).__init__(name, parent, kind, view)
self.items = []
- def Update(self):
+ def Update(self, data=None):
etag = self.getAttributeValue('etag', default=None)
lastModified = self.getAttributeValue('lastModified', default=None)
if lastModified:
lastModified = lastModified.tuple()
- # fetch the data
- data = feedparser.parse(str(self.url), etag, lastModified)
-
+ if not data:
+ # fetch the dat
+ data = feedparser.parse(str(self.url), etag, lastModified)
+
# set etag
SetAttribute(self, data, 'etag')
@@ -100,21 +102,29 @@
def _DoItems(self, items):
# make children
- #print 'len items:', len(items)
-
+
# XXX because feedparser is currently broken and gives us
# all new entries when a feed changes, we need to delete
# all the existing items
- if len(items) > 0:
- for item in self.items:
- item.delete()
-
+
+ # instead, lets look for each existing item. This is ugly and is an O(n^2) problem
+ # if the items are unsorted. Bleah.
view = self.itsView
- for itemData in items:
- #print 'new item'
- rssItem = RSSItem(view=view)
- rssItem.Update(itemData)
- self.addValue('items', rssItem)
+ if len(items) > 0:
+ for newItem in items:
+ found = False
+ for oldItem in self.items:
+ # check to see if this doesn't already exist
+ if oldItem.isSimilar(newItem):
+ found = True
+ # how to break out of this loop?
+
+ if not found:
+ # we have a new item - add it
+ rssItem = RSSItem(view=view)
+ rssItem.Update(newItem)
+ self.addValue('items', rssItem)
+ self.add(rssItem)
##
# RSSItem
@@ -142,3 +152,22 @@
date = data.get('date')
if date:
self.date = mx.DateTime.DateTimeFrom(str(date))
+
+ def isSimilar(self, feedItem):
+ """
+ Returns True if the two items are the same, False otherwise
+ """
+ try:
+ # not every item has a date, so if neither item has a date, then
+ # in a sense their dates are equivalent
+ if self.displayName == feedItem.title and \
+ (('date' not in feedItem and not self.hasAttributeValue('date')) or \
+ (self.date == mx.DateTime.DateTimeFrom(str(feedItem.date)))):
+ return True
+ else:
+ return False
+ except Exception, e:
+ print "oops: " + str(e)
+ return False
+
+
Index: chandler/parcels/osaf/examples/zaobao/parcel.xml
diff -u chandler/parcels/osaf/examples/zaobao/parcel.xml:1.29 chandler/parcels/osaf/examples/zaobao/parcel.xml:1.30
--- chandler/parcels/osaf/examples/zaobao/parcel.xml:1.29 Tue Feb 1 09:30:15 2005
+++ chandler/parcels/osaf/examples/zaobao/parcel.xml Thu Feb 3 18:17:31 2005
@@ -41,7 +41,9 @@
<!-- Kind: RSSChannel -->
<Kind itsName="RSSChannel">
- <superKinds itemref="content:ContentItem"/>
+ <!-- <superKinds itemref="content:ContentItem"/> -->
+ <!-- make this into an item collection so we can appear natively in the sidebar -->
+ <superKinds itemref="content:ItemCollection"/>
<!-- <superKinds itemref="content:Note"/> -->
<classes key="python">osaf.examples.zaobao.RSSData.RSSChannel</classes>
Index: chandler/parcels/osaf/views/main/parcel.xml
diff -u chandler/parcels/osaf/views/main/parcel.xml:1.164 chandler/parcels/osaf/views/main/parcel.xml:1.165
--- chandler/parcels/osaf/views/main/parcel.xml:1.164 Wed Feb 2 09:56:29 2005
+++ chandler/parcels/osaf/views/main/parcel.xml Thu Feb 3 18:17:32 2005
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.164 $ -->
-<!-- $Date: 2005/02/02 17:56:29 $ -->
+<!-- $Revision: 1.165 $ -->
+<!-- $Date: 2005/02/04 02:17:32 $ -->
<!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -12,7 +12,6 @@
xmlns:doc="http://osafoundation.org/parcels/osaf/views/main"
xmlns:repository="http://osafoundation.org/parcels/osaf/views/repositoryviewer"
xmlns:demo="http://osafoundation.org/parcels/osaf/views/demo"
- xmlns:zaobao="http://osafoundation.org/parcels/osaf/views/zaobao"
xmlns:content="http://osafoundation.org/parcels/osaf/views/content"
xmlns:contentModel="http://osafoundation.org/parcels/osaf/contentmodel"
xmlns:mail="http://osafoundation.org/parcels/osaf/contentmodel/mail"
@@ -192,22 +191,6 @@
<methodName>onModifyContentsEvent</methodName>
<items itemref="demo:BlockDemoView"/>
</ModifyContentsEvent>
-
- <ModifyContentsEvent itsName="AddZaoBaoChannelView">
- <blockName>AddZaoBaoView</blockName>
- <dispatchEnum>SendToBlockByName</dispatchEnum>
- <dispatchToBlockName>Sidebar</dispatchToBlockName>
- <methodName>onModifyContentsEvent</methodName>
- <items itemref="zaobao:ZaoBaoChannelView"/>
- </ModifyContentsEvent>
-
- <ModifyContentsEvent itsName="AddZaoBaoItemView">
- <blockName>AddZaoBaoView</blockName>
- <dispatchEnum>SendToBlockByName</dispatchEnum>
- <dispatchToBlockName>Sidebar</dispatchToBlockName>
- <methodName>onModifyContentsEvent</methodName>
- <items itemref="zaobao:ZaoBaoItemView"/>
- </ModifyContentsEvent>
<ModifyContentsEvent itsName="AddKindViews">
<blockName>AddKindViews</blockName>
@@ -527,6 +510,7 @@
<childrenBlocks itemref="doc:NewEventItem"/>
<childrenBlocks itemref="doc:NewSeparator1"/>
<childrenBlocks itemref="doc:NewContactItem"/>
+ <childrenBlocks itemref="doc:NewZaoBaoChannel"/>
</Menu>
<MenuItem itsName="NewNoteItem">
@@ -1140,8 +1124,6 @@
<childrenBlocks itemref="doc:AddAllAdditionalViewsItem"/>
<childrenBlocks itemref="doc:TestSeparator1"/>
- <childrenBlocks itemref="doc:AddZaoBaoItemViewItem"/>
- <childrenBlocks itemref="doc:AddZaoBaoChannelViewItem"/>
<childrenBlocks itemref="doc:AddDemoViewItem"/>
<childrenBlocks itemref="doc:AddRepositoryViewItem"/>
<childrenBlocks itemref="doc:AddCPIAViewItem"/>
@@ -1172,20 +1154,20 @@
<event itemref="doc:AddDemoView"/>
<helpString>Adds the block demo view to the sidebar</helpString>
</MenuItem>
-
- <MenuItem itsName="AddZaoBaoChannelViewItem">
- <blockName>AddZaoBaoChannelViewItem</blockName>
- <title>Add ZaoBao Channels</title>
- <event itemref="doc:AddZaoBaoChannelView"/>
- <helpString>Adds the ZaoBao RSS reader channels</helpString>
- </MenuItem>
-
- <MenuItem itsName="AddZaoBaoItemViewItem">
- <blockName>AddZaoBaoItemViewItem</blockName>
- <title>Add ZaoBao RSS Items</title>
- <event itemref="doc:AddZaoBaoItemView"/>
- <helpString>Adds the ZaoBao RSS reader feed items</helpString>
+
+ <!-- XXX temporary until we have a dynamic way to add this -->
+ <BlockEvent itsName="NewZaoBaoChannelEvent">
+ <blockName>NewZaoBaoChannel</blockName>
+ <dispatchEnum>SendToBlockByName</dispatchEnum>
+ <dispatchToBlockName>MainView</dispatchToBlockName>
+ </BlockEvent>
+
+ <MenuItem itsName="NewZaoBaoChannel">
+ <blockName>NewZaoBaoChannelItem</blockName>
+ <title>New ZaoBao Channel</title>
+ <event itemref="doc:NewZaoBaoChannelEvent"/>
</MenuItem>
+ <!-- end temporary -->
<MenuItem itsName="AddRepositoryViewItem">
<blockName>AddRepositoryViewItem</blockName>
Index: chandler/parcels/osaf/views/zaobao/parcel.xml
diff -u chandler/parcels/osaf/views/zaobao/parcel.xml:1.33 chandler/parcels/osaf/views/zaobao/parcel.xml:1.34
--- chandler/parcels/osaf/views/zaobao/parcel.xml:1.33 Tue Feb 1 09:30:15 2005
+++ chandler/parcels/osaf/views/zaobao/parcel.xml Thu Feb 3 18:17:31 2005
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.33 $ -->
-<!-- $Date: 2005/02/01 17:30:15 $ -->
+<!-- $Revision: 1.34 $ -->
+<!-- $Date: 2005/02/04 02:17:31 $ -->
<!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
<core:Parcel itsName="zaobao"
- xmlns:core="http://osafoundation.org/parcels/core"
xmlns="http://osafoundation.org/parcels/osaf/framework/blocks"
+ xmlns:core="http://osafoundation.org/parcels/core"
xmlns:doc="http://osafoundation.org/parcels/osaf/views/zaobao"
xmlns:events="http://osafoundation.org/parcels/osaf/framework/blocks/Events"
xmlns:zb="http://osafoundation.org/parcels/osaf/examples/zaobao"
@@ -17,19 +17,6 @@
<core:version>0.3</core:version>
- <!-- RSS Channels -->
- <zb:RSSChannel itsName="osaf-rss-channel">
- <displayName>Loading... OSAF News</displayName>
- <zb:url>http://www.osafoundation.org/rss/2.0/</zb:url>
- </zb:RSSChannel>
- <zb:RSSChannel itsName="chandlerwiki-rss-channel">
- <displayName>Loading... Chandler Wiki</displayName>
- <zb:url>http://wiki.osafoundation.org/twiki/bin/view/Chandler/WebRss?skin=rss</zb:url>
- </zb:RSSChannel>
- <zb:RSSChannel itsName="junglewiki-rss-channel">
- <displayName>Loading... Jungle Wiki</displayName>
- <zb:url>http://wiki.osafoundation.org/twiki/bin/view/Jungle/WebRss?skin=rss</zb:url>
- </zb:RSSChannel>
<!-- Styles -->
<CharacterStyle itsName="HeaderCharacterStyle">
@@ -74,59 +61,7 @@
<minimumSize>900,580</minimumSize>
</HTML>
- <Tree itsName="ChannelList">
- <elementDelegate>osaf.examples.zaobao.blocks.ZaoBaoListDelegate</elementDelegate>
- <hideRoot>False</hideRoot>
- <rootPath itemref="doc:osaf-rss-channel"/>
-
- <columnHeadings>Subject</columnHeadings>
- <columnWidths>300</columnWidths>
- <columnHeadings>Date</columnHeadings>
- <columnWidths>150</columnWidths>
-
- <size>600,200</size>
- <minimumSize>400,100</minimumSize>
- </Tree>
-
- <SplitterWindow itsName="ZaoBaoChannelViewOld">
- <eventBoundary>True</eventBoundary>
- <size>900,580</size>
- <minimumSize>900,580</minimumSize>
-
- <childrenBlocks itemref="doc:ChannelList"/>
- <childrenBlocks itemref="doc:ChannelItemDetail"/>
- </SplitterWindow>
-
- <contentModel:ItemCollection itsName="ZaoBaoItemView">
- <displayName>RSS Items</displayName>
- <_rule value="for i in '//parcels/osaf/examples/zaobao/RSSItem' where True"/>
- </contentModel:ItemCollection>
- <contentModel:ItemCollection itsName="ZaoBaoChannelView">
- <displayName>RSS Channels</displayName>
- <_rule value="for i in '//parcels/osaf/examples/zaobao/RSSChannel' where True"/>
- </contentModel:ItemCollection>
-
- <BoxContainer itsName="ZaoBaoViewOld">
- <displayName>ZaoBao</displayName>
-
- <!-- Menus -->
- <!-- <childrenBlocks itemRef="doc:Menu"/> -->
-
- <!-- MenuItems for dynamic containers? Have to look into this -->
-
- <!-- Toolbar buttons -->
- <!-- <childrenBlocks itemref="doc:RefreshButton"/> -->
- <!-- Layout children - how does it know where this goes? Does it have to be a tab container?-->
- <childrenBlocks itemref="doc:ZaoBaoChannelViewOld"/>
-
- <!-- Attributes - what are these? -->
- <orientationEnum>Vertical</orientationEnum>
- <eventBoundary>True</eventBoundary>
- <size>600,200</size>
- <minimumSize>400,100</minimumSize>
- </BoxContainer>
-
<!-- ## detail view for RSSItems ## -->
<!-- ContentItem will handle display of the channel title -->
@@ -140,15 +75,25 @@
<!-- URL -->
<ContentItemDetail itsName="LinkArea"
itemClass="osaf.framework.blocks.detail.Detail.DetailSynchronizedLabeledTextAttributeBlock">
- <blockName>LinkArea</blockName>
+ <position>0.3</position>
<selectedItemsAttribute>link</selectedItemsAttribute>
<childrenBlocks itemref="doc:LinkLabel"/>
- <childrenBlocks itemref="doc:LinkEditField"/>
+ <childrenBlocks itemref="doc:LinkAttribute"/>
<stretchFactor>0.0</stretchFactor>
</ContentItemDetail>
- <StaticText itsName="LinkLabel" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
- <blockName>LinkLabel</blockName>
+ <CharacterStyle itsName="LinkStyle">
+ <fontFamily>DefaultUIFont</fontFamily>
+ <fontSize>10</fontSize>
+ <fontStyle>underline</fontStyle>
+ </CharacterStyle>
+
+ <!-- huh, I only seem to be able to apply this to whole ContentItemDetail items -->
+ <ColorStyle itsName="LinkColor">
+ <foregroundColor>0,0,255,255</foregroundColor>
+ </ColorStyle>
+
+ <StaticText itsName="LinkLabel" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttributeLabel">
<title>link</title>
<characterStyle itemref="detail:LabelStyle"/>
<stretchFactor>0.0</stretchFactor>
@@ -157,25 +102,25 @@
<border>0.0, 0.0, 0.0, 5.0</border>
</StaticText>
- <EditText itsName="LinkEditField" itemClass="osaf.framework.blocks.detail.Detail.EditRedirectAttribute">
- <blockName>LinkEditField</blockName>
- <lineStyleEnum>SingleLine</lineStyleEnum>
- <readOnly>True</readOnly>
- <characterStyle itemref="detail:TextStyle"/>
- </EditText>
+ <StaticText itsName="LinkAttribute" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
+ <characterStyle itemref="doc:LinkStyle"/>
+ <!-- <colorStyle itemref="doc:LinkColor"/> -->
+ <stretchFactor>0.0</stretchFactor>
+ <textAlignmentEnum>Left</textAlignmentEnum>
+ <title>linkattribute</title>
+ </StaticText>
<!-- Category -->
<ContentItemDetail itsName="CategoryArea"
itemClass="osaf.framework.blocks.detail.Detail.DetailSynchronizedLabeledTextAttributeBlock">
- <blockName>CategoryArea</blockName>
+ <position>0.2</position>
<selectedItemsAttribute>category</selectedItemsAttribute>
<childrenBlocks itemref="doc:CategoryLabel"/>
- <childrenBlocks itemref="doc:CategoryEditField"/>
+ <childrenBlocks itemref="doc:CategoryAttribute"/>
<stretchFactor>0.0</stretchFactor>
</ContentItemDetail>
- <StaticText itsName="CategoryLabel" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
- <blockName>CategoryLabel</blockName>
+ <StaticText itsName="CategoryLabel" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttributeLabel">
<title>category</title>
<characterStyle itemref="detail:LabelStyle"/>
<stretchFactor>0.0</stretchFactor>
@@ -184,24 +129,23 @@
<border>0.0, 0.0, 0.0, 5.0</border>
</StaticText>
- <EditText itsName="CategoryEditField" itemClass="osaf.framework.blocks.detail.Detail.EditRedirectAttribute">
- <blockName>CategoryEditField</blockName>
- <lineStyleEnum>SingleLine</lineStyleEnum>
- <readOnly>True</readOnly>
- <characterStyle itemref="detail:TextStyle"/>
- </EditText>
+ <StaticText itsName="CategoryAttribute" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
+ <title>category</title>
+ <characterStyle itemref="detail:LabelStyle"/>
+ <stretchFactor>1.0</stretchFactor>
+ <textAlignmentEnum>Left</textAlignmentEnum>
+ </StaticText>
<!-- Author area -->
<ContentItemDetail itsName="AuthorArea" itemClass="osaf.framework.blocks.detail.Detail.DetailSynchronizedLabeledTextAttributeBlock">
- <blockName>AuthorArea</blockName>
+ <position>0.0</position>
<selectedItemsAttribute>author</selectedItemsAttribute>
<childrenBlocks itemref="doc:AuthorLabel"/>
- <childrenBlocks itemref="doc:AuthorEditField"/>
+ <childrenBlocks itemref="doc:AuthorAttribute"/>
<stretchFactor>0.0</stretchFactor>
</ContentItemDetail>
- <StaticText itsName="AuthorLabel" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
- <blockName>AuthorLabel</blockName>
+ <StaticText itsName="AuthorLabel" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttributeLabel">
<title>author</title>
<characterStyle itemref="detail:LabelStyle"/>
<stretchFactor>0.0</stretchFactor>
@@ -210,12 +154,12 @@
<border>0.0, 0.0, 0.0, 5.0</border>
</StaticText>
- <EditText itsName="AuthorEditField" itemClass="osaf.framework.blocks.detail.Detail.EditRedirectAttribute">
- <blockName>AuthorEditField</blockName>
- <lineStyleEnum>SingleLine</lineStyleEnum>
- <readOnly>True</readOnly>
- <characterStyle itemref="detail:TextStyle"/>
- </EditText>
+ <StaticText itsName="AuthorAttribute" itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
+ <title>author</title>
+ <characterStyle itemref="detail:LabelStyle"/>
+ <stretchFactor>0.0</stretchFactor>
+ <textAlignmentEnum>Left</textAlignmentEnum>
+ </StaticText>
Index: chandler/parcels/osaf/views/main/Main.py
diff -u chandler/parcels/osaf/views/main/Main.py:1.116 chandler/parcels/osaf/views/main/Main.py:1.117
--- chandler/parcels/osaf/views/main/Main.py:1.116 Thu Feb 3 11:34:50 2005
+++ chandler/parcels/osaf/views/main/Main.py Thu Feb 3 18:17:32 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.116 $"
-__date__ = "$Date: 2005/02/03 19:34:50 $"
+__version__ = "$Revision: 1.117 $"
+__date__ = "$Date: 2005/02/04 02:17:32 $"
__copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -343,6 +343,20 @@
def onCommitRepositoryEvent(self, event):
# Test menu item
self.RepositoryCommitWithStatus ()
+
+ # temporary until we can add this dynamically
+ def onNewZaoBaoChannelEvent(self, event):
+ url = application.dialogs.Util.promptUser(wx.GetApp().mainFrame, "New Channel", "Enter a URL for the RSS Channel", "http://")
+ if url and url != "":
+ # create the zaobao channel and send it to the sidebar
+ channel = osaf.examples.zaobao.RSSData.NewChannelFromURL(view=self.itsView, url=url, update=True)
+ if channel:
+ print "Adding " + str(channel) + " to sidebar"
+ self.postEventByName ('AddToSidebarWithoutCopying', {'items':[channel]})
+ self.itsView.commit()
+ else:
+ application.dialogs.Util.ok(wx.GetApp().mainFrame, "New Channel Error", "Could not create channel for " +
+ url + "\nCheck the URL and try again.")
def onGenerateCalendarEventItemsEvent(self, event):
GenerateItems.generateCalendarEventItems(self.itsView, 10, 30)
Index: chandler/parcels/osaf/views/content/parcel.xml
diff -u chandler/parcels/osaf/views/content/parcel.xml:1.89 chandler/parcels/osaf/views/content/parcel.xml:1.90
--- chandler/parcels/osaf/views/content/parcel.xml:1.89 Fri Jan 28 15:44:45 2005
+++ chandler/parcels/osaf/views/content/parcel.xml Thu Feb 3 18:17:32 2005
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.89 $ -->
-<!-- $Date: 2005/01/28 23:44:45 $ -->
+<!-- $Revision: 1.90 $ -->
+<!-- $Date: 2005/02/04 02:17:32 $ -->
<!-- Copyright (c) 2004-2005 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -149,6 +149,7 @@
<!-- Calendar Table -->
<Table itsName="CalendarTable">
+ <blockName>FreakinCalendarTable</blockName>
<contents itemref="view:calendarItemCollection"/>
<columnHeadings></columnHeadings>
Index: chandler/parcels/osaf/framework/blocks/detail/Detail.py
diff -u chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.83 chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.84
--- chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.83 Thu Feb 3 11:34:49 2005
+++ chandler/parcels/osaf/framework/blocks/detail/Detail.py Thu Feb 3 18:17:33 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.83 $"
-__date__ = "$Date: 2005/02/03 19:34:49 $"
+__version__ = "$Revision: 1.84 $"
+__date__ = "$Date: 2005/02/04 02:17:33 $"
__copyright__ = "Copyright (c) 2004-2005 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -455,6 +455,17 @@
class StaticRedirectAttribute (StaticTextLabel):
"""
+ Static text label that displays the attribute value
+ """
+ def staticTextLabelValue (self, item):
+ try:
+ theLabel = item.getAttributeValue(GetRedirectAttribute(item, self.whichAttribute()))
+ except AttributeError:
+ theLabel = ""
+ return theLabel
+
+class StaticRedirectAttributeLabel (StaticTextLabel):
+ """
Static Text that displays the name of the selected item's Attribute
"""
def shouldShow (self, item):
@@ -468,9 +479,15 @@
redirectAttr = item.getAttributeAspect (redirectAttr, 'displayName')
return redirectAttr
-# basic class which makes a detail block visible if the given attribute is there
-# and never for contacts
class LabeledTextAttributeBlock (ControlBlocks.ContentItemDetail):
+ """
+ basic class for a block in the detail view typically containing:
+ * a label (e.g. a StaticText with "Title:")
+ * an attribute value (e.g. in an EditText with the value of item.title)
+ it also handles visibility of the block, depending on if the attribute
+ exists on the item or not (with a special case for contacts, which is
+ always hidden)
+ """
def synchronizeItemDetail(self, item):
whichAttr = self.selectedItemsAttribute
contactKind = Contacts.Contact.getKind (self.itsView)
@@ -909,7 +926,7 @@
value = item.ItemWhoString ()
widget.SetValue(value)
-class StaticEmailAddressAttribute (StaticRedirectAttribute):
+class StaticEmailAddressAttribute (StaticRedirectAttributeLabel):
"""
Static Text that displays the name of the selected item's Attribute.
Customized for EmailAddresses
Index: chandler/parcels/osaf/framework/blocks/detail/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.62 chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.63
--- chandler/parcels/osaf/framework/blocks/detail/parcel.xml:1.62 Thu Feb 3 11:34:49 2005
+++ chandler/parcels/osaf/framework/blocks/detail/parcel.xml Thu Feb 3 18:17:33 2005
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.62 $ -->
-<!-- $Date: 2005/02/03 19:34:49 $ -->
+<!-- $Revision: 1.63 $ -->
+<!-- $Date: 2005/02/04 02:17:33 $ -->
<!-- Copyright (c) 2003-2005 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -515,7 +515,7 @@
</ContentItemDetail>
<StaticText itsName="StaticHeadline"
- itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttribute">
+ itemClass="osaf.framework.blocks.detail.Detail.StaticRedirectAttributeLabel">
<blockName value="StaticHeadline"/>
<title>subject</title>
<characterStyle itemref="doc:LabelStyle"/>
More information about the Commits
mailing list