Show More
@@ -109,6 +109,18 b' class Widget(LoggingConfigurable):' | |||||
109 | if 'custom_content' in data: |
|
109 | if 'custom_content' in data: | |
110 | self._handle_custom_msg(data['custom_content']) |
|
110 | self._handle_custom_msg(data['custom_content']) | |
111 |
|
111 | |||
|
112 | ||||
|
113 | def _handle_recieve_state(self, sync_data): | |||
|
114 | """Called when a state is recieved from the frontend.""" | |||
|
115 | for name in self.keys: | |||
|
116 | if name in sync_data: | |||
|
117 | try: | |||
|
118 | self._property_lock = (name, sync_data[name]) | |||
|
119 | setattr(self, name, sync_data[name]) | |||
|
120 | finally: | |||
|
121 | self._property_lock = (None, None) | |||
|
122 | ||||
|
123 | ||||
112 | def _handle_custom_msg(self, content): |
|
124 | def _handle_custom_msg(self, content): | |
113 | """Called when a custom msg is recieved.""" |
|
125 | """Called when a custom msg is recieved.""" | |
114 | for handler in self._msg_callbacks: |
|
126 | for handler in self._msg_callbacks: | |
@@ -130,17 +142,6 b' class Widget(LoggingConfigurable):' | |||||
130 | 'accept 1 or 2 arguments, not %d.' % nargs) |
|
142 | 'accept 1 or 2 arguments, not %d.' % nargs) | |
131 |
|
143 | |||
132 |
|
144 | |||
133 | def _handle_recieve_state(self, sync_data): |
|
|||
134 | """Called when a state is recieved from the frontend.""" |
|
|||
135 | for name in self.keys: |
|
|||
136 | if name in sync_data: |
|
|||
137 | try: |
|
|||
138 | self._property_lock = (name, sync_data[name]) |
|
|||
139 | setattr(self, name, sync_data[name]) |
|
|||
140 | finally: |
|
|||
141 | self._property_lock = (None, None) |
|
|||
142 |
|
||||
143 |
|
||||
144 | def _handle_property_changed(self, name, old, new): |
|
145 | def _handle_property_changed(self, name, old, new): | |
145 | """Called when a property has been changed.""" |
|
146 | """Called when a property has been changed.""" | |
146 | # Make sure this isn't information that the front-end just sent us. |
|
147 | # Make sure this isn't information that the front-end just sent us. |
General Comments 0
You need to be logged in to leave comments.
Login now