SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Building Your Own Chandler Parcel

               Ted Leung
   Open Source Applications Foundation




         O’Reilly Open Source Convention
                 August 1 - 5, 2005
Chandler


• Personal Information Manager
• Next release in Fall 2005
   – Focus on Calendar
Outline


• Brief Demo
   – A little calendar functionality
• Three sample extensions:
   – ZaoBao, an RSS reader
   – An Amazon wishlist parcel
   – A Flickr parcel
Demo
Chandler Elements


• Model
  – Items (Content Items)
      • calendar events
      • mail, contacts, tasks
  – Item Collections
• View
  –   Sidebar
  –   Summary View
  –   Detail View
  –   Menus
  –   Toolbar, Status Bar
Parcel Extension Points


• Extend the schema
   – FlickrPhoto
   – Tag
   – PhotoCollection
• UI
   – Menu handler
   – Summary View
   – Detail View
• Create background task
   – Load data into repository
Extending Chandler Schema


• Create a new “Kind”
   – Actually, 2 kinds
   – FlickrPhoto, FlickrPhotoMixin
• Define “Attributes” for this “Kind”
   –   owner
   –   imageURL
   –   tags
   –   datePosted
Chandler’s built in Photo Kind
import osaf.contentmodel.ContentModel as ContentModel

class PhotoMixin(ContentModel.ContentItem):

  schema.kindInfo(displayName=quot;Photo Mixin Kindquot;,
                  displayAttribute=quot;captionquot;)

  caption = schema.One(schema.String, displayName=quot;Captionquot;)
  dateTaken = schema.One(schema.DateTime,
                         displayName=quot;Date Takenquot;)
  data = schema.One(schema.Lob)
  file = schema.One(schema.String)
  exif = schema.Mapping(schema.String, initialValue={})

class Photo(PhotoMixin, Notes.Note):
   schema.kindInfo(displayName = quot;Photoquot;)
Adding a FlickrPhotoMixin Item

class FlickrPhotoMixin(Photos.PhotoMixin):

  schema.kindInfo(displayName=quot;Flickr Photo Mixinquot;,
                  displayAttribute=quot;captionquot;)

  flickrID = schema.One(schema.String,
                        displayName=quot;Flickr IDquot;)
  imageURL = schema.One(schema.URL,
                        displayName=quot;imageURLquot;)
  datePosted = schema.One(schema.DateTime,
                          displayName=quot;Upload Datequot;)
  tags = schema.Sequence(displayName=quot;Tagquot;)
  owner = schema.One(schema.String,
                     displayName=quot;Ownerquot;)
Adding a FlickrPhoto Item

class FlickrPhoto(FlickrPhotoMixin, Notes.Note):
   schema.kindInfo(displayName = quot;Flickr Photoquot;)
Adding Tags

class Tag(ContentItem):

  itemsWithTag =
    schema.Sequence(FlickrPhoto,
                    inverse=FlickrPhoto.tags,
                    displayName=quot;Tagquot;)
Creating a Collection

class FlickrPhotoCollection(ContentModel.ContentItem):

  schema.kindInfo(displayName=quot;Collection of Flickr Photosquot;)

  photos = schema.Sequence(FlickrPhotoMixin,
                           displayName=quot;Flickr Photosquot;)

  username = schema.One(
    schema.String, displayName=quot;Usernamequot;, initialValue=''
  )

  tag = schema.One(
    Tag, otherName=quot;itemsWithTagquot;, displayName=quot;Tagquot;,
    initialValue=None
  )
Creating a Menu Item

<MenuItem itsName=quot;NewFlickrCollectionByTagquot;>
   <blockName>
     NewFlickrCollectionByTagItem
   </blockName>
   <title>New Flickr Collection by Tag</title>
   <event itemref=quot;doc:NewFlickrCollectionByTagEventquot;/>
   <parentBlock itemref=quot;main:NewItemMenuquot;/>
 </MenuItem>
Creating an Event

<BlockEvent itsName=quot;NewFlickrCollectionByTagEventquot;>
   <blockName>NewFlickrCollectionByTag</blockName>

  <dispatchEnum>SendToBlockByReference</dispatchEnum>
  <destinationBlockReference
    itemref=quot;doc:FlickrCollectionControllerItemquot;/>
  <commitAfterDispatch>True</commitAfterDispatch>
