1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-10-23 09:30:00 +00:00

remove bad quotes

This commit is contained in:
Patrick Kanzler
2018-05-16 01:09:48 +02:00
parent 18e4c1b0ac
commit c0af9aaaf4
16 changed files with 143 additions and 143 deletions

View File

@@ -2,7 +2,7 @@ from escpos.printer import Usb
# Adapt to your needs
p = Usb(0x0416, 0x5011, profile="POS-5890")
p = Usb(0x0416, 0x5011, profile='POS-5890')
# Print software and then hardware barcode with the same content
p.soft_barcode('code39', '123456')

View File

@@ -17,9 +17,9 @@ def main():
for codepage in sys.argv[1:] or ['USA']:
dummy.set(height=2, width=2)
dummy._raw(codepage + "\n\n\n")
dummy._raw(codepage + '\n\n\n')
print_codepage(dummy, codepage)
dummy._raw("\n\n")
dummy._raw('\n\n')
dummy.cut()
@@ -30,22 +30,22 @@ def print_codepage(printer, codepage):
if codepage.isdigit():
codepage = int(codepage)
printer._raw(CODEPAGE_CHANGE + six.int2byte(codepage))
printer._raw("after")
printer._raw('after')
else:
printer.charcode(codepage)
sep = ""
sep = ''
# Table header
printer.set(font='b')
printer._raw(" {}\n".format(sep.join(map(lambda s: hex(s)[2:], range(0, 16)))))
printer._raw(' {}\n'.format(sep.join(map(lambda s: hex(s)[2:], range(0, 16)))))
printer.set()
# The table
for x in range(0, 16):
# First column
printer.set(font='b')
printer._raw("{} ".format(hex(x)[2:]))
printer._raw('{} '.format(hex(x)[2:]))
printer.set()
for y in range(0, 16):

View File

@@ -4,7 +4,7 @@ from escpos.printer import Usb
def usage():
print("usage: qr_code.py <content>")
print('usage: qr_code.py <content>')
if __name__ == '__main__':
@@ -15,5 +15,5 @@ if __name__ == '__main__':
content = sys.argv[1]
# Adapt to your needs
p = Usb(0x0416, 0x5011, profile="POS-5890")
p = Usb(0x0416, 0x5011, profile='POS-5890')
p.qr(content, center=True)

View File

@@ -2,7 +2,7 @@ from escpos.printer import Usb
# Adapt to your needs
p = Usb(0x0416, 0x5011, profile="POS-5890")
p = Usb(0x0416, 0x5011, profile='POS-5890')
# Some software barcodes
p.soft_barcode('code128', 'Hello')

View File

@@ -25,22 +25,22 @@ from escpos.printer import Usb
""" Setting up the main pathing """
this_dir, this_filename = os.path.split(__file__)
GRAPHICS_PATH = os.path.join(this_dir, "graphics/climacons/")
GRAPHICS_PATH = os.path.join(this_dir, 'graphics/climacons/')
# Adapt to your needs
printer = Usb(0x0416, 0x5011, profile="POS-5890")
printer = Usb(0x0416, 0x5011, profile='POS-5890')
# You can get your API Key on www.darksky.net and register a dev account.
# Technically you can use any other weather service, of course :)
API_KEY = "YOUR API KEY"
API_KEY = 'YOUR API KEY'
LAT = "22.345490" # Your Location
LONG = "114.189945" # Your Location
LAT = '22.345490' # Your Location
LONG = '114.189945' # Your Location
def forecast_icon(idx):
icon = data['daily']['data'][idx]['icon']
image = GRAPHICS_PATH + icon + ".png"
image = GRAPHICS_PATH + icon + '.png'
return image
@@ -80,23 +80,23 @@ def forecast(idx):
def icon():
icon = data['currently']['icon']
image = GRAPHICS_PATH + icon + ".png"
image = GRAPHICS_PATH + icon + '.png'
return image
deg = ' C' # Degree symbol on thermal printer, need to find a better way to use a proper degree symbol
# if you want Fahrenheit change units= to 'us'
url = "https://api.darksky.net/forecast/" + API_KEY + "/" + LAT + "," + LONG + \
"?exclude=[alerts,minutely,hourly,flags]&units=si" # change last bit to 'us' for Fahrenheit
url = 'https://api.darksky.net/forecast/' + API_KEY + '/' + LAT + ',' + LONG + \
'?exclude=[alerts,minutely,hourly,flags]&units=si' # change last bit to 'us' for Fahrenheit
response = urllib.urlopen(url)
data = json.loads(response.read())
printer.print_and_feed(n=1)
printer.control("LF")
printer.control('LF')
printer.set(font='a', height=2, align='center', bold=True, double_height=True)
printer.text("Weather Forecast")
printer.text("\n")
printer.text('Weather Forecast')
printer.text('\n')
printer.set(align='center')
@@ -104,7 +104,7 @@ printer.set(align='center')
printer.set(font='a', height=2, align='center', bold=True, double_height=False)
printer.text('Current conditions: \n')
printer.image(icon())
printer.text("\n")
printer.text('\n')
printer.set(font='a', height=2, align='left', bold=False, double_height=False)
temp = data['currently']['temperature']
@@ -124,4 +124,4 @@ printer.text('Forecast: \n')
forecast(0)
forecast(1)
printer.cut()
printer.control("LF")
printer.control('LF')