SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

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