manually align todos

This commit is contained in:
samerbam 2023-08-23 10:13:34 -04:00
parent bb2fb54c2e
commit 5323db351c

View File

@ -63,16 +63,31 @@ class ThermalPrinter():
self.p.text("\n\n")
# pass #TODO: add other greetings?
def print_todos(self, todos=[{"time": "1:00pm-2:00pm", "text": "Read a book"}]):
def print_todos(self, todos=[{"time": "1:00pm to 2:00pm", "text": "Read a book"}]):
for x in self._parse_todos(todos):
# print(x)
this_line_width = len(x[0])+len(x[1])
# self.p.charcode("cp437")
self.p.set(align="left")
self.p.text(x[0])
self.p.set(align="right")
self.p.textln(x[1])
self.p.set(align="left")
self.p.text("\n")
if this_line_width < 32:
self.p.text(" "*(32-this_line_width))
else:
# self.p.text(" ")
todo_text_max_len = 32-(len(x[0])+1)
todo_text = textwrap.wrap(x[1], todo_text_max_len)
# t_text = textwrap.wrap()
for t in todo_text:
self.p.text(" "*(len(x[0])+1) )
self.p.text(t + "\n")
# self.p.set(align="right")
# self.p.textln(x[1])
# self.p.set(align="left")
# self.p.text("\n")
def print_sudoku(self):
self.p.close()