MCPcopy
hub / github.com/yosinski/deep-visualization-toolbox / draw_help

Method draw_help

caffevis/app.py:628–670  ·  view source on GitHub ↗
(self, help_pane, locy)

Source from the content-addressed store, hash-verified

626 self.jpgvis_thread.debug_level = level
627
628 def draw_help(self, help_pane, locy):
629 defaults = {'face': getattr(cv2, self.settings.help_face),
630 'fsize': self.settings.help_fsize,
631 'clr': to_255(self.settings.help_clr),
632 'thick': self.settings.help_thick}
633 loc_base = self.settings.help_loc[::-1] # Reverse to OpenCV c,r order
634 locx = loc_base[0]
635
636 lines = []
637 lines.append([FormattedString('', defaults)])
638 lines.append([FormattedString('Caffevis keys', defaults)])
639
640 kl,_ = self.bindings.get_key_help('sel_left')
641 kr,_ = self.bindings.get_key_help('sel_right')
642 ku,_ = self.bindings.get_key_help('sel_up')
643 kd,_ = self.bindings.get_key_help('sel_down')
644 klf,_ = self.bindings.get_key_help('sel_left_fast')
645 krf,_ = self.bindings.get_key_help('sel_right_fast')
646 kuf,_ = self.bindings.get_key_help('sel_up_fast')
647 kdf,_ = self.bindings.get_key_help('sel_down_fast')
648
649 keys_nav_0 = ','.join([kk[0] for kk in (kl, kr, ku, kd)])
650 keys_nav_1 = ''
651 if len(kl)>1 and len(kr)>1 and len(ku)>1 and len(kd)>1:
652 keys_nav_1 += ' or '
653 keys_nav_1 += ','.join([kk[1] for kk in (kl, kr, ku, kd)])
654 keys_nav_f = ','.join([kk[0] for kk in (klf, krf, kuf, kdf)])
655 nav_string = 'Navigate with %s%s. Use %s to move faster.' % (keys_nav_0, keys_nav_1, keys_nav_f)
656 lines.append([FormattedString('', defaults, width=120, align='right'),
657 FormattedString(nav_string, defaults)])
658
659 for tag in ('sel_layer_left', 'sel_layer_right', 'zoom_mode', 'pattern_mode',
660 'ez_back_mode_loop', 'freeze_back_unit', 'show_back', 'back_mode', 'back_filt_mode',
661 'boost_gamma', 'boost_individual', 'reset_state'):
662 key_strings, help_string = self.bindings.get_key_help(tag)
663 label = '%10s:' % (','.join(key_strings))
664 lines.append([FormattedString(label, defaults, width=120, align='right'),
665 FormattedString(help_string, defaults)])
666
667 locy = cv2_typeset_text(help_pane.data, lines, (locx, locy),
668 line_spacing = self.settings.help_line_spacing)
669
670 return locy

Callers

nothing calls this directly

Calls 4

to_255Function · 0.90
FormattedStringClass · 0.90
cv2_typeset_textFunction · 0.90
get_key_helpMethod · 0.80

Tested by

no test coverage detected