Skip to content

Commit 3da0664

Browse files
Update plugin to support new printing process:
- Set BLOCKING_PRINT to False to automatically use background worker - Handle "old style" kwargs - Bump version number
1 parent 7a87302 commit 3da0664

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

inventree_brother/brother_plugin.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class BrotherLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
5757
SLUG = "brother"
5858
TITLE = "Brother Label Printer"
5959

60+
# Use background printing
61+
BLOCKING_PRINT = False
62+
6063
SETTINGS = {
6164
'MODEL': {
6265
'name': _('Printer Model'),
@@ -117,8 +120,13 @@ def print_label(self, **kwargs):
117120
# ^ currently this width and height are those of the label template (before conversion to PDF
118121
# and PNG) and are of little use
119122

120-
# Extract image from the provided kwargs
121-
label_image = kwargs['png_file']
123+
# Look for png data in kwargs (if provided)
124+
label_image = kwargs.get('png_file', None)
125+
126+
if not label_image:
127+
# Convert PDF to PNG
128+
pdf_data = kwargs['pdf_data']
129+
label_image = self.render_to_png(label=None, pdf_data=pdf_data)
122130

123131
# Read settings
124132
model = self.get_setting('MODEL')

inventree_brother/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Version information for the plugin"""
22

3-
BROTHER_PLUGIN_VERSION = "0.6.1"
3+
BROTHER_PLUGIN_VERSION = "0.7.0"

0 commit comments

Comments
 (0)