feat: add support PT(PT-P750W) series label printer

This commit is contained in:
Hiromasa Ihara 2023-05-13 22:48:43 +09:00
parent 9e20b6dc3f
commit ed57d0538b
2 changed files with 9 additions and 5 deletions

View File

@ -12,7 +12,7 @@ from bottle import run, route, get, post, response, request, jinja2_view as view
from PIL import Image, ImageDraw, ImageFont
from brother_ql.devicedependent import models, label_type_specs, label_sizes
from brother_ql.devicedependent import ENDLESS_LABEL, DIE_CUT_LABEL, ROUND_DIE_CUT_LABEL
from brother_ql.devicedependent import ENDLESS_LABEL, DIE_CUT_LABEL, ROUND_DIE_CUT_LABEL, PTOUCH_ENDLESS_LABEL
from brother_ql import BrotherQLRaster, create_label
from brother_ql.backends import backend_factory, guess_backend
@ -192,7 +192,7 @@ def print_text():
im = create_label_im(**context)
if DEBUG: im.save('sample-out.png')
if context['kind'] == ENDLESS_LABEL:
if context['kind'] in (ENDLESS_LABEL, PTOUCH_ENDLESS_LABEL):
rotate = 0 if context['orientation'] == 'standard' else 90
elif context['kind'] in (ROUND_DIE_CUT_LABEL, DIE_CUT_LABEL):
rotate = 'auto'
@ -201,7 +201,11 @@ def print_text():
red = False
if 'red' in context['label_size']:
red = True
create_label(qlr, im, context['label_size'], red=red, threshold=context['threshold'], cut=True, rotate=rotate)
compress = False
if CONFIG['PRINTER']['MODEL'] == 'PT-P750W':
compress = True
create_label(qlr, im, context['label_size'], red=red, threshold=context['threshold'], cut=True, rotate=rotate, compress=compress)
if not DEBUG:
try:

View File

@ -28,10 +28,10 @@
</select>
<label for="orientation" style="margin-top: 10px; margin-bottom: 0">Label Orientation:</label>
<div class="radio" style="margin-top: 5px;">
<label><input type="radio" onchange="preview()" name="orientation" value="standard" {% if default_orientation == 'standard' %}checked{% endif %}>Standard</label>
<label><input type="radio" onchange="preview()" name="orientation" value="standard" {% if label.DEFAULT_ORIENTATION == 'standard' %}checked{% endif %}>Standard</label>
</div>
<div class="radio">
<label><input type="radio" onchange="preview()" name="orientation" value="rotated" {% if default_orientation == 'rotated' %}checked{% endif %}>Rotated</label>
<label><input type="radio" onchange="preview()" name="orientation" value="rotated" {% if label.DEFAULT_ORIENTATION == 'rotated' %}checked{% endif %}>Rotated</label>
</div>
</div> <!-- class="chooser panel-body" -->
</div>