mirror of
https://github.com/pklaus/brother_ql_web.git
synced 2024-05-25 11:56:53 +03:00
--default-label-size and --default-orientation
This commit is contained in:
parent
64a1ba5eb7
commit
f9507358ed
10
README.md
10
README.md
|
@ -27,9 +27,13 @@ To start the server, run `./brother_ql_web.py`. Here's its command line interfac
|
||||||
|
|
||||||
usage: brother_ql_web.py [-h] [--port PORT] [--loglevel LOGLEVEL]
|
usage: brother_ql_web.py [-h] [--port PORT] [--loglevel LOGLEVEL]
|
||||||
[--font-folder FONT_FOLDER]
|
[--font-folder FONT_FOLDER]
|
||||||
|
[--default-label-size DEFAULT_LABEL_SIZE]
|
||||||
|
[--default-orientation {standard,rotated}]
|
||||||
[--model {QL-500,QL-550,QL-560,QL-570,QL-580N,QL-650TD,QL-700,QL-710W,QL-720NW,QL-1050,QL-1060N}]
|
[--model {QL-500,QL-550,QL-560,QL-570,QL-580N,QL-650TD,QL-700,QL-710W,QL-720NW,QL-1050,QL-1060N}]
|
||||||
printer
|
printer
|
||||||
|
|
||||||
|
This is a web service to print labels on Brother QL label printers.
|
||||||
|
|
||||||
positional arguments:
|
positional arguments:
|
||||||
printer String descriptor for the printer to use (like
|
printer String descriptor for the printer to use (like
|
||||||
tcp://192.168.0.23:9100 or file:///dev/usb/lp0)
|
tcp://192.168.0.23:9100 or file:///dev/usb/lp0)
|
||||||
|
@ -40,5 +44,11 @@ To start the server, run `./brother_ql_web.py`. Here's its command line interfac
|
||||||
--loglevel LOGLEVEL
|
--loglevel LOGLEVEL
|
||||||
--font-folder FONT_FOLDER
|
--font-folder FONT_FOLDER
|
||||||
folder for additional .ttf/.otf fonts
|
folder for additional .ttf/.otf fonts
|
||||||
|
--default-label-size DEFAULT_LABEL_SIZE
|
||||||
|
Label size inserted in your printer. Defaults to 62.
|
||||||
|
--default-orientation {standard,rotated}
|
||||||
|
Label orientation, defaults to "standard". To turn
|
||||||
|
your text by 90°, state "rotated".
|
||||||
--model {QL-500,QL-550,QL-560,QL-570,QL-580N,QL-650TD,QL-700,QL-710W,QL-720NW,QL-1050,QL-1060N}
|
--model {QL-500,QL-550,QL-560,QL-570,QL-580N,QL-650TD,QL-700,QL-710W,QL-720NW,QL-1050,QL-1060N}
|
||||||
The model of your printer (default: QL-500)
|
The model of your printer (default: QL-500)
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ DEBUG = False
|
||||||
MODEL = None
|
MODEL = None
|
||||||
BACKEND_CLASS = None
|
BACKEND_CLASS = None
|
||||||
BACKEND_STRING_DESCR = None
|
BACKEND_STRING_DESCR = None
|
||||||
|
DEFAULT_ORIENTATION = None
|
||||||
|
DEFAULT_LABEL_SIZE = None
|
||||||
FONTS = None
|
FONTS = None
|
||||||
DEFAULT_FONT = None
|
DEFAULT_FONT = None
|
||||||
DEFAULT_FONTS = [
|
DEFAULT_FONTS = [
|
||||||
|
@ -48,7 +50,7 @@ def labeldesigner():
|
||||||
label_sizes = LABEL_SIZES
|
label_sizes = LABEL_SIZES
|
||||||
title = 'Label Designer'
|
title = 'Label Designer'
|
||||||
page_headline = 'Brother QL Label Designer'
|
page_headline = 'Brother QL Label Designer'
|
||||||
return {'title': title, 'page_headline': page_headline, 'message': '', 'fonts': fonts, 'label_sizes': label_sizes}
|
return {'title': title, 'page_headline': page_headline, 'message': '', 'fonts': fonts, 'label_sizes': label_sizes, 'default_label_size': DEFAULT_LABEL_SIZE, 'default_orientation': DEFAULT_ORIENTATION}
|
||||||
|
|
||||||
def get_label_context(request):
|
def get_label_context(request):
|
||||||
""" might raise LookupError() """
|
""" might raise LookupError() """
|
||||||
|
@ -204,12 +206,14 @@ def print_text():
|
||||||
return return_dict
|
return return_dict
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global DEBUG, FONTS, DEFAULT_FONT, MODEL, BACKEND_CLASS, BACKEND_STRING_DESCR
|
global DEBUG, FONTS, DEFAULT_FONT, MODEL, BACKEND_CLASS, BACKEND_STRING_DESCR, DEFAULT_ORIENTATION, DEFAULT_LABEL_SIZE
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument('--port', default=8013)
|
parser.add_argument('--port', default=8013)
|
||||||
parser.add_argument('--loglevel', type=lambda x: getattr(logging, x.upper()), default='WARNING')
|
parser.add_argument('--loglevel', type=lambda x: getattr(logging, x.upper()), default='WARNING')
|
||||||
parser.add_argument('--font-folder', help='folder for additional .ttf/.otf fonts')
|
parser.add_argument('--font-folder', help='folder for additional .ttf/.otf fonts')
|
||||||
|
parser.add_argument('--default-label-size', default="62", help='Label size inserted in your printer. Defaults to 62.')
|
||||||
|
parser.add_argument('--default-orientation', default="standard", choices=('standard', 'rotated'), help='Label orientation, defaults to "standard". To turn your text by 90°, state "rotated".')
|
||||||
parser.add_argument('--model', default='QL-500', choices=models, help='The model of your printer (default: QL-500)')
|
parser.add_argument('--model', default='QL-500', choices=models, help='The model of your printer (default: QL-500)')
|
||||||
parser.add_argument('printer', help='String descriptor for the printer to use (like tcp://192.168.0.23:9100 or file:///dev/usb/lp0)')
|
parser.add_argument('printer', help='String descriptor for the printer to use (like tcp://192.168.0.23:9100 or file:///dev/usb/lp0)')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
@ -226,6 +230,11 @@ def main():
|
||||||
|
|
||||||
MODEL = args.model
|
MODEL = args.model
|
||||||
|
|
||||||
|
if args.default_label_size not in label_sizes:
|
||||||
|
parser.error("Invalid --default-label-size. Please choose on of the following:\n:" + " ".join(label_sizes))
|
||||||
|
DEFAULT_LABEL_SIZE = args.default_label_size
|
||||||
|
DEFAULT_ORIENTATION = args.default_orientation
|
||||||
|
|
||||||
FONTS = get_fonts()
|
FONTS = get_fonts()
|
||||||
if args.font_folder:
|
if args.font_folder:
|
||||||
FONTS.update(get_fonts(args.font_folder))
|
FONTS.update(get_fonts(args.font_folder))
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
<div class="chooser panel-body">
|
<div class="chooser panel-body">
|
||||||
<label for="labelSize" style="display: none">Label Size:</label>
|
<label for="labelSize" style="display: none">Label Size:</label>
|
||||||
<select class="form-control" id="labelSize" onChange="preview()">
|
<select class="form-control" id="labelSize" onChange="preview()">
|
||||||
{% for label_size in label_sizes %}<option value="{{label_size[0]}}">{{label_size[1]}}</option>{% endfor %}
|
{% for label_size in label_sizes %}<option value="{{label_size[0]}}" {% if default_label_size == label_size[0] %}selected{% endif %}>{{label_size[1]}}</option>{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<label for="orientation" style="margin-top: 10px; margin-bottom: 0">Label Orientation:</label>
|
<label for="orientation" style="margin-top: 10px; margin-bottom: 0">Label Orientation:</label>
|
||||||
<div class="radio" style="margin-top: 5px;">
|
<div class="radio" style="margin-top: 5px;">
|
||||||
<label><input type="radio" onchange="preview()" name="orientation" value="standard" checked>Standard</label>
|
<label><input type="radio" onchange="preview()" name="orientation" value="standard" {% if default_orientation == 'standard' %}checked{% endif %}>Standard</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label><input type="radio" onchange="preview()" name="orientation" value="rotated">Rotated</label>
|
<label><input type="radio" onchange="preview()" name="orientation" value="rotated" {% if default_orientation == 'rotated' %}checked{% endif %}>Rotated</label>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- class="chooser panel-body" -->
|
</div> <!-- class="chooser panel-body" -->
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user