Skip to content

Commit

Permalink
Handle default value of margin in printLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed May 28, 2023
1 parent 1502d40 commit c19a65b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/dymoprint/dymo_print_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,8 @@ def print_label(label_bitmap, margin=56 * 2, tape_size: int = 12):
die(access_error(dev))

print("Printing label..")
if margin is not None:
lm.printLabel(label_matrix, margin=margin)
else:
lm.printLabel(label_matrix)
lm.printLabel(label_matrix, margin=margin)
print("Done printing.")

if in_usb_mode:
usb.util.dispose_resources(dev)
5 changes: 4 additions & 1 deletion src/dymoprint/labeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,13 @@ def getStatus(self):
response = self.sendCommand()
print(response)

def printLabel(self, lines, margin=56 * 2):
def printLabel(self, lines, margin=None):
"""Print the label described by lines. (Automatically split label if
larger than maxLines)"""

if margin is None:
margin = 56 * 2

while len(lines) > self.maxLines + 1:
self.rawPrintLabel(lines[0 : self.maxLines], margin=0)
del lines[0 : self.maxLines]
Expand Down

0 comments on commit c19a65b

Please sign in to comment.