mirror of
https://github.com/python-escpos/python-escpos
synced 2025-10-23 09:30:00 +00:00
FEATURE disable panel buttons
This commit is contained in:
@@ -54,6 +54,11 @@ _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
|
||||
|
||||
# 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
|
||||
|
||||
# Text format
|
||||
# TODO: Acquire the "ESC/POS Application Programming Guide for Paper Roll
|
||||
# Printers" and tidy up this stuff too.
|
||||
|
||||
@@ -674,3 +674,26 @@ class Escpos(object):
|
||||
self._raw(CTL_HT)
|
||||
elif ctl.upper() == "VT":
|
||||
self._raw(CTL_VT)
|
||||
|
||||
def panel_buttons(self, enable=True):
|
||||
""" Controls the panel buttons on the printer (e.g. FEED)
|
||||
|
||||
When enable is set to False the panel buttons on the printer will be disabled. Calling the method with
|
||||
enable=True or without argument will enable the panel buttons.
|
||||
|
||||
If panel buttons are enabled, the function of the panel button, such as feeding, will be executed upon pressing
|
||||
the button. If the panel buttons are disabled, pressing them will not have any effect.
|
||||
|
||||
This command is effective until the printer is initialized, reset or power-cycled. The default is enabled panel
|
||||
buttons.
|
||||
|
||||
Some panel buttons will always work, especially when printer is opened. See for more information the manual
|
||||
of your printer and the escpos-command-reference.
|
||||
|
||||
:param enable: controls the panel buttons
|
||||
:rtype: None
|
||||
"""
|
||||
if enable:
|
||||
self._raw(PANEL_BUTTON_ON)
|
||||
else:
|
||||
self._raw(PANEL_BUTTON_OFF)
|
||||
|
||||
Reference in New Issue
Block a user