From e0ae6b729c441c2e6b0375979daf7af1f77dbd78 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 22 Nov 2020 20:21:33 +0100 Subject: [PATCH] nicer linewrap algo for the small printer --- screenless/bureau/bureau.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index e550f94..ad31d2a 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -94,9 +94,9 @@ class LogPrinter(logging.Handler): out_ep=self.printer["outep"]) msg = self.format(record) #text = textwrap.fill(msg, width=self.printer["textwidth"]) - spliter_regex = r'.{1,' + str(self.printer["textwidth"]) + '}(?:\s+|$)' + splitter_regex = r'.{1,' + str(self.printer["textwidth"]) + '}(?:\s+|$)' out_text = "\r\n".join(line.strip() for line in - re.findall(spliter_regex, msg)) + re.findall(splitter_regex, msg)) out_text += "\r\n" * 4 prn.text(out_text) prn.cut() @@ -446,7 +446,7 @@ class Bureau(object): """ prn = self._get_small_printer() - spliter_regex = r'.{1,' + str(self.smprint["textwidth"]) + '}(?:\s+|$)' + splitter_regex = r'.{1,' + str(self.smprint["textwidth"]) + '}(?:\s+|$)' out_text = "\r\n".join(line.strip() for line in re.findall(splitter_regex, text))