webplot: Make pressing 's' save the plot to disk
It looks like right now pressing 's' doesn't really do anything but
tell the user that the touch logs were saved. I would really like it
if pressing 's' actually saved a png of the plot to disk.
This CL adds that functionality.
BUG=chromium:473322
TEST=tested on Android and ChromeOS, pressing 's' in the browser
sends the png data over the websocket and saves it to disk.
Change-Id: I453872f3ddc994ae3ccab4ffa47bbfd99794351c
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/263780
diff --git a/webplot/webplot.py b/webplot/webplot.py
index 64384f3..5232125 100755
--- a/webplot/webplot.py
+++ b/webplot/webplot.py
@@ -62,12 +62,12 @@
content = data[1] if len(data) == 2 else None
if mtype == 'quit':
# A shutdown message requested by the user.
- cherrypy.log('Save the image to %s' % SAVED_IMAGE)
- self.SaveImage(content, SAVED_IMAGE)
cherrypy.log('The user requests to shutdown the cherrypy server....')
state.DecCount()
elif mtype == 'save':
- cherrypy.log('Save data to %s' % content)
+ cherrypy.log('All data saved to "%s"' % SAVED_FILE)
+ self.SaveImage(content, SAVED_IMAGE)
+ cherrypy.log('Plot image saved to "%s"' % SAVED_IMAGE)
else:
cherrypy.log('Unknown message type: %s' % mtype)