MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _display_main_menu

Method _display_main_menu

tensorflow/python/debug/cli/curses_ui.py:1183–1211  ·  view source on GitHub ↗

Display main menu associated with screen output, if the menu exists. Args: output: (debugger_cli_common.RichTextLines) The RichTextLines output from the annotations field of which the menu will be extracted and used (if the menu exists).

(self, output)

Source from the content-addressed store, hash-verified

1181 if 0 in self._nav_bar.font_attr_segs else None))
1182
1183 def _display_main_menu(self, output):
1184 """Display main menu associated with screen output, if the menu exists.
1185
1186 Args:
1187 output: (debugger_cli_common.RichTextLines) The RichTextLines output from
1188 the annotations field of which the menu will be extracted and used (if
1189 the menu exists).
1190 """
1191
1192 if debugger_cli_common.MAIN_MENU_KEY in output.annotations:
1193 self._main_menu = output.annotations[
1194 debugger_cli_common.MAIN_MENU_KEY].format_as_single_line(
1195 prefix="| ", divider=" | ", enabled_item_attrs=["underline"])
1196
1197 self._main_menu_pad = self._screen_new_output_pad(1, self._max_x - 2)
1198
1199 # The unwrapped menu line may exceed screen width, in which case it needs
1200 # to be cut off.
1201 wrapped_menu, _ = debugger_cli_common.wrap_rich_text_lines(
1202 self._main_menu, self._max_x - 3)
1203 self._screen_add_line_to_output_pad(
1204 self._main_menu_pad,
1205 0,
1206 wrapped_menu.lines[0],
1207 color_segments=(wrapped_menu.font_attr_segs[0]
1208 if 0 in wrapped_menu.font_attr_segs else None))
1209 else:
1210 self._main_menu = None
1211 self._main_menu_pad = None
1212
1213 def _pad_line_end_with_whitespace(self, pad, row, line_end_x):
1214 """Pad the whitespace at the end of a line with the default color pair.

Callers 2

_redraw_outputMethod · 0.95

Calls 3

format_as_single_lineMethod · 0.80

Tested by

no test coverage detected