</BlockEvent>
Creating an Event Handler
class FlickrCollectionController(Block):

  def onNewFlickrCollectionByTagEvent(self, event):
    CreateCollectionFromTag(self.itsView,
                            Globals.views[0])
Creating an Event Handler
from application.dialogs.Util import promptUser

def CreateCollectionFromTag(repView, cpiaView):
  myPhotoCollection =
    FlickrPhotoCollection(view = repView)
  tagstring =
    promptUser(wx.GetApp().mainFrame, quot;Tagquot;,
               quot;Enter a Flickr Tagquot;, quot;quot;)
  myPhotoCollection.tag = Tag.getTag(repView,
                                     tagstring)
  myPhotoCollection.getCollectionFromFlickr(repView)

  # Add the channel to the sidebar
  cpiaView.postEventByName(
    'AddToSidebarWithoutCopying',
    {'items’ :
     myPhotoCollection.sidebarCollection]})
Creating an Event Handler
def getCollectionFromFlickr(self, repView):
  coll = ItemCollection.ItemCollection(view = repView)
  if self.username:
    …
  elif self.tag:
   flickrPhotos =
      flickr.photos_search(tags=self.tag,per_page=10)
   coll.displayName = self.tag.displayName

  self.sidebarCollection = coll

  for i in flickrPhotos:
    photoItem = getPhotoByFlickrID(repView, i.id)
    if photoItem is None:
      photoItem = FlickrPhoto(photo=i, view=repView,
                              parent=coll)
      coll.add(photoItem)
Behind the scenes: Item Collections




• Explicit list of items (Photo.tags)
• Query against the repository
Summary View
class PhotoMixin(ContentModel.ContentItem):
   …
   about = schema.One(redirectTo = 'caption')
   date = schema.One(redirectTo = 'dateTaken')
   who = schema.One(redirectTo = 'creator')
   displayName = schema.Role(redirectTo=quot;captionquot;)


class FlickrPhotoMixin(Photos.PhotoMixin):
   …
   who = schema.One(redirectTo=quot;ownerquot;)
Detail View
From Photo’s parcel.xml

<detail:DetailTrunkSubtree itsName=quot;PhotoSubtreequot;>

  <!-- this DetailTrunkSubtree is for Photos -->
  <key itemref=quot;photos:PhotoMixinquot;/>

  <!-- define UI Elements -->
  <rootBlocks itemref=quot;photos:PhotoDetailsSpacerquot;/>
  <rootBlocks itemref=quot;photos:PhotoDetailsquot;/>
</detail:DetailTrunkSubtree>
Detail View

From FlickrPhoto’s parcel.xml

<detail:DetailTrunkSubtree>
  <key itemref=quot;flickr:FlickrPhotoquot;/>
  <rootBlocks itemref=quot;doc:AuthorAreaquot;/>
</detail:DetailTrunkSubtree>
Behind the scenes: CPIA


• CPIA: Chandler Presentation Interaction Architecture
• Blocks
   – Sidebar, DetailView, Summary View
   – Menus, Toolbar, StatusBar
• Model/View
   – Block ==> View (Summary View)
   – ContentItem, ItemCollection ==> Mode
• Blocks are also Items
   – Persistent repository Item
   – wxWidgets peer
Getting Items Periodically

<startup:PeriodicTask itsName=quot;FlickrUpdateTaskquot;>
   <invoke>osaf.examples.flickr.UpdateTask</invoke>
   <run_at_startup>True</run_at_startup>
   <interval>00:05:00</interval>
 </startup:PeriodicTask>
Getting new Items
class UpdateTask:
   def __init__(self, item):
     self.view = item.itsView

  def run(self):
    # We need the view for most repository operations
    self.view.refresh()

    # We need the Kind object for PhotoCollection
    for myPhotoCollection in
      PhotoCollection.iterItems(self.view):
      myPhotoCollection.update(self.view)

     # commit the changes to the repository
     self.view.commit()
     return True
Behind the scenes: Twisted


