diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-12-20 08:35:46 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-01-06 15:44:37 +0100 |
| commit | 76337a15b48ae189ee244fe1475a6203d396eeae (patch) | |
| tree | 6aa736fd136b419fe9c3a6078295efb0d25de0fa /examples/network/blockingfortuneclient/blockingfortuneclient.py | |
| parent | 2156c0be5308ee9a8624769f6e949ce97df4be79 (diff) | |
Use fully qualified enumerations in more examples, round 2
Complements 7189a4c5ec193d30c6bd4e68701038880cbc5982.
Pick-to: 6.8
Task-number: PYSIDE-1735
Change-Id: Ifbfd48e953e74c18c02fbe075ad51dfeb56b97c9
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/network/blockingfortuneclient/blockingfortuneclient.py')
| -rw-r--r-- | examples/network/blockingfortuneclient/blockingfortuneclient.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.py b/examples/network/blockingfortuneclient/blockingfortuneclient.py index f29cfe25b..73476d473 100644 --- a/examples/network/blockingfortuneclient/blockingfortuneclient.py +++ b/examples/network/blockingfortuneclient/blockingfortuneclient.py @@ -96,10 +96,11 @@ class BlockingClient(QWidget): port_label = QLabel("S&erver port:") for ip_address in QNetworkInterface.allAddresses(): - if ip_address != QHostAddress.LocalHost and ip_address.toIPv4Address() != 0: + if (ip_address != QHostAddress.SpecialAddress.LocalHost + and ip_address.toIPv4Address() != 0): break else: - ip_address = QHostAddress(QHostAddress.LocalHost) + ip_address = QHostAddress(QHostAddress.SpecialAddress.LocalHost) ip_address = ip_address.toString() @@ -121,8 +122,8 @@ class BlockingClient(QWidget): quit_button = QPushButton("Quit") button_box = QDialogButtonBox() - button_box.addButton(self._get_fortune_button, QDialogButtonBox.ActionRole) - button_box.addButton(quit_button, QDialogButtonBox.RejectRole) + button_box.addButton(self._get_fortune_button, QDialogButtonBox.ButtonRole.ActionRole) + button_box.addButton(quit_button, QDialogButtonBox.ButtonRole.RejectRole) self._get_fortune_button.clicked.connect(self.request_new_fortune) quit_button.clicked.connect(self.close) @@ -158,11 +159,11 @@ class BlockingClient(QWidget): self._get_fortune_button.setEnabled(True) def display_error(self, socketError, message): - if socketError == QAbstractSocket.HostNotFoundError: + if socketError == QAbstractSocket.SocketError.HostNotFoundError: QMessageBox.information(self, "Blocking Fortune Client", "The host was not found. Please check the host and port " "settings.") - elif socketError == QAbstractSocket.ConnectionRefusedError: + elif socketError == QAbstractSocket.SocketError.ConnectionRefusedError: QMessageBox.information(self, "Blocking Fortune Client", "The connection was refused by the peer. Make sure the " "fortune server is running, and check that the host name " |
