(self, tlsData, parent=None)
| 199 | |
| 200 | class CertificateDialog(QtWidgets.QDialog): |
| 201 | def __init__(self, tlsData, parent=None): |
| 202 | super(CertificateDialog, self).__init__(parent) |
| 203 | if isMacOS(): |
| 204 | self.setWindowTitle("") |
| 205 | self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint | Qt.WindowCloseButtonHint | Qt.CustomizeWindowHint) |
| 206 | else: |
| 207 | self.setWindowTitle(getMessage("tls-information-title")) |
| 208 | if isWindows(): |
| 209 | self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) |
| 210 | self.setWindowIcon(QtGui.QPixmap(resourcespath + 'syncplay.png')) |
| 211 | statusLabel = QtWidgets.QLabel(getMessage("tls-dialog-status-label").format(tlsData["subject"])) |
| 212 | descLabel = QtWidgets.QLabel(getMessage("tls-dialog-desc-label").format(tlsData["subject"])) |
| 213 | connDataLabel = QtWidgets.QLabel(getMessage("tls-dialog-connection-label").format(tlsData["protocolVersion"], tlsData["cipher"])) |
| 214 | certDataLabel = QtWidgets.QLabel(getMessage("tls-dialog-certificate-label").format(tlsData["issuer"], tlsData["expires"])) |
| 215 | if isMacOS(): |
| 216 | statusLabel.setFont(QtGui.QFont("Helvetica", 12)) |
| 217 | descLabel.setFont(QtGui.QFont("Helvetica", 12)) |
| 218 | connDataLabel.setFont(QtGui.QFont("Helvetica", 12)) |
| 219 | certDataLabel.setFont(QtGui.QFont("Helvetica", 12)) |
| 220 | lockIcon = QtGui.QIcon() |
| 221 | lockIcon.addFile(resourcespath + "lock_green_dialog.png") |
| 222 | lockIconLabel = QtWidgets.QLabel() |
| 223 | lockIconLabel.setPixmap(lockIcon.pixmap(64, 64)) |
| 224 | certLayout = QtWidgets.QGridLayout() |
| 225 | certLayout.addWidget(lockIconLabel, 1, 0, 3, 1, Qt.AlignLeft | Qt.AlignTop) |
| 226 | certLayout.addWidget(statusLabel, 0, 1, 1, 3) |
| 227 | certLayout.addWidget(descLabel, 1, 1, 1, 3) |
| 228 | certLayout.addWidget(connDataLabel, 2, 1, 1, 3) |
| 229 | certLayout.addWidget(certDataLabel, 3, 1, 1, 3) |
| 230 | closeButton = QtWidgets.QPushButton("Close") |
| 231 | closeButton.setFixedWidth(100) |
| 232 | closeButton.setAutoDefault(False) |
| 233 | closeButton.clicked.connect(self.closeDialog) |
| 234 | certLayout.addWidget(closeButton, 4, 3, 1, 1) |
| 235 | certLayout.setVerticalSpacing(10) |
| 236 | certLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) |
| 237 | self.setSizeGripEnabled(False) |
| 238 | self.setLayout(certLayout) |
| 239 | |
| 240 | def closeDialog(self): |
| 241 | self.close() |
nothing calls this directly
no test coverage detected