[IMP] Add diagonal lines management

This commit is contained in:
Sylvain GARANCHER
2018-02-13 16:57:56 +01:00
committed by duongtq
parent 6bdd7c7a1c
commit 3fdd4af45f
4 changed files with 53 additions and 6 deletions

View File

@@ -123,6 +123,16 @@ class PrintingLabelZpl2(models.Model):
zpl2.ARG_COLOR: component.color,
zpl2.ARG_ROUNDING: component.rounding,
})
elif component.component_type == 'diagonal':
label_data.graphic_diagonal_line(
component_offset_x, component_offset_y, {
zpl2.ARG_WIDTH: component.width,
zpl2.ARG_HEIGHT: component.height,
zpl2.ARG_THICKNESS: component.thickness,
zpl2.ARG_COLOR: component.color,
zpl2.ARG_DIAGONAL_ORIENTATION:
component.diagonal_orientation,
})
elif component.component_type == 'graphic':
image = component.graphic_image or data
pil_image = Image.open(io.BytesIO(

View File

@@ -42,6 +42,7 @@ class PrintingLabelZpl2Component(models.Model):
selection=[
('text', 'Text'),
('rectangle', 'Rectangle / Line'),
('diagonal', 'Diagonal Line'),
('circle', 'Circle'),
('graphic', 'Graphic'),
(zpl2.BARCODE_CODE_11, 'Code 11'),
@@ -85,6 +86,12 @@ class PrintingLabelZpl2Component(models.Model):
(zpl2.ORIENTATION_BOTTOM_UP, 'Read from Bottom up'),
], required=True, default=zpl2.ORIENTATION_NORMAL,
help='Orientation of the barcode.')
diagonal_orientation = fields.Selection(
selection=[
(zpl2.DIAGONAL_ORIENTATION_LEFT, 'Left (\\)'),
(zpl2.DIAGONAL_ORIENTATION_RIGHT, 'Right (/)'),
], default=zpl2.DIAGONAL_ORIENTATION_LEFT,
help='Orientation of the diagonal line.')
check_digits = fields.Boolean(
help='Check if you want to compute and print the check digit.')
height = fields.Integer(