st ten 10 print_button and instructions wip
This commit is contained in:
parent
bd37d53bb4
commit
07007c69b1
@ -26,7 +26,7 @@ class BrotherLabelPrinter(Component):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
barcode_img = qr.make_image(fill_color="black", back_color="white")
|
barcode_img = qr.make_image(fill_color="black", back_color="white")
|
||||||
barcode_img = barcode_img.resize((250, 380))
|
barcode_img = barcode_img.resize((250, 250))
|
||||||
print_width = 720
|
print_width = 720
|
||||||
print_height = 380
|
print_height = 380
|
||||||
label_img = Image.new("RGB", (print_width, print_height), color=(255, 255, 255))
|
label_img = Image.new("RGB", (print_width, print_height), color=(255, 255, 255))
|
||||||
@ -37,22 +37,17 @@ class BrotherLabelPrinter(Component):
|
|||||||
draw.text((280, 50), "ETICHETTA \nINTEROPERAZIONALE", (0, 0, 0), font=font)
|
draw.text((280, 50), "ETICHETTA \nINTEROPERAZIONALE", (0, 0, 0), font=font)
|
||||||
draw.text((280, 150), barcode, (0, 0, 0), font=font2)
|
draw.text((280, 150), barcode, (0, 0, 0), font=font2)
|
||||||
|
|
||||||
# Rotazione dell'immagine di 90 gradi in senso antiorario
|
|
||||||
rotated_label_img = label_img.rotate(90, expand=True)
|
|
||||||
|
|
||||||
# Salvataggio dell'immagine
|
|
||||||
if not os.path.exists("./tmp/"):
|
if not os.path.exists("./tmp/"):
|
||||||
os.makedirs("./tmp/")
|
os.makedirs("./tmp/")
|
||||||
rotated_label_img.save(file_name)
|
label_img.save(file_name)
|
||||||
|
|
||||||
# Stampa dell'immagine
|
|
||||||
hdc = win32ui.CreateDC()
|
hdc = win32ui.CreateDC()
|
||||||
hdc.CreatePrinterDC(printer_name)
|
hdc.CreatePrinterDC(printer_name)
|
||||||
|
|
||||||
hdc.StartDoc(file_name)
|
hdc.StartDoc(file_name)
|
||||||
hdc.StartPage()
|
hdc.StartPage()
|
||||||
|
|
||||||
dib = ImageWin.Dib(rotated_label_img)
|
dib = ImageWin.Dib(label_img.rotate(90, expand=True)) # Ruota di 270 gradi per stampare correttamente
|
||||||
dib.draw(hdc.GetHandleOutput(), (0, 0, print_height, print_width)) # Inverto larghezza e altezza
|
dib.draw(hdc.GetHandleOutput(), (0, 0, print_height, print_width)) # Inverto larghezza e altezza
|
||||||
|
|
||||||
hdc.EndPage()
|
hdc.EndPage()
|
||||||
|
|||||||
@ -62,12 +62,7 @@ class Test_Instructions(Test_Test):
|
|||||||
return show
|
return show
|
||||||
|
|
||||||
def toggle_icons(self):
|
def toggle_icons(self):
|
||||||
default_image_path = os.path.join("config", "instruction_images", self.config["machine"]["instruction_folder"],
|
|
||||||
"DEFAULT.svg")
|
|
||||||
|
|
||||||
if self.svg_path is None or self.svg_path == default_image_path:
|
|
||||||
if hasattr(self,
|
|
||||||
"print_b") and not self.done: # Verifica se il pulsante di stampa è abilitato e non è stato premuto
|
|
||||||
self.flag = not self.flag
|
self.flag = not self.flag
|
||||||
|
|
||||||
for elem in self.tape_ids:
|
for elem in self.tape_ids:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user