def __init__(self, ui, config, parent=None):
"""
Loads default configuration for console_log. A new thread is
spawned to which the interpreter is moved. This is done to
increase the responsiveness of the main user interface.
:param ui: used to access 'main.ui' methods
:param config: used to configure classes
"""
super(ConsoleProperty, self).__init__(parent)
self.ui = ui
self.config = config
# Document
self.ui.console_log.document().setMaximumBlockCount(
self.config["Console"]["Scrollback Buffer"]
)
self.ui.console_log.setWordWrapMode(QTextOption.WrapAnywhere)
# Console Input History
self.index = -1
self.length = 0
readline.set_history_length(50)
self.ui.console_input.installEventFilter(self)
try:
open(self.HISTORY_PATH, "x")
except FileExistsError:
readline.read_history_file(self.HISTORY_PATH)
self.length = readline.get_current_history_length()
# Display
self.display = PythonDisplay(self.ui, self.config, self)
评论列表
文章目录