• wxWidgets thread runs
  GUI event loop
• Twisted reactor schedules
  work outside Widgets
  thread
• PeriodicTasks run via
  Twisted reactor
• Communication through
  the repository
Behind the scenes: Parcels


• parcel.xml
   – xml files that sit alongside python modules
• Items are loaded into repository
   – Discovered by queries
   – Linked to well known items
• Repository is primary data store
   – changes not serialized back to parcel.xml
Summary


• Chandler has a model driven architecture
• Extension points
   –   added new data type (Kinds)
   –   added menu
   –   added view customizations
   –   added background task (PeriodicTask)
• Data discovery from repository
   – Queries, references to well known Items
Parcel Futures


• Documentation
   – Tutorial
• Refactoring, modularization
   – Flatten parcel hierarchy
• PythonEggs
• Python for instances
Python Instances
controller = FlickrCollectionController.update(parcel,
  'FlickrCollectionControllerItem')

ownerEvent = BlockEvent.update(parcel,
  'NewFlickrCollectionByOwnerEvent',
  blockName = 'NewFlickrCollectionByOwner',
  dispatchEnum = 'SendToBlockByReference',
  destinationBlockReference = controller,
  commitAfterDispatch = True)

tagEvent = BlockEvent.update(parcel,
  'NewFlickrCollectionByTagEvent',
  blockName = 'NewFlickrCollectionByTag',
  dispatchEnum = 'SendToBlockByReference',
  destinationBlockReference = controller,
  commitAfterDispatch = True)
Get Involved


• PyCon Sprint
   – 2 days, 2 parcels
       • del.icio.us
       • flickr
• dev@osafoundation.org
• http://wiki.osafoundation.org/Projects/ChandlerHome
• irc://irc.osafoundation.org#chandler
OSCON 2005: Build Your Own Chandler Parcel

Contenu connexe

Tendances

Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newsunarmedhorse5807
 
Single Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and RailsSingle Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and RailsPrateek Dayal
 
Business News, Personal Finance and Money News
Business News, Personal Finance and Money NewsBusiness News, Personal Finance and Money News
Business News, Personal Finance and Money Newseminentoomph4388
 
Politics News and U.S. Elections Coverage
Politics News and U.S. Elections CoveragePolitics News and U.S. Elections Coverage
Politics News and U.S. Elections Coveragecoldfascism4997
 
What Would You Do? With John Quinones
What Would You Do? With John QuinonesWhat Would You Do? With John Quinones
What Would You Do? With John Quinonesalertchair8725
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newswaggishwedge3973
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newsmaddeningwareho91
 
Health News & Articles | Healthy Living
Health News & Articles | Healthy LivingHealth News & Articles | Healthy Living
Health News & Articles | Healthy Livingabortivecatcall84
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newsignorantlogic4950
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
International News | World News
International News | World NewsInternational News | World News
International News | World Newscojocarujanosko
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newsenchantingsched84
 
U.S. News | National News
U.S. News | National NewsU.S. News | National News
U.S. News | National Newsalertchair8725
 
Politics News and U.S. Elections Coverage
Politics News and U.S. Elections CoveragePolitics News and U.S. Elections Coverage
Politics News and U.S. Elections Coverageroastedrecluse128
 
JavaScript Testing for Rubyists
JavaScript Testing for RubyistsJavaScript Testing for Rubyists
JavaScript Testing for RubyistsJamie Dyer
 
U.S. News | National News
U.S. News | National NewsU.S. News | National News
U.S. News | National Newscoldpoet326
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newstalloration5719
 

Tendances (19)

Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
Single Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and RailsSingle Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and Rails
 
Business News, Personal Finance and Money News
Business News, Personal Finance and Money NewsBusiness News, Personal Finance and Money News
Business News, Personal Finance and Money News
 
Politics News and U.S. Elections Coverage
Politics News and U.S. Elections CoveragePolitics News and U.S. Elections Coverage
Politics News and U.S. Elections Coverage
 
Spring batch
Spring batchSpring batch
Spring batch
 
