Skip to content

Feature Request: readonly QTextEdit widget on MainWindow which displays Consoleo output (and possibly log same output to a log file) #85

@jngreene

Description

@jngreene

A window at the bottom of the Mainwindow showing the console output instead of or in addition too the sys.stdout
May be as simple as adding:
ui_mainwind.py

        self.consoleTextEdit = QtWidgets.QTextEdit(parent=MainWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushToListenHotkey.sizePolicy().hasHeightForWidth())
        self.textEditConsole.setSizePolicy(sizePolicy)
        self.textEditConsole.setMinimumSize(QtCore.QSize(180, 0))
        self.textEditConsole.setMaximumSize(QtCore.QSize(200, 16777215))
        self.textEditConsole.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
        self.textEditConsole.setReadOnly(True)
        self.textEditConsole.setPlainText(True)
        self.textEditConsole.setObjectName("consoleTextEdit")
        self.textEditConsole = QtWidgets.QTextEdit()
        self.horizontalLayout_5.addWidget(self.textEditConsole)
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.gridLayout_2.addLayout(self.horizontalLayout_5, 5, 0, -1, -1)

and then in the correct location define a function like:

consoleOutput(console_str):
    self.textEditConsole.append(str(console_str))
    return console_str

Then replace all of the print(str(ex)) with

print(consoleOutput(str(ex)))

Please double check everything first , this is my first attempt at actual widget programming in Python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions