Python2 compatible maybe?
This commit is contained in:
parent
6fdf157b5f
commit
5a89ca7ccd
|
@ -9,7 +9,7 @@ def px2mm(px, dpi=300):
|
||||||
|
|
||||||
class BrotherLabelWriter(ImageWriter):
|
class BrotherLabelWriter(ImageWriter):
|
||||||
def __init__(self, typ='62', max_height=350, rot=0, text=None):
|
def __init__(self, typ='62', max_height=350, rot=0, text=None):
|
||||||
super().__init__()
|
super(self).__init__()
|
||||||
assert typ in label_type_specs
|
assert typ in label_type_specs
|
||||||
if (rot//90) % 2 == 1:
|
if (rot//90) % 2 == 1:
|
||||||
self._h, self._w = label_type_specs[typ]['dots_printable']
|
self._h, self._w = label_type_specs[typ]['dots_printable']
|
||||||
|
@ -25,10 +25,10 @@ class BrotherLabelWriter(ImageWriter):
|
||||||
|
|
||||||
def _init(self, code):
|
def _init(self, code):
|
||||||
self.text = None
|
self.text = None
|
||||||
super()._init(code)
|
super(self)._init(code)
|
||||||
|
|
||||||
def calculate_size(self, modules_per_line, number_of_lines, dpi=300):
|
def calculate_size(self, modules_per_line, number_of_lines, dpi=300):
|
||||||
x, y = super().calculate_size(modules_per_line, number_of_lines, dpi)
|
x, y = super(self).calculate_size(modules_per_line, number_of_lines, dpi)
|
||||||
|
|
||||||
self._xo = (px2mm(self._w)-px2mm(x))/2
|
self._xo = (px2mm(self._w)-px2mm(x))/2
|
||||||
self._yo = (px2mm(self._h)-px2mm(y))
|
self._yo = (px2mm(self._h)-px2mm(y))
|
||||||
|
@ -38,10 +38,10 @@ class BrotherLabelWriter(ImageWriter):
|
||||||
return int(self._w), int(self._h)
|
return int(self._w), int(self._h)
|
||||||
|
|
||||||
def _paint_module(self, xpos, ypos, width, color):
|
def _paint_module(self, xpos, ypos, width, color):
|
||||||
super()._paint_module(xpos+self._xo, ypos+self._yo, width, color)
|
super(self)._paint_module(xpos+self._xo, ypos+self._yo, width, color)
|
||||||
|
|
||||||
def _paint_text(self, xpos, ypos):
|
def _paint_text(self, xpos, ypos):
|
||||||
super()._paint_text(xpos+self._xo, ypos+self._yo)
|
super(self)._paint_text(xpos+self._xo, ypos+self._yo)
|
||||||
|
|
||||||
def _finish(self):
|
def _finish(self):
|
||||||
if self._title:
|
if self._title:
|
||||||
|
|
Loading…
Reference in New Issue