Show More
@@ -187,7 +187,7 define([ | |||||
187 |
|
187 | |||
188 | WidgetManager.prototype._handle_comm_open = function (comm, msg) { |
|
188 | WidgetManager.prototype._handle_comm_open = function (comm, msg) { | |
189 | // Handle when a comm is opened. |
|
189 | // Handle when a comm is opened. | |
190 |
return this._create_model({model_name: msg.content.data. |
|
190 | return this._create_model({model_name: msg.content.data.model_name, comm: comm}); | |
191 | }; |
|
191 | }; | |
192 |
|
192 | |||
193 | WidgetManager.prototype.create_model = function (model_name, target_name, init_state_callback) { |
|
193 | WidgetManager.prototype.create_model = function (model_name, target_name, init_state_callback) { |
@@ -142,7 +142,7 class Widget(LoggingConfigurable): | |||||
142 |
|
142 | |||
143 | Widget._call_widget_constructed(self) |
|
143 | Widget._call_widget_constructed(self) | |
144 | if open_comm: |
|
144 | if open_comm: | |
145 | self.open() |
|
145 | self.open() | |
146 |
|
146 | |||
147 | def __del__(self): |
|
147 | def __del__(self): | |
148 | """Object disposal""" |
|
148 | """Object disposal""" | |
@@ -165,11 +165,11 class Widget(LoggingConfigurable): | |||||
165 | def set_comm(self, comm): |
|
165 | def set_comm(self, comm): | |
166 | """Set's the comm of the widget.""" |
|
166 | """Set's the comm of the widget.""" | |
167 | self.comm = comm |
|
167 | self.comm = comm | |
168 |
|
|
168 | self._model_id = self.model_id | |
169 |
|
|
169 | ||
170 |
|
|
170 | self.comm.on_msg(self._handle_msg) | |
171 |
|
|
171 | Widget.widgets[self.model_id] = self | |
172 |
|
|
172 | ||
173 | # first update |
|
173 | # first update | |
174 | self.send_state() |
|
174 | self.send_state() | |
175 |
|
175 | |||
@@ -359,8 +359,8 class Widget(LoggingConfigurable): | |||||
359 | if self.comm is not None and name in self.keys: |
|
359 | if self.comm is not None and name in self.keys: | |
360 | # Make sure this isn't information that the front-end just sent us. |
|
360 | # Make sure this isn't information that the front-end just sent us. | |
361 | if self._should_send_property(name, new_value): |
|
361 | if self._should_send_property(name, new_value): | |
362 | # Send new state to front-end |
|
362 | # Send new state to front-end | |
363 | self.send_state(key=name) |
|
363 | self.send_state(key=name) | |
364 |
|
364 | |||
365 | def _handle_displayed(self, **kwargs): |
|
365 | def _handle_displayed(self, **kwargs): | |
366 | """Called when a view has been displayed for this widget instance""" |
|
366 | """Called when a view has been displayed for this widget instance""" |
General Comments 0
You need to be logged in to leave comments.
Login now