From 321342e2e7847f4dc26d70bdf5dd2762f737eb29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darrel=20Gri=C3=ABt?= Date: Fri, 13 Dec 2024 15:43:32 +0100 Subject: [PATCH 1/3] Add support for Rhino 6000+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Darrel Griët --- src/labelle/lib/constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/labelle/lib/constants.py b/src/labelle/lib/constants.py index dc17da49..d9fea8ed 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}", From 68c3d8610d86bc0d4e0c8dae4d63883d8cc99c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darrel=20Gri=C3=ABt?= Date: Fri, 13 Dec 2024 16:02:37 +0100 Subject: [PATCH 2/3] Add support for 24 mm tape size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Darrel Griët --- src/labelle/lib/devices/dymo_labeler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/labelle/lib/devices/dymo_labeler.py b/src/labelle/lib/devices/dymo_labeler.py index e57bcb18..f410f29a 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__( From a80877c9cc9a190dd006ad74cd30f3351b04adea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darrel=20Gri=C3=ABt?= Date: Fri, 13 Dec 2024 18:30:22 +0100 Subject: [PATCH 3/3] Initial working version for the Rhino 6000+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Darrel Griët --- src/labelle/lib/constants.py | 2 +- src/labelle/lib/devices/dymo_labeler.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/labelle/lib/constants.py b/src/labelle/lib/constants.py index d9fea8ed..305f1227 100755 --- a/src/labelle/lib/constants.py +++ b/src/labelle/lib/constants.py @@ -53,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 f410f29a..5ad57f56 100755 --- a/src/labelle/lib/devices/dymo_labeler.py +++ b/src/labelle/lib/devices/dymo_labeler.py @@ -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) ]