150 lines
7.7 KiB
HTML
150 lines
7.7 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Label Settings - Admin{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/labels-bricklink.css') }}">
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="bl">
|
|
{% set section = 'settings' %}
|
|
{% set bar_sub = 'API keys, print defaults and the tape printer' %}
|
|
{% set crumbs = [{'name': 'Settings'}] %}
|
|
{% include 'admin/labels/_nav.html' %}
|
|
|
|
<div class="row">
|
|
<div class="col-lg-7">
|
|
<form method="POST">
|
|
<div class="card mb-3">
|
|
<div class="card-header"><strong>Rebrickable</strong></div>
|
|
<div class="card-body">
|
|
<p class="small text-muted">
|
|
Brickset's API covers sets, minifigs and instructions — it has no parts endpoint,
|
|
so part numbers, names and artwork come from Rebrickable instead. A key is free from
|
|
<a href="https://rebrickable.com/api/" target="_blank" rel="noopener">rebrickable.com/api</a>.
|
|
Leave this blank to work entirely by hand with your own uploaded images.
|
|
</p>
|
|
<label class="form-label">API key</label>
|
|
<input type="text" name="rebrickable_api_key" class="form-control"
|
|
value="{{ api_key }}" placeholder="{{ 'Set in .env - leave blank to keep using it' if env_key_present else 'Paste your key' }}">
|
|
{% if env_key_present %}
|
|
<div class="form-text">
|
|
REBRICKABLE_API_KEY is also set in your environment. A key entered here takes priority.
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mb-3">
|
|
<div class="card-header"><strong>Print defaults</strong></div>
|
|
<div class="card-body row g-3">
|
|
<div class="col-12">
|
|
<label class="form-label">Default sheet</label>
|
|
<select name="label_default_preset" class="form-select">
|
|
{% for key, preset in presets.items() %}
|
|
<option value="{{ key }}" {% if key == default_preset %}selected{% endif %}>{{ preset.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Printer offset X (mm)</label>
|
|
<input type="number" step="0.1" name="offset_x" class="form-control" value="{{ offset_x }}">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Printer offset Y (mm)</label>
|
|
<input type="number" step="0.1" name="offset_y" class="form-control" value="{{ offset_y }}">
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="form-text">
|
|
Most printers are a few tenths of a millimetre out. Print one sheet with
|
|
"outline each label" ticked, measure the drift, and put it here.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mb-3">
|
|
<div class="card-header"><strong>Tape printer (Brother VC-500W)</strong></div>
|
|
<div class="card-body row g-3">
|
|
<div class="col-12">
|
|
<p class="small text-muted mb-1">
|
|
The VC-500W is AirPrint-enabled, which means it speaks IPP on port 631.
|
|
Put its IP address here and LIM can send labels to it directly over the
|
|
network — no Brother driver, no P-touch Editor. Give the printer a
|
|
DHCP reservation first, or the address will move.
|
|
</p>
|
|
<p class="small text-muted">
|
|
Leave this blank to skip direct printing; tape labels can always be
|
|
downloaded as a PDF instead.
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Printer IP address or hostname</label>
|
|
<input type="text" name="tape_printer_host" class="form-control"
|
|
value="{{ tape_printer_host }}" placeholder="192.168.1.50">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Port</label>
|
|
<input type="number" name="tape_printer_port" class="form-control"
|
|
value="{{ tape_printer_port }}">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">IPP path</label>
|
|
<input type="text" name="tape_printer_path" class="form-control"
|
|
value="{{ tape_printer_path }}" placeholder="/ipp/print">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Default tape width</label>
|
|
<select name="tape_default" class="form-select">
|
|
{% for key, preset in tapes.items() %}
|
|
<option value="{{ key }}" {% if key == tape_default %}selected{% endif %}>{{ preset.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Force document format</label>
|
|
<select name="tape_printer_format" class="form-select">
|
|
<option value="">Ask the printer (recommended)</option>
|
|
<option value="image/jpeg" {% if tape_printer_format == 'image/jpeg' %}selected{% endif %}>image/jpeg</option>
|
|
<option value="image/png" {% if tape_printer_format == 'image/png' %}selected{% endif %}>image/png</option>
|
|
<option value="application/pdf" {% if tape_printer_format == 'application/pdf' %}selected{% endif %}>application/pdf</option>
|
|
</select>
|
|
<div class="form-text">
|
|
Leave on "Ask the printer" unless it rejects jobs. Use
|
|
<em>Test connection</em> on the tape page to see what it accepts.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button class="btn btn-danger"><i class="bi bi-check-lg"></i> Save settings</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="col-lg-5">
|
|
<div class="card">
|
|
<div class="card-header"><strong>PDF export</strong></div>
|
|
<div class="card-body">
|
|
{% if pdf_available %}
|
|
<p class="mb-0 text-success small">
|
|
<i class="bi bi-check-circle"></i> ReportLab is installed, so the PDF button is available
|
|
on the print page.
|
|
</p>
|
|
{% else %}
|
|
<p class="small text-muted">
|
|
PDF export is optional and needs ReportLab:
|
|
</p>
|
|
<pre class="bg-light p-2 small mb-2"><code>pip install reportlab</code></pre>
|
|
<p class="small text-muted mb-0">
|
|
Printing straight from the browser works without it and is usually the more
|
|
accurate of the two anyway.
|
|
</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|