fortrace.utility.console_applications.text_editor package
Submodules
fortrace.utility.console_applications.text_editor.nano module
- class fortrace.utility.console_applications.text_editor.nano.Nano(pty: REPLWrapper)[source]
Bases:
GenericConsoleTextEditorNano text editor.
- close()[source]
Close a console application.
Call this method to return to the command line. Sometimes it might be necessary to clean the buffer by calling self._pty.run_command(“clear”).
Notes
After a call to close refrain from using the object again
- go_to_line(line_num: int)[source]
Place the cursor in the specified line
- Parameters:
line_num – if line_num == -1 the cursor is placed at the end of the file
fortrace.utility.console_applications.text_editor.text_editor module
- class fortrace.utility.console_applications.text_editor.text_editor.GenericConsoleTextEditor(pty: REPLWrapper, name: str)[source]
Bases:
GenericConsoleApplicationRepresentation of generic console-based text editor.
- abstractmethod go_to_line(line_num: int)[source]
Place the cursor in the specified line
- Parameters:
line_num – if line_num == -1 the cursor is placed at the end of the file
fortrace.utility.console_applications.text_editor.text_editor_factory module
- fortrace.utility.console_applications.text_editor.text_editor_factory.get_console_text_editor(name: str, pty: REPLWrapper) GenericConsoleTextEditor[source]
Factory for console text editors.
- Parameters:
name – name of the text editor to be opened
pty – handle to terminal (NOT VirshConsole)
- Returns:
handle to opened text editor
fortrace.utility.console_applications.text_editor.vim module
- class fortrace.utility.console_applications.text_editor.vim.VIM(pty: REPLWrapper)[source]
Bases:
GenericConsoleTextEditorVIM text editor.
- change_mode(mode: VIMMode)[source]
Change VIM to the specified mode.
- Parameters:
mode – target mode
- close()[source]
Close a console application.
Call this method to return to the command line. Sometimes it might be necessary to clean the buffer by calling self._pty.run_command(“clear”).
Notes
After a call to close refrain from using the object again
- go_to_line(line_num: int)[source]
Go to a specific line.
VIM’s line indices start at 1. Place the cursor at the first column.
- Parameters:
line_num – line to set cursor to. If -1 set cursor at the end of the file. If line_num is larger than the real number of lines of a file, VIM will set the cursor to the last line as well.
- property mode
- replace(old: str, new: str, count: int = -1)[source]
Replace occurrence of pattern in file.
- Parameters:
old – pattern to be searched for
new – pattern to replace __old
count – maximum number of occurrences to replace. -1 (the default value) means to replace all occurrences.
- send_command(command: str)[source]
Enter a specified command in VIM’s normal mode.
- Enters VIM’s normal mode and enters the specified command. If possible use change_mode, since some commands do
not work with a RET appended, and this will be done automatically.
Notes
VIM will stay in normal mode after this method.
- Parameters:
command – command to be entered