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

Method __init__

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

Constructor of CursesUI. Args: on_ui_exit: (Callable) Callback invoked when the UI exits. config: An instance of `cli_config.CLIConfig()` carrying user-facing configurations.

(self, on_ui_exit=None, config=None)

Source from the content-addressed store, hash-verified

276 _single_instance_lock = threading.Lock()
277
278 def __init__(self, on_ui_exit=None, config=None):
279 """Constructor of CursesUI.
280
281 Args:
282 on_ui_exit: (Callable) Callback invoked when the UI exits.
283 config: An instance of `cli_config.CLIConfig()` carrying user-facing
284 configurations.
285 """
286
287 base_ui.BaseUI.__init__(self, on_ui_exit=on_ui_exit, config=config)
288
289 self._screen_init()
290 self._screen_refresh_size()
291 # TODO(cais): Error out if the size of the screen is too small.
292
293 # Initialize some UI component size and locations.
294 self._init_layout()
295
296 self._command_history_store = debugger_cli_common.CommandHistory()
297
298 # Active list of command history, used in history navigation.
299 # _command_handler_registry holds all the history commands the CLI has
300 # received, up to a size limit. _active_command_history is the history
301 # currently being navigated in, e.g., using the Up/Down keys. The latter
302 # can be different from the former during prefixed or regex-based history
303 # navigation, e.g., when user enter the beginning of a command and hit Up.
304 self._active_command_history = []
305
306 # Pointer to the current position in the history sequence.
307 # 0 means it is a new command being keyed in.
308 self._command_pointer = 0
309
310 self._command_history_limit = 100
311
312 self._pending_command = ""
313
314 self._nav_history = curses_widgets.CursesNavigationHistory(10)
315
316 # State related to screen output.
317 self._output_pad = None
318 self._output_pad_row = 0
319 self._output_array_pointer_indices = None
320 self._curr_unwrapped_output = None
321 self._curr_wrapped_output = None
322
323 try:
324 # Register signal handler for SIGINT.
325 signal.signal(signal.SIGINT, self._interrupt_handler)
326 except ValueError:
327 # Running in a child thread, can't catch signals.
328 pass
329
330 self.register_command_handler(
331 "mouse",
332 self._mouse_mode_command_handler,
333 "Get or set the mouse mode of this CLI: (on|off)",
334 prefix_aliases=["m"])
335

Callers

nothing calls this directly

Calls 4

_screen_initMethod · 0.95
_screen_refresh_sizeMethod · 0.95
_init_layoutMethod · 0.95

Tested by

no test coverage detected