Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions brother_ql_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_label_context(request):
'margin_right': float(d.get('margin_right', 35))/100.,
'grocycode': d.get('grocycode', None),
'product': d.get('product', None),
'duedate': d.get('duedate', None)
'due_date': d.get('due_date', None)
}
context['margin_top'] = int(context['font_size']*context['margin_top'])
context['margin_bottom'] = int(context['font_size']*context['margin_bottom'])
Expand Down Expand Up @@ -150,7 +150,7 @@ def create_label_im(text, **kwargs):

def create_label_grocy(text, **kwargs):
product = kwargs['product']
duedate = kwargs['duedate']
due_date = kwargs['due_date']
grocycode = kwargs['grocycode']


Expand All @@ -161,7 +161,7 @@ def create_label_grocy(text, **kwargs):
datamatrix.save('/tmp/dmtx.png')

product_font = ImageFont.truetype(kwargs['font_path'], 100)
duedate_font = ImageFont.truetype(kwargs['font_path'], 60)
due_date_font = ImageFont.truetype(kwargs['font_path'], 60)
width = kwargs['width']
height = 200
if kwargs['orientation'] == 'rotated':
Expand Down Expand Up @@ -192,7 +192,7 @@ def create_label_grocy(text, **kwargs):

draw.text(textoffset, product, kwargs['fill_color'], font=product_font)

if duedate is not None:
if due_date is not None:
if kwargs['orientation'] == 'standard':
vertical_offset += 110
horizontal_offset = kwargs['margin_left']
Expand All @@ -201,7 +201,7 @@ def create_label_grocy(text, **kwargs):
horizontal_offset += 110
textoffset = horizontal_offset, vertical_offset

draw.text(textoffset, duedate, kwargs['fill_color'], font=duedate_font)
draw.text(textoffset, due_date, kwargs['fill_color'], font=due_date_font)

return im

Expand Down