|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to show the versions of various components. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtGui import QGuiApplication |
|
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
|
12 |
|
13 from .Ui_VersionsDialog import Ui_VersionsDialog |
|
14 |
|
15 |
|
16 class VersionsDialog(QDialog, Ui_VersionsDialog): |
|
17 """ |
|
18 Class implementing a dialog to show the versions of various components. |
|
19 """ |
|
20 def __init__(self, parent, title, text): |
|
21 """ |
|
22 Constructor |
|
23 |
|
24 @param parent reference to the parent widget |
|
25 @type UserInterface |
|
26 @param title dialog title |
|
27 @type str |
|
28 @param text versions text to be shown |
|
29 @type str |
|
30 """ |
|
31 super().__init__(parent) |
|
32 self.setupUi(self) |
|
33 |
|
34 self.__ui = parent |
|
35 icon = QGuiApplication.windowIcon().pixmap(64, 64) |
|
36 |
|
37 self.setWindowTitle(title) |
|
38 self.iconLabel.setPixmap(icon) |
|
39 self.textLabel.setText(text) |
|
40 |
|
41 self.__upgradePyQtButton = self.buttonBox.addButton( |
|
42 self.tr("Upgrade PyQt..."), QDialogButtonBox.ButtonRole.ActionRole |
|
43 ) |
|
44 self.__upgradePyQtButton.clicked.connect(parent.upgradePyQt) |
|
45 |
|
46 msh = self.minimumSizeHint() |
|
47 self.resize(max(self.width(), msh.width()), msh.height()) |
|
48 |
|
49 self.exec() |