MCPcopy Create free account
hub / github.com/Relento/lego_release / _print_frames

Method _print_frames

tu/loggers/html_table.py:205–234  ·  view source on GitHub ↗
(self, row_identifier, column, objs, classname)

Source from the content-addressed store, hash-verified

203 self._print(*args, **kwargs)
204
205 def _print_frames(self, row_identifier, column, objs, classname):
206 self._print('<div class="{}" style="text-align:center;">'.format(classname))
207 objs = deepcopy(objs)
208 type = 'text'
209 has_info = False
210 for i, obj in enumerate(objs):
211 if 'image' in obj:
212 obj['image'] = self.canonize_link('image', obj['image'], row_identifier,
213 column.identifier + '_' + str(i))
214 type = 'image'
215 else:
216 assert 'text' in obj
217
218 if 'info' in obj:
219 has_info = True
220 if type == 'text':
221 self._print(' <pre class="text">{}</pre>'.format(objs[0]['text']))
222 else:
223 self._print(' <img class="image" src="{}" alt="{}" />'.format(*objs[0]['image']))
224
225 if has_info:
226 self._print(' <pre class="info">{}</pre>'.format('Frame #0 :: ' + objs[0]['info']))
227 else:
228 self._print(' <pre class="info">{}</pre>'.format('Frame #0'))
229
230 self._print(' <button class="button prev" onclick="frameMove(this, -1)">Prev</button>')
231 self._print(' <button class="button next" onclick="frameMove(this, +1)">Next</button>')
232 self._print(' <input class="index" type="hidden" value="0" />')
233 self._print(' <pre class="data" style="display:none">{}</pre>'.format(json.dumps(objs)))
234 self._print('</div>')
235
236 def _flush(self):
237 self._index_file.flush()

Callers 1

rowMethod · 0.95

Calls 2

_printMethod · 0.95
canonize_linkMethod · 0.95

Tested by

no test coverage detected