Show More
@@ -38,6 +38,7 function(widget_manager, underscore, backbone){ | |||
|
38 | 38 | this.pending_msgs = 0; |
|
39 | 39 | this.msg_throttle = 3; |
|
40 | 40 | this.msg_buffer = null; |
|
41 | this.key_value_lock = null; | |
|
41 | 42 | this.id = model_id; |
|
42 | 43 | this.views = []; |
|
43 | 44 | |
@@ -89,18 +90,20 function(widget_manager, underscore, backbone){ | |||
|
89 | 90 | |
|
90 | 91 | // Handle when a widget is updated via the python side. |
|
91 | 92 | apply_update: function (state) { |
|
92 | this.updating = true; | |
|
93 | try { | |
|
93 | //this.updating = true; | |
|
94 | 94 |
|
|
95 | 95 |
|
|
96 | var value = state[key]; | |
|
97 | this.key_value_lock = [key, value]; | |
|
98 | try { | |
|
96 | 99 |
|
|
100 | } finally { | |
|
101 | this.key_value_lock = null; | |
|
102 | } | |
|
97 | 103 |
|
|
98 | 104 |
|
|
99 | 105 |
|
|
100 | 106 |
|
|
101 | } finally { | |
|
102 | this.updating = false; | |
|
103 | } | |
|
104 | 107 | }, |
|
105 | 108 | |
|
106 | 109 | |
@@ -131,7 +134,6 function(widget_manager, underscore, backbone){ | |||
|
131 | 134 | // Only send updated state if the state hasn't been changed |
|
132 | 135 | // during an update. |
|
133 | 136 | if (this.comm !== undefined) { |
|
134 | if (!this.updating) { | |
|
135 | 137 |
|
|
136 | 138 |
|
|
137 | 139 |
|
@@ -141,7 +143,10 function(widget_manager, underscore, backbone){ | |||
|
141 | 143 |
|
|
142 | 144 |
|
|
143 | 145 |
|
|
144 |
|
|
|
146 | var value = options.attrs[attr]; | |
|
147 | if (this.key_value_lock === null || attr != this.key_value_lock[0] || value != this.key_value_lock[1]) { | |
|
148 | this.msg_buffer[attr] = value; | |
|
149 | } | |
|
145 | 150 |
|
|
146 | 151 |
|
|
147 | 152 |
|
@@ -155,7 +160,10 function(widget_manager, underscore, backbone){ | |||
|
155 | 160 |
|
|
156 | 161 |
|
|
157 | 162 |
|
|
158 |
|
|
|
163 | var value = options.attrs[attr]; | |
|
164 | if (this.key_value_lock === null || attr != this.key_value_lock[0] || value != this.key_value_lock[1]) { | |
|
165 | send_json[attr] = value; | |
|
166 | } | |
|
159 | 167 |
|
|
160 | 168 |
|
|
161 | 169 | |
@@ -164,7 +172,6 function(widget_manager, underscore, backbone){ | |||
|
164 | 172 |
|
|
165 | 173 |
|
|
166 | 174 |
|
|
167 | } | |
|
168 | 175 | |
|
169 | 176 | // Since the comm is a one-way communication, assume the message |
|
170 | 177 | // arrived. |
General Comments 0
You need to be logged in to leave comments.
Login now