Show More
@@ -82,8 +82,7 b'' | |||
|
82 | 82 | if (view === null) { |
|
83 | 83 | console.error("View creation failed", model); |
|
84 | 84 | } |
|
85 |
if (cell.widget_subarea |
|
|
86 | && cell.widget_subarea !== null) { | |
|
85 | if (cell.widget_subarea) { | |
|
87 | 86 | |
|
88 | 87 | cell.widget_area.show(); |
|
89 | 88 | cell.widget_subarea.append(view.$el); |
@@ -95,7 +94,7 b'' | |||
|
95 | 94 | // Creates a view for a particular model. |
|
96 | 95 | var view_name = model.get('_view_name'); |
|
97 | 96 | var ViewType = WidgetManager._view_types[view_name]; |
|
98 |
if (ViewType |
|
|
97 | if (ViewType) { | |
|
99 | 98 | |
|
100 | 99 | // If a view is passed into the method, use that view's cell as |
|
101 | 100 | // the cell for the view that is created. |
@@ -106,7 +105,7 b'' | |||
|
106 | 105 | |
|
107 | 106 | // Create and render the view... |
|
108 | 107 | var parameters = {model: model, options: options}; |
|
109 |
|
|
|
108 | view = new ViewType(parameters); | |
|
110 | 109 | view.render(); |
|
111 | 110 | model.views.push(view); |
|
112 | 111 | model.on('destroy', view.remove, view); |
@@ -123,33 +122,31 b'' | |||
|
123 | 122 | // If the view has a well defined element, inform the keyboard |
|
124 | 123 | // manager about the view's element, so as the element can |
|
125 | 124 | // escape the dreaded command mode. |
|
126 |
if (view.$el |
|
|
125 | if (view.$el) { | |
|
127 | 126 | IPython.keyboard_manager.register_events(view.$el); |
|
128 | 127 | } |
|
129 | } | |
|
128 | }; | |
|
130 | 129 | |
|
131 | 130 | WidgetManager.prototype.get_msg_cell = function (msg_id) { |
|
132 | 131 | var cell = null; |
|
133 | 132 | // First, check to see if the msg was triggered by cell execution. |
|
134 |
if (IPython.notebook |
|
|
133 | if (IPython.notebook) { | |
|
135 | 134 | cell = IPython.notebook.get_msg_cell(msg_id); |
|
136 | 135 | } |
|
137 | 136 | if (cell !== null) { |
|
138 | return cell | |
|
137 | return cell; | |
|
139 | 138 | } |
|
140 | 139 | // Second, check to see if a get_cell callback was defined |
|
141 | 140 | // for the message. get_cell callbacks are registered for |
|
142 | 141 | // widget messages, so this block is actually checking to see if the |
|
143 | 142 | // message was triggered by a widget. |
|
144 | 143 | var kernel = this.comm_manager.kernel; |
|
145 |
if (kernel |
|
|
144 | if (kernel) { | |
|
146 | 145 | var callbacks = kernel.get_callbacks_for_msg(msg_id); |
|
147 |
if (callbacks |
|
|
148 | callbacks.iopub !== undefined && | |
|
146 | if (callbacks && callbacks.iopub && | |
|
149 | 147 | callbacks.iopub.get_cell !== undefined) { |
|
150 | ||
|
151 | 148 | return callbacks.iopub.get_cell(); |
|
152 |
} |
|
|
149 | } | |
|
153 | 150 | } |
|
154 | 151 | |
|
155 | 152 | // Not triggered by a cell or widget (no get_cell callback |
@@ -160,16 +157,13 b'' | |||
|
160 | 157 | WidgetManager.prototype.callbacks = function (view) { |
|
161 | 158 | // callback handlers specific a view |
|
162 | 159 | var callbacks = {}; |
|
163 | if (view !== undefined && | |
|
164 | view !== null && | |
|
165 | view.options.cell !== undefined && | |
|
166 | view.options.cell !== null) { | |
|
160 | if (view && view.options.cell) { | |
|
167 | 161 | |
|
168 | 162 | // Try to get output handlers |
|
169 | 163 | var cell = view.options.cell; |
|
170 | 164 | var handle_output = null; |
|
171 | 165 | var handle_clear_output = null; |
|
172 |
if (cell.output_area |
|
|
166 | if (cell.output_area) { | |
|
173 | 167 | handle_output = $.proxy(cell.output_area.handle_output, cell.output_area); |
|
174 | 168 | handle_clear_output = $.proxy(cell.output_area.handle_clear_output, cell.output_area); |
|
175 | 169 | } |
General Comments 0
You need to be logged in to leave comments.
Login now