termwidget — Terminal emulator widget

Shows intput and output text. Allows to enter commands. Supports history.

This widget only provides GUI, but does not implement any system terminal or other functionality

class enki.widgets.termwidget.TermWidget(font, *args)

Bases: QWidget

Widget wich represents terminal. It only displays text and allows to enter text. All highlevel logic should be implemented by client classes

terminate()
eventFilter(obj, event)
setLanguage(language)

Set highlighting language for input widget

execCommand(text)

Save current command in the history. Append it to the log. Execute child’s method. Clear edit line.

childExecCommand(text)

Reimplement in the child classes to execute enterred commands

appendOutput(text)

Appent text to output widget

appendError(text)

Appent error text to output widget. Text is drawn with red background

appendHint(text)

Appent error text to output widget. Text is drawn with red background

clear()

Clear the widget

isCommandComplete(text)

Executed when Enter is pressed to check if widget should execute the command, or insert newline.

Implement this function in the child classes.