Lint printer file

This commit is contained in:
n07070
2026-06-04 00:34:49 +02:00
parent 3c490e10b4
commit 651235a610

View File

@@ -2,7 +2,6 @@
This class manages connexion to a Printer This class manages connexion to a Printer
""" """
from time import sleep
import os.path import os.path
import os import os
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
@@ -10,8 +9,8 @@ from dataclasses import dataclass
from enum import Enum from enum import Enum
import uuid import uuid
import usb.core
import threading import threading
import usb.core
from PIL import Image, ImageEnhance from PIL import Image, ImageEnhance
import numpy as np import numpy as np
@@ -20,7 +19,6 @@ import numpy as np
import escpos.printer import escpos.printer
from brother_ql.models import ModelsManager from brother_ql.models import ModelsManager
from brother_ql.backends import backend_factory from brother_ql.backends import backend_factory
from brother_ql import labels
from brother_ql.raster import BrotherQLRaster from brother_ql.raster import BrotherQLRaster
from brother_ql.conversion import convert from brother_ql.conversion import convert
from brother_ql.backends.helpers import send from brother_ql.backends.helpers import send
@@ -38,6 +36,9 @@ class PrinterType(Enum):
# For Brother-QL Printers # For Brother-QL Printers
@dataclass @dataclass
class PrinterInfo: class PrinterInfo:
"""
Brother-QL printer information
"""
identifier: str identifier: str
backend: str backend: str
protocol: str protocol: str
@@ -375,7 +376,7 @@ class BrotherPrinter(Printer):
continue continue
protocol = parts[0] protocol = parts[0]
device_info = parts[2] # device_info = parts[2]
serial_number = parts[3] serial_number = parts[3]
try: try:
@@ -513,7 +514,7 @@ class BrotherPrinter(Printer):
def _process_image(self, path): def _process_image(self, path):
brightness_factor = 1.5 # Used only if image is too dark brightness_factor = 1.5 # Used only if image is too dark
brightness_threshold = 100 # Brightness threshold (0255) brightness_threshold = 100 # Brightness threshold (0255)
contrast_factor = 0.6 # Less than 1.0 = lower contrast # contrast_factor = 0.6 # Less than 1.0 = lower contrast
max_width = 575 max_width = 575
max_height = 1000 max_height = 1000