Commits

Michael Shepanski  committed 02b88be

Better calendar bullet fix

  • Participants
  • Parent commits 2605034

Comments (0)

Files changed (1)

File pkmeter/meters/googlecalendar.py

 #! /usr/bin/python
 # -*- coding: utf-8 -*-
-import datetime, HTMLParser, optparse, shutil, codecs, sys
+import datetime, HTMLParser, optparse, codecs, sys
 from pkmeter.meters.basemeter import BaseMeter
 from pkmeter import utils
 from pkmeter.utils import settings
 
-BULLETIMG = "%s/googlecalendar-bullet-%s.cache"
-
 
 class GoogleCalendar(BaseMeter):
 
     def add_events(self):
         for event in self.events:
             self.numevents += 1
-            imgpath = self.copy_img(event, event['color'], self.numevents)
+            imgpath = "%s/bullets/bullet_%s.png" % (settings.IMGPATH, event["color"])
             voffset = self.ypos + 31 + ((self.numevents - 1) * 11)
             title = "${goto 20}%s" % utils.truncate(event["title"], 25)
             timestr = self.event_time(event['date'])
-            self.rclines.append("${image %s -p 0,%s -s 16x16}${voffset -11}" % (imgpath, voffset))
+            self.execlines.append("${image %s -p 0,%s -s 16x16}${voffset -11}" % (imgpath, voffset))
             self.add_row(title, timestr, execp=True)
             if self.numevents >= settings.GOOGLE_CALENDAR_NUMEVENTS: break
 
         time = time.replace(":00", "").replace("12am", "All Day").lstrip("0")
         return "%s, %s" % (day, time)
 
-    def copy_img(self, event, color, i):
-        shareimg = "%s/bullets/bullet_%s.png" % (settings.IMGPATH, color)
-        cacheimg = "%s/googlecalendar-bullet-%s.cache" % (settings.CACHEDIR, i)
-        shutil.copyfile(shareimg, cacheimg)
-        return cacheimg
-
-
 
 if __name__ == '__main__':
     sys.stdout = codecs.getwriter('UTF-8')(sys.stdout)