##// END OF EJS Templates
Address @minrk 's review comments.
Jonathan Frederic -
Show More
@@ -76,7 +76,7 b' define(["widgets/js/manager",'
76 this.set_state(msg.content.data.state);
76 this.set_state(msg.content.data.state);
77 if (this.init_state_callback) {
77 if (this.init_state_callback) {
78 this.init_state_callback.apply(this, [this]);
78 this.init_state_callback.apply(this, [this]);
79 this.init_state_callback = null;
79 delete this.init_state_callback;
80 }
80 }
81 break;
81 break;
82 case 'custom':
82 case 'custom':
@@ -102,7 +102,7 b' class Widget(LoggingConfigurable):'
102 target_name = msg['content']['data']['target_name']
102 target_name = msg['content']['data']['target_name']
103 widget_class = import_item(target_name)
103 widget_class = import_item(target_name)
104 widget = widget_class(open_comm=False)
104 widget = widget_class(open_comm=False)
105 widget.set_comm(comm)
105 widget.comm = comm
106
106
107
107
108 #-------------------------------------------------------------------------
108 #-------------------------------------------------------------------------
@@ -160,11 +160,11 b' class Widget(LoggingConfigurable):'
160 'model_module': self._model_module})
160 'model_module': self._model_module})
161 if self._model_id is not None:
161 if self._model_id is not None:
162 args['comm_id'] = self._model_id
162 args['comm_id'] = self._model_id
163 self.set_comm(Comm(**args))
163 self.comm = Comm(**args)
164
164
165 def set_comm(self, comm):
165 def _comm_changed(self, name, new):
166 """Set's the comm of the widget."""
166 """Called when the comm is changed."""
167 self.comm = comm
167 self.comm = new
168 self._model_id = self.model_id
168 self._model_id = self.model_id
169
169
170 self.comm.on_msg(self._handle_msg)
170 self.comm.on_msg(self._handle_msg)
@@ -173,7 +173,6 b' class Widget(LoggingConfigurable):'
173 # first update
173 # first update
174 self.send_state()
174 self.send_state()
175
175
176
177 @property
176 @property
178 def model_id(self):
177 def model_id(self):
179 """Gets the model id of this widget.
178 """Gets the model id of this widget.
General Comments 0
You need to be logged in to leave comments. Login now