fix calendar date alignment and page counting
This commit is contained in:
parent
ef0e7e8826
commit
7a6fe498ca
1 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue