diff --git a/src/labelle/lib/constants.py b/src/labelle/lib/constants.py index dc17da4..305f122 100755 --- a/src/labelle/lib/constants.py +++ b/src/labelle/lib/constants.py @@ -37,6 +37,7 @@ SUPPORTED_PRODUCTS = { 0x0011: "DYMO LabelMANAGER PC", 0x0015: "LabelPoint 350", + 0x0016: f"Rhino 6000+ {UNCONFIRMED_MESSAGE}", 0x1001: "LabelManager PnP (no mode switch)", 0x1002: "LabelManager PnP (mode switch)", 0x1003: f"LabelManager 420P (no mode switch) {UNCONFIRMED_MESSAGE}", @@ -52,7 +53,7 @@ PRINTER_INTERFACE_CLASS = 0x07 HID_INTERFACE_CLASS = 0x03 -# Escape character preceeding all commands +# Escape character preceding all commands ESC = 0x1B # Synchronization character preceding uncompressed print data diff --git a/src/labelle/lib/devices/dymo_labeler.py b/src/labelle/lib/devices/dymo_labeler.py index e57bcb1..5ad57f5 100755 --- a/src/labelle/lib/devices/dymo_labeler.py +++ b/src/labelle/lib/devices/dymo_labeler.py @@ -240,7 +240,7 @@ class DymoLabeler: LABELER_DISTANCE_BETWEEN_PRINT_HEAD_AND_CUTTER_MM = 8.1 LABELER_PRINT_HEAD_HEIGHT_MM = 8.2 - SUPPORTED_TAPE_SIZES_MM = (19, 12, 9, 6) + SUPPORTED_TAPE_SIZES_MM = (24, 19, 12, 9, 6) DEFAULT_TAPE_SIZE_MM = 12 def __init__( @@ -313,10 +313,19 @@ def print( The label bitmap is a PIL image in 1-bit format (mode=1), and pixels with value equal to 1 are burned. """ + + def mirror_byte(byte): + mirrored = 0 + for i in range(8): + mirrored = (mirrored << 1) | (byte & 1) # Shift mirrored left and add LSB of byte + byte >>= 1 # Shift byte right + return mirrored + # Convert the image to the proper matrix for the dymo labeler object so that # rows span the width of the label, and the first row corresponds to the left # edge of the label. rotated_bitmap = bitmap.transpose(Image.Transpose.ROTATE_270) + rotated_bitmap = rotated_bitmap.transpose(Image.Transpose.FLIP_LEFT_RIGHT) # Convert the image to raw bytes. Pixels along rows are chunked into groups of # 8 pixels, and subsequent rows are concatenated. @@ -330,7 +339,7 @@ def print( "label bitmap!" ) label_rows: list[bytes] = [ - stream[i : i + stream_row_length] + bytes(mirror_byte(b) for b in stream[i: i + stream_row_length]) for i in range(0, len(stream), stream_row_length) ]