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

Method update

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

Source from the content-addressed store, hash-verified

87 return self.search_app_instance(node.get_parent())
88
89 def update(self, *args):
90 if self.app_instance==None:
91 self.app_instance = self.search_app_instance(self)
92 if self.app_instance==None:
93 self.attributes['src'] = "/%s/get_image_data?index=00"%self.identifier #gui.load_resource(self.filename)
94 return
95 self.app_instance.execute_javascript("""
96 url = '/%(id)s/get_image_data?index=%(frame_index)s';
97
98 xhr = null;
99 xhr = new XMLHttpRequest();
100 xhr.open('GET', url, true);
101 xhr.responseType = 'blob'
102 xhr.onload = function(e){
103 urlCreator = window.URL || window.webkitURL;
104 urlCreator.revokeObjectURL(document.getElementById('%(id)s').src);
105 imageUrl = urlCreator.createObjectURL(this.response);
106 document.getElementById('%(id)s').src = imageUrl;
107 }
108 xhr.send();
109 """ % {'id': self.identifier, 'frame_index':str(time.time())})
110
111 def get_image_data(self, index=0):
112 gui.Image.set_image(self, '/%(id)s/get_image_data?index=%(frame_index)s'% {'id': self.identifier, 'frame_index':str(time.time())})

Callers 11

set_image_dataMethod · 0.95
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
set_valueMethod · 0.45
__init__Method · 0.45
set_valueMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

search_app_instanceMethod · 0.95
execute_javascriptMethod · 0.80

Tested by

no test coverage detected