What Would You Do? With John Quinones
What Would You Do? With John QuinonesWhat Would You Do? With John Quinones
What Would You Do? With John Quinones
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
Health News & Articles | Healthy Living
Health News & Articles | Healthy LivingHealth News & Articles | Healthy Living
Health News & Articles | Healthy Living
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
International News | World News
International News | World NewsInternational News | World News
International News | World News
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
U.S. News | National News
U.S. News | National NewsU.S. News | National News
U.S. News | National News
 
Politics News and U.S. Elections Coverage
Politics News and U.S. Elections CoveragePolitics News and U.S. Elections Coverage
Politics News and U.S. Elections Coverage
 
U.S. News | National News
U.S. News | National NewsU.S. News | National News
U.S. News | National News
 
JavaScript Testing for Rubyists
JavaScript Testing for RubyistsJavaScript Testing for Rubyists
JavaScript Testing for Rubyists
 
U.S. News | National News
U.S. News | National NewsU.S. News | National News
U.S. News | National News
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 

Similaire à OSCON 2005: Build Your Own Chandler Parcel

MySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLMySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLTed Leung
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSMin Ming Lo
 
Gutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisablesGutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisablesRiad Benguella
 
Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...
Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...
Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...Aaron Saunders
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objectsRobert Bossek
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
Drupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and FlickrDrupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and FlickrBen Shell
 
ITK Tutorial Presentation Slides-948
ITK Tutorial Presentation Slides-948ITK Tutorial Presentation Slides-948
ITK Tutorial Presentation Slides-948Kitware Kitware
 
Introduction to Polymer
Introduction to PolymerIntroduction to Polymer
Introduction to PolymerEgor Miasnikov
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events WebStackAcademy
 
Desbravando Web Components
Desbravando Web ComponentsDesbravando Web Components
Desbravando Web ComponentsMateus Ortiz
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
 
MobileCity:Core Data
MobileCity:Core DataMobileCity:Core Data
MobileCity:Core DataAllan Davis
 

Similaire à OSCON 2005: Build Your Own Chandler Parcel (20)

MySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLMySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQL
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
 
Gutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisablesGutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisables
 
Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...
Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...
Getting Started with Appcelerator Alloy - Cross Platform Mobile Development -...
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
Drupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and FlickrDrupal Recipes: Building Image Galleries with jQuery and Flickr
Drupal Recipes: Building Image Galleries with jQuery and Flickr
 
jQuery
jQueryjQuery
jQuery
 
ITK Tutorial Presentation Slides-948
ITK Tutorial Presentation Slides-948ITK Tutorial Presentation Slides-948
ITK Tutorial Presentation Slides-948
 
Introduction to Polymer
Introduction to PolymerIntroduction to Polymer
Introduction to Polymer
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
Desbravando Web Components
Desbravando Web ComponentsDesbravando Web Components
Desbravando Web Components
 
Jquery
JqueryJquery
Jquery
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
MobileCity:Core Data
MobileCity:Core DataMobileCity:Core Data
MobileCity:Core Data
 
Jquery Fundamentals
Jquery FundamentalsJquery Fundamentals
Jquery Fundamentals
 
实战Ecos
实战Ecos实战Ecos
实战Ecos
 

Plus de Ted Leung

DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 KeynoteTed Leung
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency ConstructsTed Leung
 
Seeding The Cloud
Seeding The CloudSeeding The Cloud
Seeding The CloudTed Leung
 
Programming Languages For The Cloud
Programming Languages For The CloudProgramming Languages For The Cloud
Programming Languages For The CloudTed Leung
 
PyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonPyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonTed Leung
 
Northwest Python Day 2009
Northwest Python Day 2009Northwest Python Day 2009
Northwest Python Day 2009Ted Leung
 
PyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic LanguagesPyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic LanguagesTed Leung
 
OSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community AntipatternsOSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community AntipatternsTed Leung
 
OSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By CommitteeOSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By CommitteeTed Leung
 
Ignite The Web 2007
Ignite The Web 2007Ignite The Web 2007
Ignite The Web 2007Ted Leung
 
ApacheCon US 2007: Open Source Community Antipatterns
ApacheCon US 2007:  Open Source Community AntipatternsApacheCon US 2007:  Open Source Community Antipatterns
ApacheCon US 2007: Open Source Community AntipatternsTed Leung
 
