Fixed label print copies and added sleep after print
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<img class="img-fluid shadow p-3 mb-5 bg-body rounded" src="{{ barcode_img }}">
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<form method="gest">
|
||||
<form method="get">
|
||||
{% csrf_token %}
|
||||
<label for="num_copies">Number of copies:</label><input type="number" id="num_copies" size="2" min="1" max="8" name="num_copies" value="1">
|
||||
<input type="submit" class="btn btn-primary" value="Print">
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import time
|
||||
|
||||
from django.views import generic
|
||||
from .models import Container, ContainerType
|
||||
import logging, json, re
|
||||
@@ -152,8 +154,12 @@ class ContainerPrintLabelView(LoginRequiredMixin, generic.DetailView):
|
||||
be_class = backend_factory(selected_backend)['backend_class']
|
||||
be = be_class(config['PRINTER']['PRINTER'])
|
||||
context['logs'].append('Got backend driver')
|
||||
for i in range(1, num_copies):
|
||||
context['logs'].append(f'Start printing {num_copies} labels')
|
||||
for i in range(0, num_copies):
|
||||
context['logs'].append(f'printing #{i}')
|
||||
be.write(qlr.data)
|
||||
if 'WAIT_AFTER_PRINT_s' in config['LABEL']:
|
||||
time.sleep(config['LABEL']['WAIT_AFTER_PRINT_s'])
|
||||
|
||||
context['logs'].append('Data sent to printer')
|
||||
be.dispose()
|
||||
|
Reference in New Issue
Block a user