diff --git a/buba/animations/icalevents.py b/buba/animations/icalevents.py index ec0ba20..710c9b1 100644 --- a/buba/animations/icalevents.py +++ b/buba/animations/icalevents.py @@ -30,7 +30,7 @@ class IcalEvents(BubaAnimation): sleep(600) @staticmethod - def ellipsis(text, max=28): + def ellipsis(text, max=25): if len(text) > max: text = text[:max - 3] + "..." return text @@ -39,7 +39,8 @@ class IcalEvents(BubaAnimation): for (page, events) in enumerate(self.chunk(self.events, 3)): if len(self.events) > 3: self.buba.text(page=0, row=0, col_start=0, col_end=119, - text=f"{self.title} ({page + 1}/{int(len(self.events) / 3)})", align=BubaCmd.ALIGN_LEFT) + text=f"{self.title} ({page + 1}/{int((len(self.events) / 3) + (len(self.events) % 3 > 0))})", + align=BubaCmd.ALIGN_LEFT) else: self.buba.text(page=0, row=0, col_start=0, col_end=119, text=self.title, align=BubaCmd.ALIGN_LEFT) for (i, event) in enumerate(events): @@ -47,7 +48,6 @@ class IcalEvents(BubaAnimation): when = event.start.strftime("%H:%M") else: when = event.start.strftime("%d.%m.") - self.buba.text(page=0, row=i + 1, col_start=0, col_end=103, text=self.ellipsis(event.summary)) - self.buba.text(page=0, row=i + 1, col_start=104, col_end=119, - text=when, align=BubaCmd.ALIGN_RIGHT) + self.buba.text(page=0, row=i + 1, col_start=0, col_end=100, text=self.ellipsis(event.summary)) + self.buba.text(page=0, row=i + 1, col_start=101, col_end=119, text=when, align=BubaCmd.ALIGN_RIGHT) sleep(10)