1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-09-13 09:09:58 +00:00

REFACTOR use bytes in constants-section

adds six for cross-version int/byte-conversion
This commit is contained in:
Patrick Kanzler
2016-03-03 04:21:35 +01:00
parent 7005ba5899
commit 5d5412ba73
3 changed files with 123 additions and 118 deletions

View File

@@ -12,7 +12,9 @@ This module contains the abstract base class :py:class:`Escpos`.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#from __future__ import unicode_literals
from __future__ import unicode_literals
import six
try:
import Image
@@ -517,7 +519,7 @@ class Escpos(object):
elif width == 1 and height == 1:
self._raw(TXT_NORMAL)
elif 1 <= width <= 8 and 1 <= height <= 8 and isinstance(width, int) and isinstance(height, int):
self._raw(TXT_SIZE + chr(TXT_WIDTH[width] + TXT_HEIGHT[height]))
self._raw(TXT_SIZE + six.int2byte(TXT_WIDTH[width] + TXT_HEIGHT[height]))
else:
raise SetVariableError()
# Upside down