re-order handle custom msg and handle recieve state

This commit is contained in:
Jonathan Frederic 2014-01-07 16:19:16 -08:00 committed by Jonathan Frederic
parent 3254f338bb
commit 261e92de74

View File

@ -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.