-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hey !
I really love the effort you're putting in creating these tools. The widget looks really nice, but it is not that useful.
I use gnome-calendar (I configured the app to open it when I click on the button). gnome-calendar uses the evolution system to provide the information.
It is not well documented, but you can access the events in this way:
import gi
gi.require_version("EDataServer", "1.2")
gi.require_version("ECal", "2.0")
from gi.repository import EDataServer, ECal
from datetime import datetime
registry = EDataServer.SourceRegistry.new_sync(None)
sources = registry.list_sources(EDataServer.SOURCE_EXTENSION_CALENDAR)
now = datetime.now()
for source in sources:
if not source.get_enabled():
continue
print(f"Calendar: {source.get_display_name()}")
client = ECal.Client.connect_sync(source, ECal.ClientSourceType.EVENTS, 1, None)
success, icalstrings = client.get_object_list_as_comps_sync("", None)
if success:
for comp in icalstrings:
summary = comp.get_summary()
dtstart = comp.get_dtstart() # Returns ECalComponentDateTime
if dtstart:
icaltime = dtstart.get_value() # Extract the ICalTime
if icaltime:
event_date = datetime(
icaltime.get_year(),
icaltime.get_month(),
icaltime.get_day(),
icaltime.get_hour(),
icaltime.get_minute(),
)
if event_date > now:
title = summary.get_value() if summary else "(no title)"
print(f" {event_date.strftime('%Y-%m-%d %H:%M')} - {title}")(see here for the generated python docs)
It would be so useful to have them directly display in the calendar !
If I have time, I will contribute with a PR, but I'm not sure I will. If it seems like something valuable, add it ! I really think gnome calendar and ml4w fit nicely together.
Metadata
Metadata
Assignees
Labels
No labels