more tweaks to deal with small printer profiles

workspace
Brendan Howell 4 years ago
parent 0ad4c76256
commit e15cd419f5

@ -98,7 +98,8 @@ class LogPrinter(logging.Handler):
prn.set() prn.set()
msg = self.format(record) msg = self.format(record)
#text = textwrap.fill(msg, width=self.printer["textwidth"]) #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 out_text = "\r\n".join(line.strip() for line in
re.findall(splitter_regex, msg)) re.findall(splitter_regex, msg))
out_text += "\r\n" * 4 out_text += "\r\n" * 4
@ -468,8 +469,8 @@ class Bureau(object):
""" """
prn = self._get_small_printer() prn = self._get_small_printer()
prn.set() prn.set()
cols = self.smprint["profile"].get_columns("a")
splitter_regex = r'.{1,' + str(self.smprint["textwidth"]) + '}(?:\s+|$)' splitter_regex = r'.{1,' + str(cols) + '}(?:\s+|$)'
out_text = "\r\n".join(line.strip() for line in out_text = "\r\n".join(line.strip() for line in
re.findall(splitter_regex, text)) re.findall(splitter_regex, text))

Loading…
Cancel
Save