~mrooney/awn-extras/bugfix.359668

« back to all changes in this revision

Viewing changes to src/calendar/evocal.py

  • Committer: Mark Lee
  • Date: 2009-03-30 21:35:22 UTC
  • Revision ID: bzr@lazymalevolence.com-20090330213522-r4ejer9y0ps95m1k
Calendar: PEP8 (and to a lesser extent, pylint) cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#
4
4
# Copyright (c) 2007 Mike (mosburger) Desjardins <desjardinsmike@gmail.com>
5
5
#
6
 
# This is an implementation of the google plugin for a calendar applet for 
 
6
# This is an implementation of the google plugin for a calendar applet for
7
7
# Avant Window Navigator.
8
8
#
9
9
# This library is free software; you can redistribute it and/or
21
21
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22
22
# Boston, MA 02111-1307, USA.
23
23
#
24
 
import sys, os
25
 
from StringIO import StringIO
26
 
import datetime
27
 
import time
 
24
import os
28
25
import subprocess
29
 
import calendarprefs
30
 
import fileinput
31
 
import re
32
 
import string
33
26
import icscal
34
27
 
 
28
 
35
29
class EvoCal:
36
30
 
37
 
        requires_login = False
38
 
 
39
 
        def __init__(self, applet):
40
 
                self.applet = applet
41
 
                
42
 
        def get_appointments(self, day, url):
43
 
                filelist = []
44
 
                cmd = 'find ~/.evolution/calendar/local/* -name "*.ics" -print' # Assumes UNIX.
45
 
                for file in os.popen(cmd).readlines():     # run find command
46
 
                        name = file[:-1]                       # strip '\n'
47
 
                        filelist.append(name)
48
 
                calendar = icscal.IcsCal(self.applet,filelist)
49
 
                return calendar.get_appointments(day,url)
50
 
                        
51
 
        def open_integrated_calendar(self, when, url):
52
 
                dat = "%02d%02d%02d" % (when[0], (when[1]+1), when[2])
53
 
                subprocess.Popen('evolution calendar:///?startdate='+dat+'T120000', shell=True)
54
 
                return
55
 
 
 
31
    requires_login = False
 
32
 
 
33
    def __init__(self, applet):
 
34
        self.applet = applet
 
35
 
 
36
    def get_appointments(self, day, url):
 
37
        filelist = []
 
38
        # Assumes UNIX.
 
39
        cmd = 'find ~/.evolution/calendar/local/* -name "*.ics" -print'
 
40
        for file in os.popen(cmd).readlines():     # run find command
 
41
            name = file[:-1]                       # strip '\n'
 
42
            filelist.append(name)
 
43
        calendar = icscal.IcsCal(self.applet, filelist)
 
44
        return calendar.get_appointments(day, url)
 
45
 
 
46
    def open_integrated_calendar(self, when, url):
 
47
        dat = "%02d%02d%02d" % (when[0], (when[1] + 1), when[2])
 
48
        subprocess.Popen('evolution calendar:///?startdate=%sT120000' % dat,
 
49
                         shell=True)
 
50
        return