add invertln and title helpers
This commit is contained in:
parent
439143a474
commit
77c8dd7fe6
1 changed files with 15 additions and 0 deletions
15
printer.py
15
printer.py
|
@ -81,6 +81,10 @@ class ReceiptPrinter(CupsPrinter):
|
||||||
with self.set(invert=True):
|
with self.set(invert=True):
|
||||||
self.text(text)
|
self.text(text)
|
||||||
|
|
||||||
|
def invertln(self, text):
|
||||||
|
self.invert(text)
|
||||||
|
self.ln()
|
||||||
|
|
||||||
def bold(self, text):
|
def bold(self, text):
|
||||||
with self.set(bold=True):
|
with self.set(bold=True):
|
||||||
self.text(text)
|
self.text(text)
|
||||||
|
@ -89,4 +93,15 @@ class ReceiptPrinter(CupsPrinter):
|
||||||
self.bold(text)
|
self.bold(text)
|
||||||
self.ln()
|
self.ln()
|
||||||
|
|
||||||
|
def title(self, text, size=6, width=None, height=None):
|
||||||
|
width = width or size
|
||||||
|
height = height or size
|
||||||
|
with self.set(align="center", bold=True, invert=True, smooth=True, custom_size=True, width=width, height=height):
|
||||||
|
self.textln(text)
|
||||||
|
self.ln()
|
||||||
|
|
||||||
|
def subtitle(self, text):
|
||||||
|
with self.set(align="center", double_height=True, double_width=True):
|
||||||
|
p.textln(text)
|
||||||
|
|
||||||
p = ReceiptPrinter("EPSON-TM-m30", profile="default")
|
p = ReceiptPrinter("EPSON-TM-m30", profile="default")
|
||||||
|
|
Loading…
Reference in a new issue