def randomly_change_personality(): # Restrict to debug for now until we have a proper user management # system. assert flask.current_app.config['DEBUG'], "Debug not enabled" im = image_encoding.threshold(Image.open('./tests/normalface.png')) msg = messages.SetPersonality( device_address='000d6f000273ce0b', face_pixels=im, nothing_to_print_pixels=image_encoding.default_pipeline('Nothing to print'), cannot_see_bridge_pixels=image_encoding.default_pipeline('Cannot see bridge'), cannot_see_internet_pixels=image_encoding.default_pipeline('Cannot see internet'), ) success, next_print_id = protocol_loop.send_message( '000d6f000273ce0b', msg) if success: flask.flash('Sent your message to the printer!') else: flask.flash(("Could not send message because the " "printer {} is offline.").format('000d6f000273ce0b'), 'error') return flask.redirect('/admin')
def randomly_change_personality(): # Restrict to debug for now until we have a proper user management # system. assert flask.current_app.config['DEBUG'], "Debug not enabled" im = image_encoding.threshold(Image.open('./tests/normalface.png')) msg = messages.SetPersonality( device_address='000d6f000273ce0b', face_pixels=im, nothing_to_print_pixels=image_encoding.default_pipeline( 'Nothing to print'), cannot_see_bridge_pixels=image_encoding.default_pipeline( 'Cannot see bridge'), cannot_see_internet_pixels=image_encoding.default_pipeline( 'Cannot see internet'), ) success, next_print_id = protocol_loop.send_message( '000d6f000273ce0b', msg) if success: flask.flash('Sent your message to the printer!') else: flask.flash(("Could not send message because the " "printer {} is offline.").format('000d6f000273ce0b'), 'error') return flask.redirect('/admin')
def test_full(self): data = image_encoding.html_to_png('') image = Image.open(data) image = image_encoding.crop_384(image) image = image_encoding.threshold(image) n_bytes, _ = image_encoding.rle_from_bw(image) self.assertEquals(n_bytes, 3072)