pull receipt printer info from env
This commit is contained in:
parent
42062c2eb6
commit
9353b6499a
1 changed files with 18 additions and 3 deletions
21
printer.py
21
printer.py
|
@ -1,6 +1,21 @@
|
||||||
from escpos.printer import CupsPrinter
|
import logging
|
||||||
|
import os
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
|
|
||||||
|
from dotenv import find_dotenv, load_dotenv
|
||||||
|
from escpos.printer import CupsPrinter
|
||||||
|
|
||||||
|
log = logging.getLogger("receipt-printer")
|
||||||
|
log.setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
if load_dotenv(find_dotenv(usecwd=True)):
|
||||||
|
log.debug("Loaded .env")
|
||||||
|
else:
|
||||||
|
log.debug("Didn't find .env")
|
||||||
|
|
||||||
|
|
||||||
|
RECEIPT_PRINTER = os.getenv("RECEIPT_PRINTER")
|
||||||
|
|
||||||
|
|
||||||
class CallbackContext:
|
class CallbackContext:
|
||||||
def __init__(self, enter=None, exit=None):
|
def __init__(self, enter=None, exit=None):
|
||||||
|
@ -104,5 +119,5 @@ class ReceiptPrinter(CupsPrinter):
|
||||||
with self.set(align="center", double_height=True, double_width=True):
|
with self.set(align="center", double_height=True, double_width=True):
|
||||||
p.textln(text)
|
p.textln(text)
|
||||||
|
|
||||||
#p = ReceiptPrinter("EPSON-TM-m30", profile="default")
|
|
||||||
p = ReceiptPrinter("EPSON-TM-m30-remote", profile="default")
|
p = ReceiptPrinter(RECEIPT_PRINTER, profile="default")
|
||||||
|
|
Loading…
Add table
Reference in a new issue