0
|
1 |
# Copyright (c) 2008 Nokia Corporation
|
|
2 |
#
|
|
3 |
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
# you may not use this file except in compliance with the License.
|
|
5 |
# You may obtain a copy of the License at
|
|
6 |
#
|
|
7 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
#
|
|
9 |
# Unless required by applicable law or agreed to in writing, software
|
|
10 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
# See the License for the specific language governing permissions and
|
|
13 |
# limitations under the License.
|
|
14 |
|
|
15 |
import time, calendar
|
|
16 |
|
|
17 |
now = time.time()
|
|
18 |
cal = calendar.open()
|
|
19 |
|
|
20 |
|
|
21 |
# add new appointment
|
|
22 |
a = cal.add_appointment()
|
|
23 |
a.content = 'urgent meeting'
|
|
24 |
a.description = 'this is the description'
|
|
25 |
a.set_time(now+3600, now+7200) # start and end time
|
|
26 |
a.commit()
|
|
27 |
print 'Calendar added'
|
|
28 |
print '---------------------------------'
|
|
29 |
todaytime = time.mktime((2008,7,14,0,0,0,0,0,0))
|
|
30 |
daily_instances = cal.daily_instances(todaytime)
|
|
31 |
print "daily instances:" + str(daily_instances)
|
|
32 |
|
|
33 |
for entry_id in cal:
|
|
34 |
ent=cal[entry_id]
|
|
35 |
|
|
36 |
print 'id:%i'%ent.id
|
|
37 |
for entry in daily_instances:
|
|
38 |
if entry["id"] == ent.id:
|
|
39 |
print 'content:%s'%ent.content
|
|
40 |
print 'description:%s'%ent.description
|
|
41 |
print 'originating:%d'%ent.originating
|
|
42 |
print 'location:%s'%ent.location
|
|
43 |
print 'start_time:%s'%time.ctime(ent.start_time)
|
|
44 |
print 'end_time:%s'%time.ctime(ent.end_time)
|
|
45 |
print 'repeat:'
|
|
46 |
print ent.get_repeat()
|
|
47 |
print '--------' |