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