From e15cd419f5951065b8ca73e056b0b9ed83a43c75 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 29 Nov 2020 00:57:51 +0100 Subject: [PATCH] more tweaks to deal with small printer profiles --- screenless/bureau/bureau.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 0f19da5..266a54a 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -98,7 +98,8 @@ class LogPrinter(logging.Handler): prn.set() msg = self.format(record) #text = textwrap.fill(msg, width=self.printer["textwidth"]) - splitter_regex = r'.{1,' + str(self.printer["textwidth"]) + '}(?:\s+|$)' + cols = self.printer["profile"].get_columns("a") + splitter_regex = r'.{1,' + str(cols) + '}(?:\s+|$)' out_text = "\r\n".join(line.strip() for line in re.findall(splitter_regex, msg)) out_text += "\r\n" * 4 @@ -468,8 +469,8 @@ class Bureau(object): """ prn = self._get_small_printer() prn.set() - - splitter_regex = r'.{1,' + str(self.smprint["textwidth"]) + '}(?:\s+|$)' + cols = self.smprint["profile"].get_columns("a") + splitter_regex = r'.{1,' + str(cols) + '}(?:\s+|$)' out_text = "\r\n".join(line.strip() for line in re.findall(splitter_regex, text))