forked from broncotc/python-paperang
-
Notifications
You must be signed in to change notification settings - Fork 10
/
testprint.py
executable file
·33 lines (28 loc) · 1.11 KB
/
testprint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
import config
import time
import hardware
import image_data
class Paperangg_Printer:
def __init__(self):
if hasattr(config, "macaddress"):
print("attempting test print to MAC address \"% s\""% config.macaddress)
self.printer_hardware = hardware.Paperang(config.macaddress)
else:
print("searching for printer for test print...")
self.printer_hardware = hardware.Paperang()
# having trouble connecting? uncomment the following line and input
# your paperang's MAC address directly
# self.printer_hardware = hardware.Paperang("AA:BB:CC:DD:EE:FF")
def print_self_test(self):
if self.printer_hardware.connected:
self.printer_hardware.sendSelfTestToBt()
self.printer_hardware.disconnect()
else:
print("printer not connected.")
def print_sirius_image(self, path):
if self.printer_hardware.connected:
self.printer_hardware.sendImageToBt(image_data.sirius(path))
if __name__ == '__main__':
mmj=Paperangg_Printer()
mmj.print_self_test()