Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1469  / 3 Years ago, sat, october 30, 2021, 3:06:20

I'm looking to write a calendar application in python that will interact with gnome-shell-calendar. I've asked around, and I was told that it uses evolution-data-sever


To get its information, I found out that there is a python-evolution python module that allows you to interact with the evolution server. But, that module has now been depreciated. Is-there another way to interact with the sever?


I've also noticed a process called gnome-shell-calendar-server. What's The difference between that and the evolution one?


More From » gnome

 Answers
3

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

[#35272] Monday, November 1, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
izecaptur

Total Points: 113
Total Questions: 102
Total Answers: 114

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
;