Remove semicolons, syntax enhancements, remove unused constant.
This commit is contained in:
parent
2d8a774b9f
commit
05cd028ac6
@ -252,5 +252,4 @@ S_RASTER_Q = _PRINT_RASTER_IMG(b'\x03') # Set raster image quadruple
|
|||||||
|
|
||||||
# Status Command
|
# Status Command
|
||||||
RT_STATUS_ONLINE = DLE + EOT + b'\x01';
|
RT_STATUS_ONLINE = DLE + EOT + b'\x01';
|
||||||
RT_STATUS_OFFLINECAUSE = DLE + EOT + b'\x02';
|
|
||||||
RT_MASK_ONLINE = 8;
|
RT_MASK_ONLINE = 8;
|
||||||
|
@ -35,7 +35,7 @@ from .constants import CD_KICK_DEC_SEQUENCE, CD_KICK_5, CD_KICK_2, PAPER_FULL_CU
|
|||||||
from .constants import HW_RESET, HW_SELECT, HW_INIT
|
from .constants import HW_RESET, HW_SELECT, HW_INIT
|
||||||
from .constants import CTL_VT, CTL_HT, CTL_CR, CTL_FF, CTL_LF, CTL_SET_HT, PANEL_BUTTON_OFF, PANEL_BUTTON_ON
|
from .constants import CTL_VT, CTL_HT, CTL_CR, CTL_FF, CTL_LF, CTL_SET_HT, PANEL_BUTTON_OFF, PANEL_BUTTON_ON
|
||||||
from .constants import TXT_STYLE
|
from .constants import TXT_STYLE
|
||||||
from .constants import RT_STATUS_ONLINE, RT_STATUS_OFFLINECAUSE, RT_MASK_ONLINE
|
from .constants import RT_STATUS_ONLINE, RT_MASK_ONLINE
|
||||||
|
|
||||||
from .exceptions import BarcodeTypeError, BarcodeSizeError, TabPosError
|
from .exceptions import BarcodeTypeError, BarcodeSizeError, TabPosError
|
||||||
from .exceptions import CashDrawerError, SetVariableError, BarcodeCodeError
|
from .exceptions import CashDrawerError, SetVariableError, BarcodeCodeError
|
||||||
@ -80,7 +80,10 @@ class Escpos(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _read(self, msg):
|
def _read(self, msg):
|
||||||
raise NotImplementedError();
|
""" Returns a NotImplementedError if the instance of the class doesn't override this method.
|
||||||
|
:raises NotImplementedError
|
||||||
|
"""
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
def image(self, img_source, high_density_vertical=True, high_density_horizontal=True, impl="bitImageRaster",
|
def image(self, img_source, high_density_vertical=True, high_density_horizontal=True, impl="bitImageRaster",
|
||||||
fragment_height=960):
|
fragment_height=960):
|
||||||
@ -738,18 +741,20 @@ class Escpos(object):
|
|||||||
else:
|
else:
|
||||||
self._raw(PANEL_BUTTON_OFF)
|
self._raw(PANEL_BUTTON_OFF)
|
||||||
|
|
||||||
def queryStatus(self):
|
def query_status(self):
|
||||||
|
""" Queries the printer for its status, and returns an array of integers containing it.
|
||||||
|
:rtype: array(integer)"""
|
||||||
self._raw(RT_STATUS_ONLINE)
|
self._raw(RT_STATUS_ONLINE)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
status = self._read();
|
status = self._read()
|
||||||
if (len(status) > 0):
|
return status or [8]
|
||||||
return status;
|
|
||||||
else:
|
def is_online(self):
|
||||||
return [8];
|
""" Queries the printer its online status.
|
||||||
|
When online, returns True; False otherwise.
|
||||||
|
:rtype: bool: True if online, False if offline."""
|
||||||
|
return (self.query_status()[0] & RT_MASK_ONLINE) == 0
|
||||||
|
|
||||||
def isOnline(self):
|
|
||||||
status = self.queryStatus()[0];
|
|
||||||
return ((status & RT_MASK_ONLINE) == 0);
|
|
||||||
|
|
||||||
class EscposIO(object):
|
class EscposIO(object):
|
||||||
"""ESC/POS Printer IO object
|
"""ESC/POS Printer IO object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user