Show More
@@ -59,6 +59,10 b' class _SelectionWidget(DOMWidget):' | |||||
59 | if isinstance(values, list): |
|
59 | if isinstance(values, list): | |
60 | # preserve list order with an OrderedDict |
|
60 | # preserve list order with an OrderedDict | |
61 | kwargs['values'] = OrderedDict((unicode_type(v), v) for v in values) |
|
61 | kwargs['values'] = OrderedDict((unicode_type(v), v) for v in values) | |
|
62 | # python3.3 turned on hash randomization by default - this means that sometimes, randomly | |||
|
63 | # we try to set value before setting values, due to dictionary ordering. To fix this, force | |||
|
64 | # the setting of self.values right now, before anything else runs | |||
|
65 | self.values = kwargs.pop('values') | |||
62 | DOMWidget.__init__(self, *args, **kwargs) |
|
66 | DOMWidget.__init__(self, *args, **kwargs) | |
63 |
|
67 | |||
64 | def _values_changed(self, name, old, new): |
|
68 | def _values_changed(self, name, old, new): |
@@ -19,7 +19,8 b'' | |||||
19 | "# nbconvert related imports\n", |
|
19 | "# nbconvert related imports\n", | |
20 | "from IPython.nbconvert import get_export_names, export_by_name\n", |
|
20 | "from IPython.nbconvert import get_export_names, export_by_name\n", | |
21 | "from IPython.nbconvert.writers import FilesWriter\n", |
|
21 | "from IPython.nbconvert.writers import FilesWriter\n", | |
22 | "from IPython.nbformat import current" |
|
22 | "from IPython.nbformat import current\n", | |
|
23 | "from IPython.nbconvert.utils.exceptions import ConversionException" | |||
23 | ], |
|
24 | ], | |
24 | "language": "python", |
|
25 | "language": "python", | |
25 | "metadata": {}, |
|
26 | "metadata": {}, | |
@@ -151,7 +152,7 b'' | |||||
151 | " download_link.value = \"<br>Results: <a href='files/{filename}'><i>\\\"{filename}\\\"</i></a>\".format(filename=write_results)\n", |
|
152 | " download_link.value = \"<br>Results: <a href='files/{filename}'><i>\\\"{filename}\\\"</i></a>\".format(filename=write_results)\n", | |
152 | " download_link.visible = True\n", |
|
153 | " download_link.visible = True\n", | |
153 | " \n", |
|
154 | " \n", | |
154 | "def handle_export():\n", |
|
155 | "def handle_export(widget):\n", | |
155 | " with open(filename, 'r') as f:\n", |
|
156 | " with open(filename, 'r') as f:\n", | |
156 | " export(filename, current.read(f, 'json'))\n", |
|
157 | " export(filename, current.read(f, 'json'))\n", | |
157 | "export_button.on_click(handle_export)" |
|
158 | "export_button.on_click(handle_export)" | |
@@ -183,4 +184,4 b'' | |||||
183 | "metadata": {} |
|
184 | "metadata": {} | |
184 | } |
|
185 | } | |
185 | ] |
|
186 | ] | |
186 | } No newline at end of file |
|
187 | } |
General Comments 0
You need to be logged in to leave comments.
Login now