From a0f581ff374c9c034353b400688beb1668841fd5 Mon Sep 17 00:00:00 2001 From: samerbam Date: Wed, 23 Aug 2023 12:37:28 -0400 Subject: [PATCH] barebones todo print --- application/thermal_print.py | 50 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/application/thermal_print.py b/application/thermal_print.py index 23a8716..c41e99b 100644 --- a/application/thermal_print.py +++ b/application/thermal_print.py @@ -67,40 +67,44 @@ class ThermalPrinter(): self.p.set(align="left") for x in self._parse_todos(todos): # print(x) - this_line_width = len(x[0])+len(x[1]) + # 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.charcode("CP437") + # # self.p.set(align="left") + # self.p.text(x[0]) output = [] if this_line_width < 32: output.append( (" "*(32-this_line_width))+x[1] ) - # for s in range((32-this_line_width)): - # self.p.text(" ") - # 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 o in output: + self.p.text(o) + + # # for s in range((32-this_line_width)): + # # self.p.text(" ") + # # 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() - output.append(" " + todo_text[0]) + # output.append(" " + todo_text[0]) - for t in todo_text[1:]: - # self.p.text("" + " "*(len(x[0])+1) ) - # for s in range((len(x[0])+1)): - # self.p.text(" ") + # for t in todo_text[1:]: + # # self.p.text("" + " "*(len(x[0])+1) ) + # # for s in range((len(x[0])+1)): + # # self.p.text(" ") - output.append( (" "*(32-(len(x[0])+1)))+t ) + # output.append( (" "*(32-(len(x[0])+1)))+t ) - # self.p.text(t + "\n") + # # self.p.text(t + "\n") - print(output) - for l in output: - print(l) - self.p.text(l) + # print(output) + # for l in output: + # print(l) + # self.p.text(l) self.p.set(align="left") # self.p.set(align="right")