Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 6330565

Browse files
committed
Remove and change set methods to internal-only as feedback is given that they are too complicated for external usage.
1 parent 4dfb70c commit 6330565

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

adafruit_thermal_printer/thermal_printer.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ def set_defaults(self):
353353
self.double_width = False
354354
self.strike = False
355355
self.bold = False
356-
self.set_line_height(30)
357-
self.set_barcode_height(50)
358-
self.set_charset()
359-
self.set_code_page()
356+
self._set_line_height(30)
357+
self._set_barcode_height(50)
358+
self._set_charset()
359+
self._set_code_page()
360360

361361
def justify_left(self):
362362
"""Set left justification of text."""
@@ -470,7 +470,7 @@ def has_paper(self):
470470
return False
471471
return not status[0] & 0b00000100
472472

473-
def set_line_height(self, height):
473+
def _set_line_height(self, height):
474474
"""Set the line height in pixels. This is the total amount of space
475475
between lines, including the height of text. The smallest value is 24
476476
and the largest is 255.
@@ -479,34 +479,28 @@ def set_line_height(self, height):
479479
self._line_spacing = height - 24
480480
self.send_command('\x1B3{0}'.format(chr(height))) # ESC + '3' + height
481481

482-
def set_barcode_height(self, height):
482+
def _set_barcode_height(self, height):
483483
"""Set the barcode height in pixels. Must be a value 1 - 255."""
484484
assert 1 <= height <= 255
485485
self._barcode_height = height
486486
self.send_command('\x1Dh{0}'.format(chr(height))) # ASCII GS + 'h' + height
487487

488-
def set_charset(self, charset=0):
488+
def _set_charset(self, charset=0):
489489
"""Alters the character set for ASCII characters 0x23-0x7E. See
490490
datasheet for details on character set values (0-15). Note this is only
491491
supported on more recent firmware printers!
492492
"""
493493
assert 0 <= charset <= 15
494494
self.send_command('\x1BR{0}'.format(chr(charset))) # ESC + 'R' + charset
495495

496-
def set_code_page(self, code_page=0):
496+
def _set_code_page(self, code_page=0):
497497
"""Select alternate code page for upper ASCII symbols 0x80-0xFF. See
498498
datasheet for code page values (0 - 47). Note this is only supported
499499
on more recent firmware printers!
500500
"""
501501
assert 0 <= code_page <= 47
502502
self.send_command('\x1Bt{0}'.format(chr(code_page))) # ESC + 't' + code page
503503

504-
def set_char_spacing(self, spacing=0):
505-
"""Set the character spacing (in pixels). Note this is only supported
506-
on more recent firmware printers!"""
507-
assert 0 <= spacing <= 255
508-
self.send_command('\x1B {0}'.format(chr(spacing))) # ESC + ' ' + spacing
509-
510504
def tab(self):
511505
"""Print a tab (i.e. move to next 4 character block). Note this is
512506
only supported on more recent firmware printers!"""

0 commit comments

Comments
 (0)