From 34db8754c8e57f76e084aeba01e42c870fb9adf1 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Wed, 6 Apr 2022 12:20:02 +0200 Subject: [PATCH] add network receipt printer support --- screenless/bureau/bureau.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 3b2962f..4b59487 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -214,6 +214,9 @@ class Bureau(object): try: printcfg.read("printers.cfg") self.smprint = {} + if "ipaddr" in printcfg["smallprinter"]: + self.smprint["ipaddr"] = printcfg["smallprinter"]["ipaddr"] + for hexkey in ["vendorid", "productid", "inep", "outep"]: val = printcfg["smallprinter"][hexkey] if val == "": @@ -426,7 +429,9 @@ class Bureau(object): """ self._sm_print_lockfile = open("small_printer_lock", "w") fcntl.lockf(self._sm_print_lockfile, fcntl.LOCK_EX) - if (self.smprint["inep"] is None) and (self.smprint["outep"] is None): + if "ipaddr" in self.smprint: + prn = printer.Network(self.smprint["ipaddr"]) + elif (self.smprint["inep"] is None) and (self.smprint["outep"] is None): prn = printer.Usb(self.smprint["vendorid"], self.smprint["productid"]) else: