MCPcopy Index your code
hub / github.com/rawpython/remi / update

Method update

editor/widgets/toolbox_opencv.py:195–216  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

193 super(OpencvVideo, self).__del__()
194
195 def update(self, *args):
196 while not self.thread_stop_flag:
197 time.sleep(1.0/self.framerate)
198 if self.app_instance==None:
199 self.app_instance = self.search_app_instance(self)
200 if self.app_instance==None:
201 continue
202
203 with self.app_instance.update_lock:
204 self.app_instance.execute_javascript("""
205 var url = '/%(id)s/get_image_data?index=%(frame_index)s';
206 var xhr = new XMLHttpRequest();
207 xhr.open('GET', url, true);
208 xhr.responseType = 'blob'
209 xhr.onload = function(e){
210 var urlCreator = window.URL || window.webkitURL;
211 urlCreator.revokeObjectURL(document.getElementById('%(id)s').src);
212 var imageUrl = urlCreator.createObjectURL(this.response);
213 document.getElementById('%(id)s').src = imageUrl;
214 }
215 xhr.send();
216 """ % {'id': self.identifier, 'frame_index':str(time.time())})
217
218
219 def get_image_data(self, index=0):

Callers

nothing calls this directly

Calls 2

search_app_instanceMethod · 0.95
execute_javascriptMethod · 0.80

Tested by

no test coverage detected