Show More
@@ -123,7 +123,7 b' class Session(object):' | |||
|
123 | 123 | socket.send(ident, zmq.SNDMORE) |
|
124 | 124 | socket.send_json(msg) |
|
125 | 125 | return msg |
|
126 | ||
|
126 | ||
|
127 | 127 | def recv(self, socket, mode=zmq.NOBLOCK): |
|
128 | 128 | """recv a message on a socket. |
|
129 | 129 |
@@ -48,6 +48,12 b' install_payload_page()' | |||
|
48 | 48 | # Functions and classes |
|
49 | 49 | #----------------------------------------------------------------------------- |
|
50 | 50 | |
|
51 | def _encode_png(data): | |
|
52 | pngdata = data.get('image/png') | |
|
53 | if pngdata is not None: | |
|
54 | data['image/png'] = encodestring(pngdata) | |
|
55 | ||
|
56 | ||
|
51 | 57 | class ZMQDisplayHook(DisplayHook): |
|
52 | 58 | """A displayhook subclass that publishes data using ZeroMQ.""" |
|
53 | 59 | |
@@ -69,8 +75,7 b' class ZMQDisplayHook(DisplayHook):' | |||
|
69 | 75 | |
|
70 | 76 | def write_format_data(self, format_dict): |
|
71 | 77 | pngdata = format_dict.get('image/png') |
|
72 | if pngdata is not None: | |
|
73 | format_dict['image/png'] = encodestring(pngdata) | |
|
78 | _encode_png(format_dict) | |
|
74 | 79 | self.msg['content']['data'] = format_dict |
|
75 | 80 | |
|
76 | 81 | def finish_displayhook(self): |
@@ -96,6 +101,7 b' class ZMQDisplayPublisher(DisplayPublisher):' | |||
|
96 | 101 | self._validate_data(source, data, metadata) |
|
97 | 102 | content = {} |
|
98 | 103 | content['source'] = source |
|
104 | _encode_png(data) | |
|
99 | 105 | content['data'] = data |
|
100 | 106 | content['metadata'] = metadata |
|
101 | 107 | self.session.send( |
General Comments 0
You need to be logged in to leave comments.
Login now