Skip to content

Commit

Permalink
Fixed legacy executables
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarEclipse363 committed Jul 18, 2024
1 parent acb58b0 commit 0f95932
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
5 changes: 3 additions & 2 deletions brother_ql/brother_ql_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import sys, argparse, logging

from brother_ql.labels import LabelsManager
from brother_ql.raster import BrotherQLRaster
from brother_ql.conversion import convert
from brother_ql.devicedependent import label_type_specs
from brother_ql import BrotherQLUnknownModel

try:
stdout = sys.stdout.buffer
Expand Down Expand Up @@ -40,7 +41,7 @@ def main():
sys.exit("Unknown model. Use the command brother_ql_info list-models to show available models.")

try:
label_type_specs[args.label_size]
LabelsManager()[args.label_size]
except ValueError:
sys.exit("Unknown label_size. Check available sizes with the command brother_ql_info list-label-sizes")

Expand Down
31 changes: 17 additions & 14 deletions brother_ql/brother_ql_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import argparse

from brother_ql.devicedependent import models, label_sizes, label_type_specs, DIE_CUT_LABEL, ENDLESS_LABEL, ROUND_DIE_CUT_LABEL
from brother_ql.models import ModelsManager
from brother_ql.labels import FormFactor, LabelsManager

def main():
parser = argparse.ArgumentParser()
Expand All @@ -16,23 +17,25 @@ def main():

elif args.action == 'list-models':
print('Supported models:')
for model in models: print(" " + model)
for model in ModelsManager().iter_identifiers(): print(" " + model)

elif args.action == 'list-label-sizes':
print('Supported label sizes:')
fmt = " {label_size:9s} {dots_printable:14s} {label_descr:26s}"
print(fmt.format(label_size="Name", label_descr="Description", dots_printable="Printable px"))
for label_size in label_sizes:
s = label_type_specs[label_size]
if s['kind'] == DIE_CUT_LABEL:
label_descr = "(%d x %d mm^2)" % s['tape_size']
dots_printable = "{0:4d} x {1:4d}".format(*s['dots_printable'])
if s['kind'] == ENDLESS_LABEL:
label_descr = "(%d mm endless)" % s['tape_size'][0]
dots_printable = "{0:4d}".format(*s['dots_printable'])
if s['kind'] == ROUND_DIE_CUT_LABEL:
label_descr = "(%d mm diameter, round)" % s['tape_size'][0]
dots_printable = "{0:4d} x {1:4d}".format(*s['dots_printable'])
print(fmt.format(label_size=label_size, label_descr=label_descr, dots_printable=dots_printable))
for label in LabelsManager().iter_elements():
if label.form_factor == FormFactor.DIE_CUT:
label_descr = "(%d x %d mm^2)" % label.tape_size
dots_printable = "{0:4d} x {1:4d}".format(label.dots_printable)
elif label.form_factor == FormFactor.ENDLESS:
label_descr = "(%d mm endless)" % label.tape_size[0]
dots_printable = "{0:4d}".format(label.dots_printable)
elif label.form_factor == FormFactor.ROUND_DIE_CUT:
label_descr = "(%d mm diameter, round)" % label.tape_size[0]
dots_printable = "{0:4d} x {1:4d}".format(label.dots_printable)
else:
raise Exception("Unknown label form factor: {label.form_factor}")

print(fmt.format(label_size=label.identifier, label_descr=label_descr, dots_printable=dots_printable))

if __name__ == "__main__": main()

0 comments on commit 0f95932

Please sign in to comment.