Skip to content

Commit

Permalink
Merge pull request #249 from karlicoss/agenda_now_marker
Browse files Browse the repository at this point in the history
Support for color_now_marker in agenda
  • Loading branch information
tresni committed Jul 29, 2016
2 parents ce13806 + 275ae4c commit 733f272
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions gcalcli
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,10 @@ class gcalcli:
else:
return "(No title)"

def _IsAllDay(self, event):
return event['s'].hour == 0 and event['s'].minute == 0 and \
event['e'].hour == 0 and event['e'].minute == 0

def _GetWeekEventStrings(self, cmd, curMonth,
startDateTime, endDateTime, eventList):

Expand All @@ -819,11 +823,7 @@ class gcalcli:

forceEventColorAsMarker = False

if event['s'].hour == 0 and event['s'].minute == 0 and \
event['e'].hour == 0 and event['e'].minute == 0:
allDay = True
else:
allDay = False
allDay = self._IsAllDay(event)

if not nowMarkerPrinted:
if (DaysSinceEpoch(self.now) <
Expand Down Expand Up @@ -1233,15 +1233,17 @@ class gcalcli:
prefix = indent

PrintMsg(self.dateColor, prefix)
if event['s'].hour == 0 and event['s'].minute == 0 and \
event['e'].hour == 0 and event['e'].minute == 0:

happeningNow = event['s'] <= self.now <= event['e']
allDay = self._IsAllDay(event)
eventColor = self.nowMarkerColor if happeningNow and not allDay else self._CalendarColor(event['gcalcli_cal'])

if allDay:
fmt = ' ' + timeFormat + ' %s\n'
PrintMsg(self._CalendarColor(event['gcalcli_cal']), fmt %
('', self._ValidTitle(event).strip()))
PrintMsg(eventColor, fmt % ('', self._ValidTitle(event).strip()))
else:
fmt = ' ' + timeFormat + ' %s\n'
PrintMsg(self._CalendarColor(event['gcalcli_cal']), fmt %
(stringToUnicode(tmpTimeStr), self._ValidTitle(event).strip()))
PrintMsg(eventColor, fmt % (stringToUnicode(tmpTimeStr), self._ValidTitle(event).strip()))

if self.detailCalendar:
xstr = "%s Calendar: %s\n" % (
Expand Down

0 comments on commit 733f272

Please sign in to comment.