From 5c3d7dab722f09e1d98eab9f8bd002acf6029325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Thu, 25 Aug 2016 15:55:14 +0200 Subject: [PATCH 1/2] Change setup.py shebang. This supports using the current virtualenv. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0e3eea5..02d479a 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import os import sys From df0c874f6e57453e8ec09a7867da3aff2a5f0d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Thu, 25 Aug 2016 16:17:58 +0200 Subject: [PATCH 2/2] Add constants for sheet mode, colors. --- src/escpos/constants.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/escpos/constants.py b/src/escpos/constants.py index 93721cb..9ec5eb7 100644 --- a/src/escpos/constants.py +++ b/src/escpos/constants.py @@ -55,11 +55,18 @@ _CUT_PAPER = lambda m: GS + b'V' + m PAPER_FULL_CUT = _CUT_PAPER(b'\x00') # Full cut paper PAPER_PART_CUT = _CUT_PAPER(b'\x01') # Partial cut paper +# Beep +BEEP = b'\x07' + # Panel buttons (e.g. the FEED button) _PANEL_BUTTON = lambda n: ESC + b'c5' + six.int2byte(n) PANEL_BUTTON_ON = _PANEL_BUTTON(0) # enable all panel buttons PANEL_BUTTON_OFF = _PANEL_BUTTON(1) # disable all panel buttons +# Sheet modes +SHEET_SLIP_MODE = ESC + b'\x63\x30\x04' # slip paper +SHEET_ROLL_MODE = ESC + b'\x63\x30\x01' # paper roll + # Text format # TODO: Acquire the "ESC/POS Application Programming Guide for Paper Roll # Printers" and tidy up this stuff too. @@ -101,6 +108,11 @@ TXT_ALIGN_RT = ESC + b'\x61\x02' # Right justification TXT_INVERT_ON = GS + b'\x42\x01' # Inverse Printing ON TXT_INVERT_OFF = GS + b'\x42\x00' # Inverse Printing OFF +# Text colors +TXT_COLOR_BLACK = ESC + b'\x72\x00' # Default Color +TXT_COLOR_RED = ESC + b'\x72\x01' # Alternative Color (Usually Red) + + # Char code table CHARCODE_PC437 = ESC + b'\x74\x00' # USA: Standard Europe CHARCODE_JIS = ESC + b'\x74\x01' # Japanese Katakana