##// END OF EJS Templates
Merge pull request #6665 from jdfreder/travis_please_run_on_this...
Min RK -
r18273:e1cad3d0 merge
parent child Browse files
Show More
@@ -21,11 +21,8 b' define(['
21 21 this.comm_manager = comm_manager;
22 22 this._models = {}; /* Dictionary of model ids and model instances */
23 23
24 // Register already-registered widget model types with the comm manager.
25 var that = this;
26 _.each(WidgetManager._model_types, function(model_type, model_name) {
27 that.comm_manager.register_target(model_name, $.proxy(that._handle_comm_open, that));
28 });
24 // Register with the comm manager.
25 this.comm_manager.register_target('ipython.widget', $.proxy(this._handle_comm_open, this));
29 26 };
30 27
31 28 //--------------------------------------------------------------------
@@ -38,14 +35,6 b' define(['
38 35 WidgetManager.register_widget_model = function (model_name, model_type) {
39 36 // Registers a widget model by name.
40 37 WidgetManager._model_types[model_name] = model_type;
41
42 // Register the widget with the comm manager. Make sure to pass this object's context
43 // in so `this` works in the call back.
44 _.each(WidgetManager._managers, function(instance, i) {
45 if (instance.comm_manager !== null) {
46 instance.comm_manager.register_target(model_name, $.proxy(instance._handle_comm_open, instance));
47 }
48 });
49 38 };
50 39
51 40 WidgetManager.register_widget_view = function (view_name, view_type) {
@@ -186,7 +175,7 b' define(['
186 175 // Handle when a comm is opened.
187 176 var that = this;
188 177 var model_id = comm.comm_id;
189 var widget_type_name = msg.content.target_name;
178 var widget_type_name = msg.content.data.model_name;
190 179 var widget_model = new WidgetManager._model_types[widget_type_name](this, model_id, comm);
191 180 widget_model.on('comm:close', function () {
192 181 delete that._models[model_id];
@@ -139,11 +139,12 b' class Widget(LoggingConfigurable):'
139 139 def open(self):
140 140 """Open a comm to the frontend if one isn't already open."""
141 141 if self.comm is None:
142 if self._model_id is None:
143 self.comm = Comm(target_name=self._model_name)
144 self._model_id = self.model_id
145 else:
146 self.comm = Comm(target_name=self._model_name, comm_id=self._model_id)
142 args = dict(target_name='ipython.widget', data={ 'model_name': self._model_name })
143 if self._model_id is not None:
144 args['comm_id'] = self._model_id
145 self.comm = Comm(**args)
146 self._model_id = self.model_id
147
147 148 self.comm.on_msg(self._handle_msg)
148 149 Widget.widgets[self.model_id] = self
149 150
General Comments 0
You need to be logged in to leave comments. Login now