aboutsummaryrefslogtreecommitdiffstats
path: root/examples/network/blockingfortuneclient/blockingfortuneclient.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/blockingfortuneclient/blockingfortuneclient.py')
-rw-r--r--examples/network/blockingfortuneclient/blockingfortuneclient.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.py b/examples/network/blockingfortuneclient/blockingfortuneclient.py
index f467cf8d4..d0dd7e0ad 100644
--- a/examples/network/blockingfortuneclient/blockingfortuneclient.py
+++ b/examples/network/blockingfortuneclient/blockingfortuneclient.py
@@ -5,12 +5,13 @@
"""PySide6 port of the network/blockingfortunclient example from Qt v5.x, originating from PyQt"""
from PySide6.QtCore import (Signal, QDataStream, QMutex, QMutexLocker,
- QThread, QWaitCondition)
+ QThread, QWaitCondition)
from PySide6.QtGui import QIntValidator
from PySide6.QtWidgets import (QApplication, QDialogButtonBox, QGridLayout,
- QLabel, QLineEdit, QMessageBox, QPushButton, QWidget)
+ QLabel, QLineEdit, QMessageBox, QPushButton,
+ QWidget)
from PySide6.QtNetwork import (QAbstractSocket, QHostAddress, QNetworkInterface,
- QTcpSocket)
+ QTcpSocket)
class FortuneThread(QThread):
@@ -109,7 +110,7 @@ class BlockingClient(QWidget):
port_label.setBuddy(self._port_line_edit)
self._status_label = QLabel(
- "This example requires that you run the Fortune Server example as well.")
+ "This example requires that you run the Fortune Server example as well.")
self._status_label.setWordWrap(True)
self._get_fortune_button = QPushButton("Get Fortune")
@@ -144,7 +145,7 @@ class BlockingClient(QWidget):
def request_new_fortune(self):
self._get_fortune_button.setEnabled(False)
self.thread.request_new_fortune(self._host_line_edit.text(),
- int(self._port_line_edit.text()))
+ int(self._port_line_edit.text()))
def show_fortune(self, nextFortune):
if nextFortune == self._current_fortune:
@@ -158,22 +159,22 @@ class BlockingClient(QWidget):
def display_error(self, socketError, message):
if socketError == QAbstractSocket.HostNotFoundError:
QMessageBox.information(self, "Blocking Fortune Client",
- "The host was not found. Please check the host and port "
- "settings.")
+ "The host was not found. Please check the host and port "
+ "settings.")
elif socketError == QAbstractSocket.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 "
- "and port settings are correct.")
+ "The connection was refused by the peer. Make sure the "
+ "fortune server is running, and check that the host name "
+ "and port settings are correct.")
else:
QMessageBox.information(self, "Blocking Fortune Client",
- f"The following error occurred: {message}.")
+ f"The following error occurred: {message}.")
self._get_fortune_button.setEnabled(True)
def enable_get_fortune_button(self):
- self._get_fortune_button.setEnabled(self._host_line_edit.text() != '' and
- self._port_line_edit.text() != '')
+ self._get_fortune_button.setEnabled(self._host_line_edit.text() != ''
+ and self._port_line_edit.text() != '')
if __name__ == '__main__':