Live works!

This commit is contained in:
Tim Bentley 2013-05-25 18:05:44 +01:00
parent e1f3024ff1
commit 20bd86fbce
3 changed files with 7 additions and 2 deletions

View File

@ -183,7 +183,8 @@ def image_to_byte(image):
# use buffer to store pixmap into byteArray
buffie = QtCore.QBuffer(byte_array)
buffie.open(QtCore.QIODevice.WriteOnly)
image.save(buffie, "PNG")
if isinstance(image, QtGui.QImage):
image.save(buffie, "PNG")
log.debug(u'image_to_byte - end')
# convert to base64 encoding so does not get missed!
return byte_array.toBase64()

View File

@ -42,6 +42,8 @@
top: 0px;
width: 100%%;
height: 100%%;
background-size: cover;
background-repeat: no-repeat;
}
</style>
<body>

View File

@ -136,6 +136,7 @@ def make_sha_hash(password):
"""
Create an encrypted password for the given password.
"""
log.debug("make_sha_hash")
return sha(ntob(password)).hexdigest()
@ -143,6 +144,7 @@ def fetch_password(username):
"""
Fetch the password for a provided user.
"""
log.debug("Fetch Password")
if username != Settings().value(u'remotes/user id'):
return None
return make_sha_hash(Settings().value(u'remotes/password'))
@ -460,7 +462,7 @@ class HttpRouter(object):
Return the latest display image as a byte stream.
"""
result = {
u'slide_image': str(image_to_byte(self.live_controller.slide_image))
u'slide_image': u'data:image/png;base64,' + str(image_to_byte(self.live_controller.slide_image))
}
cherrypy.response.headers['Content-Type'] = u'application/json'
return json.dumps({u'results': result})