PyCon 2005 PyBlosxom
PyCon 2005 PyBlosxomPyCon 2005 PyBlosxom
PyCon 2005 PyBlosxomTed Leung
 
SeaJUG March 2004 - Groovy
SeaJUG March 2004 - GroovySeaJUG March 2004 - Groovy
SeaJUG March 2004 - GroovyTed Leung
 
OSCON 2004: XML and Apache
OSCON 2004: XML and ApacheOSCON 2004: XML and Apache
OSCON 2004: XML and ApacheTed Leung
 
OSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerOSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerTed Leung
 
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJSeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJTed Leung
 
IQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML SchemaIQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML SchemaTed Leung
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationTed Leung
 
ApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML ParsingApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML ParsingTed Leung
 
SD Forum 1999 XML Lessons Learned
SD Forum 1999 XML Lessons LearnedSD Forum 1999 XML Lessons Learned
SD Forum 1999 XML Lessons LearnedTed Leung
 

Plus de Ted Leung (20)

DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 Keynote
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency Constructs
 
Seeding The Cloud
Seeding The CloudSeeding The Cloud
Seeding The Cloud
 
Programming Languages For The Cloud
Programming Languages For The CloudProgramming Languages For The Cloud
Programming Languages For The Cloud
 
PyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonPyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for Python
 
Northwest Python Day 2009
Northwest Python Day 2009Northwest Python Day 2009
Northwest Python Day 2009
 
PyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic LanguagesPyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic Languages
 
OSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community AntipatternsOSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community Antipatterns
 
OSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By CommitteeOSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By Committee
 
Ignite The Web 2007
Ignite The Web 2007Ignite The Web 2007
Ignite The Web 2007
 
ApacheCon US 2007: Open Source Community Antipatterns
ApacheCon US 2007:  Open Source Community AntipatternsApacheCon US 2007:  Open Source Community Antipatterns
ApacheCon US 2007: Open Source Community Antipatterns
 
PyCon 2005 PyBlosxom
PyCon 2005 PyBlosxomPyCon 2005 PyBlosxom
PyCon 2005 PyBlosxom
 
SeaJUG March 2004 - Groovy
SeaJUG March 2004 - GroovySeaJUG March 2004 - Groovy
SeaJUG March 2004 - Groovy
 
OSCON 2004: XML and Apache
OSCON 2004: XML and ApacheOSCON 2004: XML and Apache
OSCON 2004: XML and Apache
 
OSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerOSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of Chandler
 
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJSeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
 
IQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML SchemaIQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML Schema
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
 
ApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML ParsingApacheCon 2000 Everything you ever wanted to know about XML Parsing
ApacheCon 2000 Everything you ever wanted to know about XML Parsing
 
SD Forum 1999 XML Lessons Learned
SD Forum 1999 XML Lessons LearnedSD Forum 1999 XML Lessons Learned
SD Forum 1999 XML Lessons Learned
 

