Add support for QR code task
This commit is contained in:
10
src/task.py
10
src/task.py
@@ -30,6 +30,7 @@ class TaskType(Enum):
|
|||||||
TEXT = "text"
|
TEXT = "text"
|
||||||
IMAGE = "image"
|
IMAGE = "image"
|
||||||
CUT = "cut"
|
CUT = "cut"
|
||||||
|
QR = "qr"
|
||||||
|
|
||||||
|
|
||||||
class PrintTask(ABC):
|
class PrintTask(ABC):
|
||||||
@@ -67,6 +68,15 @@ class TextTask(PrintTask):
|
|||||||
def get_print_data(self):
|
def get_print_data(self):
|
||||||
return {"txt": self.content, "sign": self.signature}
|
return {"txt": self.content, "sign": self.signature}
|
||||||
|
|
||||||
|
class QRTask(TextTask):
|
||||||
|
"""This task prints a QR-Code, the signature is ignore and is always the content itself"""
|
||||||
|
def __init__(self, content):
|
||||||
|
super().__init__(content, signature="")
|
||||||
|
self.content = content
|
||||||
|
self.signature = content
|
||||||
|
|
||||||
|
def get_print_data(self):
|
||||||
|
return {"txt": self.content, "sign": self.signature}
|
||||||
|
|
||||||
class ImageTask(PrintTask):
|
class ImageTask(PrintTask):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user