|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to show progress messages. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtCore import pyqtSlot |
|
11 from PyQt5.QtGui import QTextCursor |
|
12 from PyQt5.QtWidgets import QDialog |
|
13 |
|
14 from .Ui_MicroPythonProgressInfoDialog import Ui_MicroPythonProgressInfoDialog |
|
15 |
|
16 |
|
17 class MicroPythonProgressInfoDialog(QDialog, Ui_MicroPythonProgressInfoDialog): |
|
18 """ |
|
19 Class implementing a dialog to show progress messages. |
|
20 """ |
|
21 def __init__(self, parent=None): |
|
22 """ |
|
23 Constructor |
|
24 |
|
25 @param parent reference to the parent widget |
|
26 @type QWidget |
|
27 """ |
|
28 super().__init__(parent) |
|
29 self.setupUi(self) |
|
30 |
|
31 @pyqtSlot(str) |
|
32 def addMessage(self, message): |
|
33 """ |
|
34 Public slot to add a message to the progress display. |
|
35 |
|
36 @param message progress information to be shown |
|
37 @type str |
|
38 """ |
|
39 tc = self.progressEdit.textCursor() |
|
40 tc.movePosition(QTextCursor.MoveOperation.End) |
|
41 self.progressEdit.setTextCursor(tc) |
|
42 self.progressEdit.appendHtml(message) |
|
43 self.progressEdit.ensureCursorVisible() |