diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-03-22 15:41:48 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-03-22 19:41:03 +0000 |
commit | 570cc14c50782ed46393a0a6a8d9d491fbb3785a (patch) | |
tree | 9b123ff862fb83b2c70db4791792919ecc59bd47 /examples/network/fortuneserver | |
parent | 80aec29aca246f1f67a4f8c453b49f1eadfee6fd (diff) |
Replace % formatting in examples by f-strings
As drive-by, Fix fortune server, addressbook and dombookmarks examples to work.
Task-number: PYSIDE-1112
Change-Id: I8ef7759ed56aeb7157cf2222bee9b6481973112a
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'examples/network/fortuneserver')
-rw-r--r-- | examples/network/fortuneserver/fortuneserver.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/network/fortuneserver/fortuneserver.py b/examples/network/fortuneserver/fortuneserver.py index 7b8f05a32..e3087f1c1 100644 --- a/examples/network/fortuneserver/fortuneserver.py +++ b/examples/network/fortuneserver/fortuneserver.py @@ -52,18 +52,20 @@ class Server(QtWidgets.QDialog): super(Server, self).__init__(parent) statusLabel = QtWidgets.QLabel() + statusLabel.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) quitButton = QtWidgets.QPushButton("Quit") quitButton.setAutoDefault(False) self.tcpServer = QtNetwork.QTcpServer(self) if not self.tcpServer.listen(): + reason = self.tcpServer.errorString() QtWidgets.QMessageBox.critical(self, "Fortune Server", - "Unable to start the server: %s." % self.tcpServer.errorString()) + f"Unable to start the server: {reason}.") self.close() return - - statusLabel.setText("The server is running on port %d.\nRun the " - "Fortune Client example now." % self.tcpServer.serverPort()) + port = self.tcpServer.serverPort() + statusLabel.setText(f"The server is running on port {port}.\nRun the " + "Fortune Client example now.") self.fortunes = ( "You've been leading a dog's life. Stay off the furniture.", |