From d9f344fcef6bec04a787f9ea9f4ea94f15eaa26c Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Mon, 4 Jan 2021 21:03:22 +0100 Subject: sources: migration from format() to f-strings This should be the last patch related the usage of f-strings from the 'sources' directory. Pick-to: 6.0 Change-Id: I0288d720dc4930dee088ca3396a66d1b3ba18f76 Reviewed-by: Friedemann Kleint --- sources/pyside6/doc/tutorials/basictutorial/dialog.rst | 4 ++-- sources/pyside6/doc/tutorials/basictutorial/uifiles.rst | 2 +- sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sources/pyside6/doc/tutorials/basictutorial') diff --git a/sources/pyside6/doc/tutorials/basictutorial/dialog.rst b/sources/pyside6/doc/tutorials/basictutorial/dialog.rst index 8246ddd7a..04f6ffa5d 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/dialog.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/dialog.rst @@ -88,7 +88,7 @@ the Form, so you have to add it after the `init()` function: # Greets the user def greetings(self): - print("Hello {}".format(self.edit.text())) + print(f"Hello {self.edit.text()}") Our function just prints the contents of the `QLineEdit` to the python console. We have access to the text by means of the @@ -133,7 +133,7 @@ Here is the complete code for this tutorial: # Greets the user def greetings(self): - print("Hello %s" % self.edit.text()) + print(f"Hello {self.edit.text()}") if __name__ == '__main__': # Create the Qt Application diff --git a/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst b/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst index 50bb2514c..b8a67b51f 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst @@ -167,7 +167,7 @@ The complete code of this example looks like this: ui_file_name = "mainwindow.ui" ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): - print("Cannot open {}: {}".format(ui_file_name, ui_file.errorString())) + print(f"Cannot open {ui_file_name}: {ui_file.errorString()}") sys.exit(-1) loader = QUiLoader() window = loader.load(ui_file) diff --git a/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py b/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py index 94e44c5c5..69caf177f 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py +++ b/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py @@ -62,7 +62,7 @@ class Widget(QWidget): menu_widget = QListWidget() for i in range(10): - item = QListWidgetItem("Item {}".format(i)) + item = QListWidgetItem(f"Item {i}") item.setTextAlignment(Qt.AlignCenter) menu_widget.addItem(item) -- cgit v1.2.3