diff --git a/GooCalendar/Event.py b/GooCalendar/Event.py index 2113d633f0e44bdf9fd8be142b7a6550d7badc98_R29vQ2FsZW5kYXIvRXZlbnQucHk=..677c28779ea73822fd62527ee9f60705125cd61e_R29vQ2FsZW5kYXIvRXZlbnQucHk= 100644 --- a/GooCalendar/Event.py +++ b/GooCalendar/Event.py @@ -25,7 +25,9 @@ @property def multidays(self): - return (not self.end or (self.end - self.start).days > 0) + if not self.end: + return False + return (self.end - self.start).days > 0 def __eq__(self, other_event): if not isinstance(other_event, Event): diff --git a/GooCalendar/EventItem.py b/GooCalendar/EventItem.py index 2113d633f0e44bdf9fd8be142b7a6550d7badc98_R29vQ2FsZW5kYXIvRXZlbnRJdGVtLnB5..677c28779ea73822fd62527ee9f60705125cd61e_R29vQ2FsZW5kYXIvRXZlbnRJdGVtLnB5 100644 --- a/GooCalendar/EventItem.py +++ b/GooCalendar/EventItem.py @@ -112,6 +112,7 @@ self.text.set_property('y', self.y) self.text.set_property('text', caption) self.text.set_property('fill_color', the_event_text_color) + self.text.set_property('tooltip', tooltip) # Clip the text. x2, y2 = self.x + self.width, self.y + self.height, @@ -121,6 +122,8 @@ def update_all_day_event(self): self.width = max(self.width, 0) - if self.event.multidays and not self.event.all_day: - starttime = self.event.start.strftime(self.time_format) + startdate = self.event.start.strftime('%x') + starttime = self.event.start.strftime(self.time_format) + if self.event.end: + enddate = self.event.end.strftime('%x') endtime = self.event.end.strftime(self.time_format) @@ -126,3 +129,13 @@ endtime = self.event.end.strftime(self.time_format) - tooltip = '%s - %s %s' % (starttime, endtime, self.event.caption) + + if self.event.all_day: + caption = self.event.caption + if not self.event.end: + tooltip = '%s\n%s' % (startdate, caption) + else: + tooltip = '%s - %s\n%s' % (startdate, enddate, caption) + elif self.event.multidays: + caption = '%s %s' % (starttime, self.event.caption) + tooltip = '%s %s - %s %s\n%s' % (startdate, starttime, enddate, + endtime, self.event.caption) else: @@ -128,6 +141,7 @@ else: - tooltip = self.event.caption - caption = '' if self.no_caption else tooltip + caption = '%s %s' % (starttime, self.event.caption) + tooltip = '%s - %s\n%s' % (starttime, endtime, self.event.caption) + caption = '' if self.no_caption else caption the_event_bg_color = self.event.bg_color self.text.set_property('text', caption) logical_height = self.text.get_natural_extents()[1][3] @@ -161,6 +175,7 @@ self.text.set_property('x', self.x + 2) self.text.set_property('y', self.y) self.text.set_property('fill_color', the_event_text_color) + self.text.set_property('tooltip', tooltip) # Clip the text. x2, y2 = self.x + self.width, self.y + self.height,