eric6/E5Network/E5SslInfoWidget.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7945
76daafe10009
child 8043
0acf98cd089a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
7 Module implementing a widget to show SSL information.
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
10 from PyQt5.QtCore import Qt, QUrl, QPoint
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
11 from PyQt5.QtWidgets import QMenu, QGridLayout, QLabel, QSizePolicy
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtNetwork import QSsl, QSslConfiguration, QSslCertificate
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
14 import UI.PixmapCache
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import Utilities
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
18 class E5SslInfoWidget(QMenu):
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 Class implementing a widget to show SSL certificate infos.
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
22 def __init__(self, url, configuration, parent=None):
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Constructor
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
26 @param url URL to show SSL info for (QUrl)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
27 @param configuration SSL configuration (QSslConfiguration)
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param parent reference to the parent widget (QWidget)
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2432
diff changeset
30 super(E5SslInfoWidget, self).__init__(parent)
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
32 self.__url = QUrl(url)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
33 self.__configuration = QSslConfiguration(configuration)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
34
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
35 self.setMinimumWidth(400)
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
37 certList = self.__configuration.peerCertificateChain()
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
38 if certList:
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
39 cert = certList[0]
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
40 else:
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
41 cert = QSslCertificate()
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
42
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
43 layout = QGridLayout(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
44 rows = 0
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
46 ##########################################
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
47 ## Identity Information
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
48 ##########################################
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
49 imageLabel = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
50 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
51
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
52 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
53 label.setWordWrap(True)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
54 label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
55 label.setText(self.tr("Identity"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
56 font = label.font()
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
57 font.setBold(True)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
58 label.setFont(font)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
59 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
60 rows += 1
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
61
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
62 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
63 label.setWordWrap(True)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
64 if cert.isNull():
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
65 label.setText(self.tr(
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
66 "Warning: this site is NOT carrying a certificate."))
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
67 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32"))
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 else:
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
69 valid = not cert.isBlacklisted()
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
70 if valid:
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
71 txt = ", ".join(
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
72 cert.issuerInfo(QSslCertificate.CommonName))
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
73 label.setText(self.tr(
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
74 "The certificate for this site is valid"
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
75 " and has been verified by:\n{0}").format(
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
76 Utilities.decodeString(txt)))
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
77 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
78 UI.PixmapCache.getPixmap("securityHigh32"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
79 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
80 label.setText(self.tr(
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
81 "The certificate for this site is NOT valid."))
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
82 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
83 UI.PixmapCache.getPixmap("securityLow32"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
84 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
85 rows += 1
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
86
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
87 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
88 label.setWordWrap(True)
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2990
diff changeset
89 label.setText(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2990
diff changeset
90 '<a href="moresslinfos">' +
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
91 self.tr("Certificate Information") + "</a>")
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
92 label.linkActivated.connect(self.__showCertificateInfos)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
93 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
94 rows += 1
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
95
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
96 ##########################################
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
97 ## Identity Information
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
98 ##########################################
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
99 imageLabel = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
100 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
101
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
102 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
103 label.setWordWrap(True)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
104 label.setText(self.tr("Encryption"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
105 font = label.font()
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
106 font.setBold(True)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
107 label.setFont(font)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
108 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
109 rows += 1
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
111 cipher = self.__configuration.sessionCipher()
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
112 if cipher.isNull():
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
113 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
114 label.setWordWrap(True)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
115 label.setText(self.tr(
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
116 'Your connection to "{0}" is NOT encrypted.\n').format(
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
117 self.__url.host()))
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
118 layout.addWidget(label, rows, 1)
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
119 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
120 rows += 1
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
121 else:
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
122 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
123 label.setWordWrap(True)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
124 label.setText(self.tr(
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
125 'Your connection to "{0}" is encrypted.').format(
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
126 self.__url.host()))
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
127 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
128
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
129 proto = cipher.protocol()
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
130 if proto == QSsl.SslV3:
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
131 sslVersion = "SSL 3.0"
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
132 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
133 UI.PixmapCache.getPixmap("securityLow32"))
3776
ccb6eacb50e5 Started adding code to make eric6 usable with PyQt5 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
134 elif proto == QSsl.TlsV1SslV3:
ccb6eacb50e5 Started adding code to make eric6 usable with PyQt5 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
135 sslVersion = "TLS 1.0/SSL 3.0"
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
136 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
137 UI.PixmapCache.getPixmap("securityLow32"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
138 elif proto == QSsl.SslV2:
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
139 sslVersion = "SSL 2.0"
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
140 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
141 UI.PixmapCache.getPixmap("securityLow32"))
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
143 sslVersion = self.tr("unknown")
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
144 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
145 UI.PixmapCache.getPixmap("securityLow32"))
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
146 if proto == QSsl.TlsV1_0:
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
147 sslVersion = "TLS 1.0"
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
148 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
149 UI.PixmapCache.getPixmap("securityHigh32"))
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
150 elif proto == QSsl.TlsV1_1:
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
151 sslVersion = "TLS 1.1"
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
152 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
153 UI.PixmapCache.getPixmap("securityHigh32"))
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
154 elif proto == QSsl.TlsV1_2:
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
155 sslVersion = "TLS 1.2"
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
156 imageLabel.setPixmap(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
157 UI.PixmapCache.getPixmap("securityHigh32"))
7945
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
158 elif proto == QSsl.TlsV1_3:
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
159 sslVersion = "TLS 1.3"
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
160 imageLabel.setPixmap(
76daafe10009 Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
161 UI.PixmapCache.getPixmap("securityHigh32"))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
162 rows += 1
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
163
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
164 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
165 label.setWordWrap(True)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
166 label.setText(self.tr(
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
167 "It uses protocol: {0}").format(sslVersion))
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
168 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
169 rows += 1
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
170
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
171 label = QLabel(self)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
172 label.setWordWrap(True)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
173 label.setText(self.tr(
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
174 "It is encrypted using {0} at {1} bits, "
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
175 "with {2} for message authentication and "
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
176 "{3} as key exchange mechanism.\n\n").format(
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
177 cipher.encryptionMethod(),
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
178 cipher.usedBits(),
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
179 cipher.authenticationMethod(),
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
180 cipher.keyExchangeMethod()))
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
181 layout.addWidget(label, rows, 1)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
182 rows += 1
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
184 def showAt(self, pos):
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
186 Public method to show the widget.
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
188 @param pos position to show at (QPoint)
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
190 self.adjustSize()
2666
a9d0feafa87b Fixed an issue in E5SslInfoWidget causing it to be displayed incomplete or off-screen, if the browser is at the left side of the screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
191 xpos = pos.x() - self.width()
a9d0feafa87b Fixed an issue in E5SslInfoWidget causing it to be displayed incomplete or off-screen, if the browser is at the left side of the screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
192 if xpos < 0:
a9d0feafa87b Fixed an issue in E5SslInfoWidget causing it to be displayed incomplete or off-screen, if the browser is at the left side of the screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
193 xpos = 10
a9d0feafa87b Fixed an issue in E5SslInfoWidget causing it to be displayed incomplete or off-screen, if the browser is at the left side of the screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
194 p = QPoint(xpos, pos.y() + 10)
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
195 self.move(p)
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
196 self.show()
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
198 def __showCertificateInfos(self):
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
200 Private slot to show certificate information.
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
202 from .E5SslCertificatesInfoDialog import E5SslCertificatesInfoDialog
2990
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
203 dlg = E5SslCertificatesInfoDialog(
583beaf0b4b8 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2666
diff changeset
204 self.__configuration.peerCertificateChain())
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
205 dlg.exec()
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
207 def accept(self):
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
209 Public method to accept the widget.
2359
ef81d2d0a031 Moved the SSL widgets to the E5Network package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 """
2432
b1a2f9054b28 Reworked the various SSL info widgets of the web browser to show more info.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2359
diff changeset
211 self.close()

eric ide

mercurial