Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

1) I'm looking to write a calendar application in python that will interact with Gnom-shell-calendar. I've asked around, and I was told that the Gnome-shell calendar uses

evolution-data-sever 

do get its informaion. I looked around and saw that there is a python module

python-evolution 

that allows you to interact with the evolution server. That module has now been depreciated. Is There another way to interact with the sever.

2) I've also seen a process called

Gnome-shell-calendar-server

Whats The difference between that and the evolution one?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Evolution Data Server 3.6 can be accessed with Python using gobject introspection. For this, gir1.2-edataserver-1.2 and gir1-2-ecalendar-1.2 also need to be installed.

For example, the following script will list all the events in all calendars in evolution-data-server.

#! /usr/bin/python
# -*- coding: utf-8 -*-

from gi.repository import ECalendar
from gi.repository import EDataServer

# Open a registry and get a list of all the calendars in EDS
registry = EDataServer.SourceRegistry.new_sync(None)
sources = EDataServer.SourceRegistry.list_sources(registry, EDataServer.SOURCE_EXTENSION_CALENDAR)

# Open each calendar containing events and get a list of all objects in them
for source in sources:
    client = ECalendar.CalClient.new(source, ECalendar.CalSourceType.EVENT)
    client.open_sync(False, None)

    # ret is true or false depending if events are found or not
    # values is a list of events
    ret, values = client.get_object_list_as_comps_sync("#t", None)
    if ret:
        for value in values:
            event = value.get_as_string()
            print event
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.