File: goocal.py

package info (click to toggle)
kopanocore 8.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 15,400 kB
  • sloc: cpp: 175,422; python: 24,623; perl: 7,319; php: 6,056; sh: 2,172; makefile: 1,294; xml: 45; ansic: 1
file content (30 lines) | stat: -rwxr-xr-x 877 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python3
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2015 Zarafa and its licensors

# display calendar occurrences in familiar calendar widget (slow as we don't filter on range yet)

# usage: ./goocal.py username

import pygtk
import gtk
import datetime
import sys
import goocalendar
import kopano

class ZCalendar:
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        event_store = goocalendar.EventStore()
        calendar = goocalendar.Calendar(event_store)
        for occurrence in kopano.User(sys.argv[1]).calendar.occurrences():
            event = goocalendar.Event(caption=occurrence.subject, start=occurrence.start, end=occurrence.end)
            event_store.add(event)
        calendar.show()
        self.window.add(calendar)
        self.window.show()

if __name__ == "__main__":
    ZCalendar()
    gtk.main()