From a8d4094630f245aa7ca97e5c121d25e036017d0c Mon Sep 17 00:00:00 2001 From: David Robinson Date: Tue, 1 Nov 2016 12:07:35 +1100 Subject: [PATCH 1/4] Add Print Quality Option Required for QL-720NW --- README.md | 6 +++++- brotherprint/brotherprint.py | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 65b9ae9..683091a 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Make sure to end with the print page command, signifying the end of a label. printjob.print_page() ### Template Printing -Create your template and upload it to the printer. After creating a BrotherLabel object, call template_mode() to set the printer to template mode, and then use the template commands to fill in your label. +Create your template and upload it to the printer. After creating a BrotherLabel object, call template_mode() to set the printer to template mode, and then use the template commands to fill in your label. Be sure to download the P-Touch Template Tools from support.brother.com under utilities of your label printer. It has a wealth of information. printjob.template_mode() printjob.template_init() @@ -51,5 +51,9 @@ Create your template and upload it to the printer. After creating a BrotherLabel printjob.select_and_insert(, ) printjob.select_and_insert(, ) printjob.select_and_insert(, ) + # For QL-720NW with barcodes on label, turn on: + # printjob.select_priority_print_option('on') printjob.template_print() + + diff --git a/brotherprint/brotherprint.py b/brotherprint/brotherprint.py index 6f0653f..4a4f738 100644 --- a/brotherprint/brotherprint.py +++ b/brotherprint/brotherprint.py @@ -1047,4 +1047,22 @@ def select_and_insert(self, name, data): self.select_obj(name) self.insert_into_obj(data) - + def select_priority_print_option(self, action): + ''' Default is 0 - Priority to print speed. Set to 1 for priority to print quality. + Required for QL-720NW and barcodes. + Args: + action: on or off. + Returns: + None + Raises: + RuntimeError( on or off not selected) + ''' + if action == 'on': + action = '1' + elif action == 'off': + action = '0' + else: + raise RuntimeError('Invalid action for function select_priority_print_option') + self.send('^QS'+action) + + From bb52083bd0686e54fff7bcbea65510cb07d51e5d Mon Sep 17 00:00:00 2001 From: Dimitris R Date: Thu, 3 Nov 2016 17:05:32 +0200 Subject: [PATCH 2/4] Specify number of copies --- brotherprint/brotherprint.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/brotherprint/brotherprint.py b/brotherprint/brotherprint.py index 4a4f738..a93bce6 100644 --- a/brotherprint/brotherprint.py +++ b/brotherprint/brotherprint.py @@ -1065,4 +1065,29 @@ def select_priority_print_option(self, action): raise RuntimeError('Invalid action for function select_priority_print_option') self.send('^QS'+action) + def set_number_of_copies(self, copies): + '''Set the number of copies. Number must be between 1-999 + + Args: + Number of copies + Returns: + None + Raises: + RuntimeError: Invalid number + ''' + try: + # get copies option + copies = int(copies) + except: + raise RuntimeError('Invalid number of copies: ' + str(copies)) + + if copies in range(1,999): + # padded number of copies + copies_pad = '%03d' % copies + # send to printer + self.send('^CN' + copies_pad) + else: + raise RuntimeError('Invalid number of copies. Number must be between 1 and 999') + + From e84247f997f9ef1674450a8ab4e8279a3d19d43a Mon Sep 17 00:00:00 2001 From: Ian Foote Date: Mon, 4 May 2020 08:14:06 +0100 Subject: [PATCH 3/4] Delete unnecessary import This doesn't do anything useful on python 2 and causes an ImportError on python 3: >>> import brotherprint Traceback (most recent call last): File "", line 1, in File "python-brotherprint/brotherprint/__init__.py", line 1, in from brotherprint import BrotherPrint ImportError: cannot import name 'BrotherPrint --- brotherprint/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/brotherprint/__init__.py b/brotherprint/__init__.py index 67e7f3f..e69de29 100644 --- a/brotherprint/__init__.py +++ b/brotherprint/__init__.py @@ -1 +0,0 @@ -from brotherprint import BrotherPrint \ No newline at end of file From 7a81548853514b8a3219a7fe5ae05097ef0985db Mon Sep 17 00:00:00 2001 From: Dimitris Rudas Date: Wed, 24 Jun 2020 18:30:26 +0300 Subject: [PATCH 4/4] Revert "Delete unnecessary import" --- brotherprint/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/brotherprint/__init__.py b/brotherprint/__init__.py index e69de29..67e7f3f 100644 --- a/brotherprint/__init__.py +++ b/brotherprint/__init__.py @@ -0,0 +1 @@ +from brotherprint import BrotherPrint \ No newline at end of file