示例#1
0
def get_eds_tasks():
    try:
        sources = ecal.list_task_sources()
        tasks = []
        if not sources:
            # BUG - http://bugzilla.gnome.org/show_bug.cgi?id=546825
            sources = [('default', 'default')]

        for source in sources:
            category = source[0]

            data = ecal.open_calendar_source(source[1],
                                             ecal.CAL_SOURCE_TYPE_TODO)
            if data:
                for task in data.get_all_objects():
                    if task.get_status() in [
                            ecal.ICAL_STATUS_NONE, ecal.ICAL_STATUS_INPROCESS
                    ]:
                        tasks.append({
                            'name': task.get_summary(),
                            'category': category
                        })
        return tasks
    except Exception, e:
        logging.warn(e)
        return []
示例#2
0
def get_eds_tasks():
    try:
        sources = ecal.list_task_sources()
        tasks = []
        if not sources:
            # BUG - http://bugzilla.gnome.org/show_bug.cgi?id=546825
            sources = [('default', 'default')]

        for source in sources:
            category = source[0]

            data = ecal.open_calendar_source(source[1], ecal.CAL_SOURCE_TYPE_TODO)
            if data:
                for task in data.get_all_objects():
                    if task.get_status() in [ecal.ICAL_STATUS_NONE, ecal.ICAL_STATUS_INPROCESS]:
                        tasks.append({'name': task.get_summary(), 'category': category})
        return tasks
    except Exception, e:
        logger.warn(e)
        return []
from evolution import ecal
cal = ecal.open_calendar_source('file:///home/john/.evolution/calendar/local/system',ecal.CAL_SOURCE_TYPE_EVENT)
c = cal.get_all_objects()[0]

print c.get_as_string()
print cal.get_object_as_string(c)