aswi2021vochomurka-gitlab/aswi2021vochomurka/view/logger_view.py @ 177b96f0
1 |
import logging |
---|---|
2 |
|
3 |
from PyQt5.QtWidgets import QPlainTextEdit |
4 |
|
5 |
|
6 |
class LoggerView(logging.Handler): |
7 |
def __init__(self, parent): |
8 |
super().__init__() |
9 |
|
10 |
self.widget = QPlainTextEdit(parent) |
11 |
self.widget.setReadOnly(True) |
12 |
self.widget.setFixedHeight(120) |
13 |
|
14 |
def emit(self, record): |
15 |
msg = self.format(record) |
16 |
self.widget.insertPlainText(msg + '\n') |
17 |
self.widget.verticalScrollBar().setValue(self.widget.verticalScrollBar().maximum()) |
18 |
pass
|
19 |
|
20 |
def write(self, m): |
21 |
pass
|