From: Matt Webb Date: Sat, 27 Sep 2014 12:04:19 +0000 (+0100) Subject: updating requirements, giving time for renders to take place X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=0d4c749d3c5d63480591270057be0585fc4d7d4a;p=sirius.git updating requirements, giving time for renders to take place --- diff --git a/app/image_encoding.py b/app/image_encoding.py index 3bc1e49..374e2b2 100644 --- a/app/image_encoding.py +++ b/app/image_encoding.py @@ -2,6 +2,7 @@ from PIL import Image from itertools import groupby import struct import io +import time WHITE = 0 BLACK = 1 @@ -85,15 +86,27 @@ def _rle_image(im): return len(pixels), output def rle_html(html): + """ This works: + + + + """ from selenium import webdriver driver = webdriver.PhantomJS('phantomjs') - driver.set_window_size(384, 800) + driver.set_window_size(384, 5) #driver.get("http://www.google.com") - driver.get("about:black") + driver.get("about:blank") html = html.replace('"', '\\"') driver.execute_script("""document.write("%s")""" % html) + # @TODO good grief, I can't just go putting sleeps around the place. + # how else to tell when the document.write has finished rendering, and + # all the images have loaded? + # maybe I need to inject something like this and look for an alert? + # http://imagesloaded.desandro.com + time.sleep(2) + #p = driver.get_screenshot_as_file("/Users/matt/Desktop/test5.png") p = driver.get_screenshot_as_png() im = Image.open(io.BytesIO(p)) return _rle_image(im) diff --git a/app/queues.py b/app/queues.py index 38c179e..3e33a35 100644 --- a/app/queues.py +++ b/app/queues.py @@ -84,7 +84,7 @@ class _CommandQueue(object): self.device_queue = {} # device_address: [DeviceCommand] self.bridge_pending = None self.device_pending = {} # device_address: None|DeviceCommand - + def add_device(self, device): da = device.device_address if da not in self.devices: diff --git a/requirements.txt b/requirements.txt index a7d3eb8..a5502ba 100755 --- a/requirements.txt +++ b/requirements.txt @@ -4,11 +4,13 @@ Flask-Migrate==1.2.0 Flask-SQLAlchemy==2.0 Flask-Script==2.0.5 Flask-Sockets==0.1 +Flask-WTF==0.10.2 Jinja2==2.7.3 Mako==1.0.0 MarkupSafe==0.23 Pillow==2.5.3 SQLAlchemy==0.9.7 +WTForms==2.0.1 Werkzeug==0.9.6 alembic==0.6.7 gevent==1.0.1 @@ -17,4 +19,6 @@ greenlet==0.4.4 gunicorn==19.1.1 itsdangerous==0.24 pycrypto==2.6.1 +redis==2.10.3 +selenium==2.43.0 wsgiref==0.1.2