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/threadedfortuneserver | |
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/threadedfortuneserver')
-rw-r--r-- | examples/network/threadedfortuneserver/threadedfortuneserver.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.py b/examples/network/threadedfortuneserver/threadedfortuneserver.py index 839a2a57e..deb993b71 100644 --- a/examples/network/threadedfortuneserver/threadedfortuneserver.py +++ b/examples/network/threadedfortuneserver/threadedfortuneserver.py @@ -111,8 +111,9 @@ class Dialog(QDialog): quitButton.setAutoDefault(False) if not self.server.listen(): + reason = self.server.errorString() QMessageBox.critical(self, "Threaded Fortune Server", - "Unable to start the server: %s." % self.server.errorString()) + f"Unable to start the server: {reason}.") self.close() return @@ -123,9 +124,10 @@ class Dialog(QDialog): ipAddress = QHostAddress(QHostAddress.LocalHost) ipAddress = ipAddress.toString() + port = self.server.serverPort() - statusLabel.setText("The server is running on\n\nIP: %s\nport: %d\n\n" - "Run the Fortune Client example now." % (ipAddress, self.server.serverPort())) + statusLabel.setText(f"The server is running on\n\nIP: {ipAddress}\nport: {port}\n\n" + "Run the Fortune Client example now.") quitButton.clicked.connect(self.close) |