Dernier

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Dernier (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

OSCON 2005: Build Your Own Chandler Parcel

  • 1.
  • 2. Building Your Own Chandler Parcel Ted Leung Open Source Applications Foundation O’Reilly Open Source Convention August 1 - 5, 2005
  • 3. Chandler • Personal Information Manager • Next release in Fall 2005 – Focus on Calendar
  • 4. Outline • Brief Demo – A little calendar functionality • Three sample extensions: – ZaoBao, an RSS reader – An Amazon wishlist parcel – A Flickr parcel
  • 6. Chandler Elements • Model – Items (Content Items) • calendar events • mail, contacts, tasks – Item Collections • View – Sidebar – Summary View – Detail View – Menus – Toolbar, Status Bar
  • 7. Parcel Extension Points • Extend the schema – FlickrPhoto – Tag – PhotoCollection • UI – Menu handler – Summary View – Detail View • Create background task – Load data into repository
  • 8. Extending Chandler Schema • Create a new “Kind” – Actually, 2 kinds – FlickrPhoto, FlickrPhotoMixin • Define “Attributes” for this “Kind” – owner – imageURL – tags – datePosted
  • 9. Chandler’s built in Photo Kind import osaf.contentmodel.ContentModel as ContentModel class PhotoMixin(ContentModel.ContentItem): schema.kindInfo(displayName=quot;Photo Mixin Kindquot;, displayAttribute=quot;captionquot;) caption = schema.One(schema.String, displayName=quot;Captionquot;) dateTaken = schema.One(schema.DateTime, displayName=quot;Date Takenquot;) data = schema.One(schema.Lob) file = schema.One(schema.String) exif = schema.Mapping(schema.String, initialValue={}) class Photo(PhotoMixin, Notes.Note): schema.kindInfo(displayName = quot;Photoquot;)
  • 10. Adding a FlickrPhotoMixin Item class FlickrPhotoMixin(Photos.PhotoMixin): schema.kindInfo(displayName=quot;Flickr Photo Mixinquot;, displayAttribute=quot;captionquot;) flickrID = schema.One(schema.String, displayName=quot;Flickr IDquot;) imageURL = schema.One(schema.URL, displayName=quot;imageURLquot;) datePosted = schema.One(schema.DateTime, displayName=quot;Upload Datequot;) tags = schema.Sequence(displayName=quot;Tagquot;) owner = schema.One(schema.String, displayName=quot;Ownerquot;)
  • 11. Adding a FlickrPhoto Item class FlickrPhoto(FlickrPhotoMixin, Notes.Note): schema.kindInfo(displayName = quot;Flickr Photoquot;)
  • 12. Adding Tags class Tag(ContentItem): itemsWithTag = schema.Sequence(FlickrPhoto, inverse=FlickrPhoto.tags, displayName=quot;Tagquot;)
  • 13. Creating a Collection class FlickrPhotoCollection(ContentModel.ContentItem): schema.kindInfo(displayName=quot;Collection of Flickr Photosquot;) photos = schema.Sequence(FlickrPhotoMixin, displayName=quot;Flickr Photosquot;) username = schema.One( schema.String, displayName=quot;Usernamequot;, initialValue='' ) tag = schema.One( Tag, otherName=quot;itemsWithTagquot;, displayName=quot;Tagquot;, initialValue=None )
  • 14. Creating a Menu Item <MenuItem itsName=quot;NewFlickrCollectionByTagquot;> <blockName> NewFlickrCollectionByTagItem </blockName> <title>New Flickr Collection by Tag</title> <event itemref=quot;doc:NewFlickrCollectionByTagEventquot;/> <parentBlock itemref=quot;main:NewItemMenuquot;/> </MenuItem>
  • 15. Creating an Event <BlockEvent itsName=quot;NewFlickrCollectionByTagEventquot;> <blockName>NewFlickrCollectionByTag</blockName> <dispatchEnum>SendToBlockByReference</dispatchEnum> <destinationBlockReference itemref=quot;doc:FlickrCollectionControllerItemquot;/> <commitAfterDispatch>True</commitAfterDispatch> </BlockEvent>
  • 16. Creating an Event Handler class FlickrCollectionController(Block): def onNewFlickrCollectionByTagEvent(self, event): CreateCollectionFromTag(self.itsView, Globals.views[0])
  • 17. Creating an Event Handler from application.dialogs.Util import promptUser def CreateCollectionFromTag(repView, cpiaView): myPhotoCollection = FlickrPhotoCollection(view = repView) tagstring = promptUser(wx.GetApp().mainFrame, quot;Tagquot;, quot;Enter a Flickr Tagquot;, quot;quot;) myPhotoCollection.tag = Tag.getTag(repView, tagstring) myPhotoCollection.getCollectionFromFlickr(repView) # Add the channel to the sidebar cpiaView.postEventByName( 'AddToSidebarWithoutCopying', {'items’ : myPhotoCollection.sidebarCollection]})
  • 18. Creating an Event Handler def getCollectionFromFlickr(self, repView): coll = ItemCollection.ItemCollection(view = repView) if self.username: … elif self.tag: flickrPhotos = flickr.photos_search(tags=self.tag,per_page=10) coll.displayName = self.tag.displayName self.sidebarCollection = coll for i in flickrPhotos: photoItem = getPhotoByFlickrID(repView, i.id) if photoItem is None: photoItem = FlickrPhoto(photo=i, view=repView, parent=coll) coll.add(photoItem)
  • 19. Behind the scenes: Item Collections • Explicit list of items (Photo.tags) • Query against the repository
  • 20. Summary View class PhotoMixin(ContentModel.ContentItem): … about = schema.One(redirectTo = 'caption') date = schema.One(redirectTo = 'dateTaken') who = schema.One(redirectTo = 'creator') displayName = schema.Role(redirectTo=quot;captionquot;) class FlickrPhotoMixin(Photos.PhotoMixin): … who = schema.One(redirectTo=quot;ownerquot;)
  • 21. Detail View From Photo’s parcel.xml <detail:DetailTrunkSubtree itsName=quot;PhotoSubtreequot;> <!-- this DetailTrunkSubtree is for Photos --> <key itemref=quot;photos:PhotoMixinquot;/> <!-- define UI Elements --> <rootBlocks itemref=quot;photos:PhotoDetailsSpacerquot;/> <rootBlocks itemref=quot;photos:PhotoDetailsquot;/> </detail:DetailTrunkSubtree>
  • 22. Detail View From FlickrPhoto’s parcel.xml <detail:DetailTrunkSubtree> <key itemref=quot;flickr:FlickrPhotoquot;/> <rootBlocks itemref=quot;doc:AuthorAreaquot;/> </detail:DetailTrunkSubtree>
  • 23. Behind the scenes: CPIA • CPIA: Chandler Presentation Interaction Architecture • Blocks – Sidebar, DetailView, Summary View – Menus, Toolbar, StatusBar • Model/View – Block ==> View (Summary View) – ContentItem, ItemCollection ==> Mode • Blocks are also Items – Persistent repository Item – wxWidgets peer
  • 24. Getting Items Periodically <startup:PeriodicTask itsName=quot;FlickrUpdateTaskquot;> <invoke>osaf.examples.flickr.UpdateTask</invoke> <run_at_startup>True</run_at_startup> <interval>00:05:00</interval> </startup:PeriodicTask>
  • 25. Getting new Items class UpdateTask: def __init__(self, item): self.view = item.itsView def run(self): # We need the view for most repository operations self.view.refresh() # We need the Kind object for PhotoCollection for myPhotoCollection in PhotoCollection.iterItems(self.view): myPhotoCollection.update(self.view) # commit the changes to the repository self.view.commit() return True
  • 26. Behind the scenes: Twisted • wxWidgets thread runs GUI event loop • Twisted reactor schedules work outside Widgets thread • PeriodicTasks run via Twisted reactor • Communication through the repository
  • 27. Behind the scenes: Parcels • parcel.xml – xml files that sit alongside python modules • Items are loaded into repository – Discovered by queries – Linked to well known items • Repository is primary data store – changes not serialized back to parcel.xml
  • 28. Summary • Chandler has a model driven architecture • Extension points – added new data type (Kinds) – added menu – added view customizations – added background task (PeriodicTask) • Data discovery from repository – Queries, references to well known Items
  • 29. Parcel Futures • Documentation – Tutorial • Refactoring, modularization – Flatten parcel hierarchy • PythonEggs • Python for instances
  • 30. Python Instances controller = FlickrCollectionController.update(parcel, 'FlickrCollectionControllerItem') ownerEvent = BlockEvent.update(parcel, 'NewFlickrCollectionByOwnerEvent', blockName = 'NewFlickrCollectionByOwner', dispatchEnum = 'SendToBlockByReference', destinationBlockReference = controller, commitAfterDispatch = True) tagEvent = BlockEvent.update(parcel, 'NewFlickrCollectionByTagEvent', blockName = 'NewFlickrCollectionByTag', dispatchEnum = 'SendToBlockByReference', destinationBlockReference = controller, commitAfterDispatch = True)
  • 31. Get Involved • PyCon Sprint – 2 days, 2 parcels • del.icio.us • flickr • dev@osafoundation.org • http://wiki.osafoundation.org/Projects/ChandlerHome • irc://irc.osafoundation.org#chandler