Show More
|
1 | NO CONTENT: modified file |
@@ -1,36 +1,35 b'' | |||
|
1 |
""" |
|
|
1 | """ImageWidget class. | |
|
2 | 2 | |
|
3 |
Represents a |
|
|
4 | click events on the button and trigger backend code when the clicks are fired. | |
|
3 | Represents an image in the frontend using a widget. | |
|
5 | 4 | """ |
|
6 | 5 | #----------------------------------------------------------------------------- |
|
7 | 6 | # Copyright (c) 2013, the IPython Development Team. |
|
8 | 7 | # |
|
9 | 8 | # Distributed under the terms of the Modified BSD License. |
|
10 | 9 | # |
|
11 | 10 | # The full license is in the file COPYING.txt, distributed with this software. |
|
12 | 11 | #----------------------------------------------------------------------------- |
|
13 | 12 | |
|
14 | 13 | #----------------------------------------------------------------------------- |
|
15 | 14 | # Imports |
|
16 | 15 | #----------------------------------------------------------------------------- |
|
17 | 16 | import base64 |
|
18 | 17 | |
|
19 | 18 | from .widget import DOMWidget |
|
20 | 19 | from IPython.utils.traitlets import Unicode, CUnicode, Bytes |
|
21 | 20 | |
|
22 | 21 | #----------------------------------------------------------------------------- |
|
23 | 22 | # Classes |
|
24 | 23 | #----------------------------------------------------------------------------- |
|
25 | 24 | class ImageWidget(DOMWidget): |
|
26 | 25 | _view_name = Unicode('ImageView', sync=True) |
|
27 | 26 | |
|
28 | 27 | # Define the custom state properties to sync with the front-end |
|
29 | 28 | format = Unicode('png', sync=True) |
|
30 | 29 | width = CUnicode(sync=True) |
|
31 | 30 | height = CUnicode(sync=True) |
|
32 | 31 | _b64value = Unicode(sync=True) |
|
33 | 32 | |
|
34 | 33 | value = Bytes() |
|
35 | 34 | def _value_changed(self, name, old, new): |
|
36 | 35 | self._b64value = base64.b64encode(new) |
General Comments 0
You need to be logged in to leave comments.
Login now