add_wwdc_to_calendar.py :  » Development » PyObjC » trunk » pyobjc » pyobjc-framework-CalendarStore » Examples » Scripts » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » PyObjC 
PyObjC » trunk » pyobjc » pyobjc framework CalendarStore » Examples » Scripts » add_wwdc_to_calendar.py
"""
Adds WWDC 2007 to the 'Work' calendar
"""
from CalendarStore import *
import textwrap

store = CalCalendarStore.defaultCalendarStore()
for cal in store.calendars():
    if cal._.title == u"Work":
        event = CalEvent.event()
        event._.calendar = cal
        event._.title = "WWDC 2009"
        event._.notes = textwrap.dedent('''\
                This June, the center of the Mac universe will be at Moscone 
                West in downtown San Francisco, as developers and IT 
                professionals from aroundtheglobecometogetherthe import 
                Apple Worldwide Developers Conference. 
                
                Don't miss this opportunity to connect with Apple engineers, 
                get a firsthand look at the latest technology, and spend a 
                week getting the kind of inspiration you won't find anywhere 
                else.
                ''')
        event._.url = NSURL.URLWithString_('http://www.apple.com/wwdc/')
        event._.location = "Moscone West, San Francisco, CA, USA"
        event._.isAllDay = True
        start = NSDate.dateWithString_("2009-06-8 00:00:00 +0600")
        stop = NSDate.dateWithString_("2009-06-12 23:59:59 +0600")
        event._.startDate = start
        event._.endDate = stop
        res, err = store.saveEvent_span_error_(event, 0, None)
        if not res:
            print "Adding WWDC failed", err.localizedDescription()
        break


else:
    print "Cannot find the right calendar"
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.