From 17ae963cc63cade26aaee675129e2d73337ebfa7 2014-01-16 10:57:15 From: Jonathan Frederic Date: 2014-01-16 10:57:15 Subject: [PATCH] re-order handle custom msg and handle recieve state --- diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index c42f7e7..3ba8f00 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -109,6 +109,18 @@ class Widget(LoggingConfigurable): if 'custom_content' in data: self._handle_custom_msg(data['custom_content']) + + def _handle_recieve_state(self, sync_data): + """Called when a state is recieved from the frontend.""" + for name in self.keys: + if name in sync_data: + try: + self._property_lock = (name, sync_data[name]) + setattr(self, name, sync_data[name]) + finally: + self._property_lock = (None, None) + + def _handle_custom_msg(self, content): """Called when a custom msg is recieved.""" for handler in self._msg_callbacks: @@ -130,17 +142,6 @@ class Widget(LoggingConfigurable): 'accept 1 or 2 arguments, not %d.' % nargs) - def _handle_recieve_state(self, sync_data): - """Called when a state is recieved from the frontend.""" - for name in self.keys: - if name in sync_data: - try: - self._property_lock = (name, sync_data[name]) - setattr(self, name, sync_data[name]) - finally: - self._property_lock = (None, None) - - def _handle_property_changed(self, name, old, new): """Called when a property has been changed.""" # Make sure this isn't information that the front-end just sent us.