Fixed label print copies and added sleep after print
This commit is contained in:
@@ -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