* Add links from the community
* Add a guide for Debian
* Recommend PhantomJS 2.1.1 to support pictures
- * Deactivate face printing by default (will add a switch soon)
+ * Deactivate face printing by default
* Add an API Key to make requests progamatically (will add documentation soon)
## Using it
coerce=int,
validators=[wtforms.validators.DataRequired()],
)
+ face = wtforms.SelectField(
+ 'Face',
+ coerce=int,
+ validators=[wtforms.validators.DataRequired()],
+ )
message = wtforms.TextAreaField(
'Message',
validators=[wtforms.validators.DataRequired()],
(x.id, x.name) for x in login.current_user.friends_printers()
]
form.target_printer.choices = choices
+ form.face.choices = [(1, "Default face"), (2, "No face")]
# Set default printer on get
if flask.request.method != 'POST':
form.target_printer.data = printer.id
+ form.face.data = 1
if form.validate_on_submit():
# TODO: move image encoding into a pthread.
# TODO: use templating to avoid injection attacks
pixels = image_encoding.default_pipeline(
templating.default_template(form.message.data))
- hardware_message = messages.SetDeliveryAndPrintNoFace(
- device_address=printer.device_address,
- pixels=pixels,
- )
+
+ hardware_message = None
+ if form.face.data == 1:
+ hardware_message = messages.SetDeliveryAndPrintNoFace(
+ device_address=printer.device_address,
+ pixels=pixels,
+ )
+ else:
+ hardware_message = messages.SetDeliveryAndPrint(
+ device_address=printer.device_address,
+ pixels=pixels,
+ )
# If a printer is "offline" then we won't find the printer
# connected and success will be false.
</ul>
{% endif %}
{{ form.target_printer(class="form-control") }}
+ </div>
+ <div class="form-group {% if form.face.errors %}has-error{% endif%}">
+ <label>{{ form.face.label }}</label>
+ {% if form.face.errors %}
+ <ul>
+ {% for error in form.face.errors %}
+ <li>{{ error }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {{ form.face(class="form-control") }}
</div>
+
<div class="form-group {% if form.message.errors %}has-error{% endif%}">
<label>{{ form.message.label }}</label>
{% if form.message.errors %}