Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, device, features={}):
super(ElginRM22, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: False,
feature.CASHDRAWER_PORTS: False,
feature.CASHDRAWER_AVAILABLE_PORTS: 0,
feature.PORTABLE: True,
feature.COLUMNS: feature.Columns(
normal=32,
expanded=16,
condensed=42),
})
self.hardware_features.update(features)
def __init__(self, device, features={}):
super(DarumaGeneric, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: False,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
def __init__(self, device, features={}):
super(MP4200TH, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: True,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
self._escpos = _ESCPOS(self)
self._escbema = _ESCBematech(self)
def __init__(self, device, features={}):
super(TMT20, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: True,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
def cut(self, partial=True):
"""
Trigger cutter to perform partial (default) or full paper cut.
"""
if self.hardware_features.get(feature.CUTTER, False):
# TODO: implement hardware alternative for unavailable features
# For example:
#
# self.hardware_alternatives.get('cutter-full-cut')(self)
#
# So, implementations or end-user-applications can replace
# certain hardware functionalites, based on available features.
#
# The above mapping can replace full cuts with line feeds for
# printer hardware that do not have an automatic paper cutter:
#
# self.hardware_alternatives.update({
# # skip 7 lines if we do not have a paper cutter
# 'cutter-full-cut': lambda impl: impl.lf(7)
# })
#
def cut(self, partial=True):
if self.hardware_features.get(feature.CUTTER, False):
param = '\x6D' if partial else '\x69'
self.device.write('\x1B' + param)
def cut(self, partial=True):
"""
Trigger cutter to perform full paper cut.
.. note::
Daruma ESC/POS command set does not offer control over full or
partial cut directly through cutter trigger command.
"""
if self.hardware_features.get(feature.CUTTER, False):
self.device.write('\x1B\x6d')