##// END OF EJS Templates
Backport parts of ipywidgets#3
Sylvain Corlay -
Show More
@@ -24,6 +24,7 b' define(["widgets/js/manager",'
24 * An ID unique to this model.
24 * An ID unique to this model.
25 * comm : Comm instance (optional)
25 * comm : Comm instance (optional)
26 */
26 */
27 WidgetModel.__super__.constructor.apply(this);
27 this.widget_manager = widget_manager;
28 this.widget_manager = widget_manager;
28 this.state_change = Promise.resolve();
29 this.state_change = Promise.resolve();
29 this._buffered_state_diff = {};
30 this._buffered_state_diff = {};
@@ -32,6 +33,13 b' define(["widgets/js/manager",'
32 this.state_lock = null;
33 this.state_lock = null;
33 this.id = model_id;
34 this.id = model_id;
34 this.views = {};
35 this.views = {};
36
37 // Force backbone to think that the model has already been
38 // synced with the server. As of backbone 1.1, backbone
39 // ignores `patch` if it thinks the model has never been
40 // pushed.
41 this.isNew = function() { return false; };
42
35 this._resolve_received_state = {};
43 this._resolve_received_state = {};
36
44
37 if (comm !== undefined) {
45 if (comm !== undefined) {
@@ -115,7 +115,7 b' casper.notebook_test(function () {'
115 var multiset = {};
115 var multiset = {};
116 multiset.index = this.append_cell(
116 multiset.index = this.append_cell(
117 'from IPython.utils.traitlets import Unicode, CInt\n' +
117 'from IPython.utils.traitlets import Unicode, CInt\n' +
118 'class MultiSetWidget(widgets.Widget):\n' +
118 'class MultiSetWidget(widgets.DOMWidget):\n' +
119 ' _view_name = Unicode("MultiSetView", sync=True)\n' +
119 ' _view_name = Unicode("MultiSetView", sync=True)\n' +
120 ' a = CInt(0, sync=True)\n' +
120 ' a = CInt(0, sync=True)\n' +
121 ' b = CInt(0, sync=True)\n' +
121 ' b = CInt(0, sync=True)\n' +
General Comments 0
You need to be logged in to leave comments. Login now