aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/tutorials
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/tutorials')
-rw-r--r--examples/widgets/tutorials/addressbook/part2.py7
-rw-r--r--examples/widgets/tutorials/addressbook/part3.py7
-rw-r--r--examples/widgets/tutorials/addressbook/part4.py21
-rw-r--r--examples/widgets/tutorials/addressbook/part5.py26
-rw-r--r--examples/widgets/tutorials/addressbook/part6.py41
-rw-r--r--examples/widgets/tutorials/addressbook/part7.py48
-rw-r--r--examples/widgets/tutorials/cannon/t10.py6
-rw-r--r--examples/widgets/tutorials/cannon/t11.py6
-rw-r--r--examples/widgets/tutorials/cannon/t12.py6
-rw-r--r--examples/widgets/tutorials/cannon/t13.py6
-rw-r--r--examples/widgets/tutorials/cannon/t14.py9
-rw-r--r--examples/widgets/tutorials/cannon/t4.py2
-rw-r--r--examples/widgets/tutorials/cannon/t5.py2
-rw-r--r--examples/widgets/tutorials/cannon/t6.py2
-rw-r--r--examples/widgets/tutorials/cannon/t7.py2
-rw-r--r--examples/widgets/tutorials/cannon/t8.py6
-rw-r--r--examples/widgets/tutorials/cannon/t9.py6
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting.py2
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel.py1
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview.py1
-rw-r--r--examples/widgets/tutorials/modelview/7_selections.py1
21 files changed, 100 insertions, 108 deletions
diff --git a/examples/widgets/tutorials/addressbook/part2.py b/examples/widgets/tutorials/addressbook/part2.py
index 89c813006..3c0eb451d 100644
--- a/examples/widgets/tutorials/addressbook/part2.py
+++ b/examples/widgets/tutorials/addressbook/part2.py
@@ -102,17 +102,16 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
if not self.contacts:
diff --git a/examples/widgets/tutorials/addressbook/part3.py b/examples/widgets/tutorials/addressbook/part3.py
index 571a96a48..611796f5e 100644
--- a/examples/widgets/tutorials/addressbook/part3.py
+++ b/examples/widgets/tutorials/addressbook/part3.py
@@ -116,17 +116,16 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
if not self.contacts:
diff --git a/examples/widgets/tutorials/addressbook/part4.py b/examples/widgets/tutorials/addressbook/part4.py
index 505fe4db9..95f31d46c 100644
--- a/examples/widgets/tutorials/addressbook/part4.py
+++ b/examples/widgets/tutorials/addressbook/part4.py
@@ -128,34 +128,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -169,19 +169,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
diff --git a/examples/widgets/tutorials/addressbook/part5.py b/examples/widgets/tutorials/addressbook/part5.py
index 72245703f..1e9c05862 100644
--- a/examples/widgets/tutorials/addressbook/part5.py
+++ b/examples/widgets/tutorials/addressbook/part5.py
@@ -134,34 +134,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -175,19 +175,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
@@ -243,7 +242,7 @@ class AddressBook(QWidget):
self._address_text.setText(self.contacts[contact_name])
else:
QMessageBox.information(self, "Contact Not Found",
- f'Sorry, "{contact_name}" is not in your address book.')
+ f'Sorry, "{contact_name}" is not in your address book.')
return
self.update_interface(self.NavigationMode)
@@ -311,8 +310,7 @@ class FindDialog(QDialog):
text = self._line_edit.text()
if not text:
- QMessageBox.information(self, "Empty Field",
- "Please enter a name.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name.")
return
else:
self._find_text = text
diff --git a/examples/widgets/tutorials/addressbook/part6.py b/examples/widgets/tutorials/addressbook/part6.py
index f75fbf44f..d11298fb9 100644
--- a/examples/widgets/tutorials/addressbook/part6.py
+++ b/examples/widgets/tutorials/addressbook/part6.py
@@ -145,34 +145,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -186,19 +186,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
@@ -254,7 +253,7 @@ class AddressBook(QWidget):
self._address_text.setText(self.contacts[contact_name])
else:
QMessageBox.information(self, "Contact Not Found",
- f'Sorry, "{contact_name}" is not in your address book.')
+ f'Sorry, "{contact_name}" is not in your address book.')
return
self.update_interface(self.NavigationMode)
@@ -304,8 +303,8 @@ class AddressBook(QWidget):
def save_to_file(self):
fileName, _ = QFileDialog.getSaveFileName(self,
- "Save Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Save Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -314,7 +313,7 @@ class AddressBook(QWidget):
out_file = open(str(fileName), 'wb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
pickle.dump(self.contacts, out_file)
@@ -322,8 +321,8 @@ class AddressBook(QWidget):
def load_from_file(self):
fileName, _ = QFileDialog.getOpenFileName(self,
- "Open Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Open Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -332,7 +331,7 @@ class AddressBook(QWidget):
in_file = open(str(fileName), 'rb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
self.contacts = pickle.load(in_file)
@@ -340,8 +339,7 @@ class AddressBook(QWidget):
if len(self.contacts) == 0:
QMessageBox.information(self, "No contacts in file",
- "The file you are attempting to open contains no "
- "contacts.")
+ "The file you are attempting to open contains no contacts.")
else:
for name, address in self.contacts:
self._name_line.setText(name)
@@ -375,8 +373,7 @@ class FindDialog(QDialog):
text = self._line_edit.text()
if not text:
- QMessageBox.information(self, "Empty Field",
- "Please enter a name.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name.")
return
self._find_text = text
diff --git a/examples/widgets/tutorials/addressbook/part7.py b/examples/widgets/tutorials/addressbook/part7.py
index 2f874f9bd..3829c003d 100644
--- a/examples/widgets/tutorials/addressbook/part7.py
+++ b/examples/widgets/tutorials/addressbook/part7.py
@@ -151,34 +151,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -192,19 +192,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
@@ -260,7 +259,7 @@ class AddressBook(QWidget):
self._address_text.setText(self.contacts[contact_name])
else:
QMessageBox.information(self, "Contact Not Found",
- f'Sorry, "{contact_name}" is not in your address book.')
+ f'Sorry, "{contact_name}" is not in your address book.')
return
self.update_interface(self.NavigationMode)
@@ -313,8 +312,8 @@ class AddressBook(QWidget):
def save_to_file(self):
fileName, _ = QFileDialog.getSaveFileName(self,
- "Save Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Save Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -323,7 +322,7 @@ class AddressBook(QWidget):
out_file = open(str(fileName), 'wb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
pickle.dump(self.contacts, out_file)
@@ -331,8 +330,8 @@ class AddressBook(QWidget):
def load_from_file(self):
fileName, _ = QFileDialog.getOpenFileName(self,
- "Open Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Open Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -341,7 +340,7 @@ class AddressBook(QWidget):
in_file = open(str(fileName), 'rb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
self.contacts = pickle.load(in_file)
@@ -349,8 +348,7 @@ class AddressBook(QWidget):
if len(self.contacts) == 0:
QMessageBox.information(self, "No contacts in file",
- "The file you are attempting to open contains no "
- "contacts.")
+ "The file you are attempting to open contains no contacts.")
else:
for name, address in self.contacts:
self._name_line.setText(name)
@@ -372,7 +370,7 @@ class AddressBook(QWidget):
last_name = ''
file_name = QFileDialog.getSaveFileName(self, "Export Contact",
- '', "vCard Files (*.vcf);;All Files (*)")[0]
+ '', "vCard Files (*.vcf);;All Files (*)")[0]
if not file_name:
return
@@ -380,8 +378,7 @@ class AddressBook(QWidget):
out_file = QFile(file_name)
if not out_file.open(QIODevice.WriteOnly):
- QMessageBox.information(self, "Unable to open file",
- out_file.errorString())
+ QMessageBox.information(self, "Unable to open file", out_file.errorString())
return
out_s = QTextStream(out_file)
@@ -399,7 +396,7 @@ class AddressBook(QWidget):
out_s << 'END:VCARD' << '\n'
QMessageBox.information(self, "Export Successful",
- f'"{name}" has been exported as a vCard.')
+ f'"{name}" has been exported as a vCard.')
class FindDialog(QDialog):
@@ -427,8 +424,7 @@ class FindDialog(QDialog):
text = self._line_edit.text()
if not text:
- QMessageBox.information(self, "Empty Field",
- "Please enter a name.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name.")
return
self._find_text = text
diff --git a/examples/widgets/tutorials/cannon/t10.py b/examples/widgets/tutorials/cannon/t10.py
index c9c3fa7f6..8649bb562 100644
--- a/examples/widgets/tutorials/cannon/t10.py
+++ b/examples/widgets/tutorials/cannon/t10.py
@@ -43,8 +43,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -113,7 +113,7 @@ class MyWidget(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t11.py b/examples/widgets/tutorials/cannon/t11.py
index 997eecbd1..fbfd2481d 100644
--- a/examples/widgets/tutorials/cannon/t11.py
+++ b/examples/widgets/tutorials/cannon/t11.py
@@ -45,8 +45,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -175,7 +175,7 @@ class MyWidget(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t12.py b/examples/widgets/tutorials/cannon/t12.py
index 8847b2208..749c24684 100644
--- a/examples/widgets/tutorials/cannon/t12.py
+++ b/examples/widgets/tutorials/cannon/t12.py
@@ -62,8 +62,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -226,7 +226,7 @@ class MyWidget(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange("ANGLE")
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t13.py b/examples/widgets/tutorials/cannon/t13.py
index 4eb45a374..f9a771d15 100644
--- a/examples/widgets/tutorials/cannon/t13.py
+++ b/examples/widgets/tutorials/cannon/t13.py
@@ -64,8 +64,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -259,7 +259,7 @@ class GameBoard(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange("ANGLE")
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t14.py b/examples/widgets/tutorials/cannon/t14.py
index e4f1c350d..3c94408f3 100644
--- a/examples/widgets/tutorials/cannon/t14.py
+++ b/examples/widgets/tutorials/cannon/t14.py
@@ -65,8 +65,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -174,7 +174,8 @@ class CannonField(QWidget):
self._auto_shoot_timer.stop()
self.hit.emit()
self.can_shoot.emit(True)
- elif shot_r.x() > self.width() or shot_r.y() > self.height() or shot_r.intersects(self.barrier_rect()):
+ elif (shot_r.x() > self.width() or shot_r.y() > self.height()
+ or shot_r.intersects(self.barrier_rect())):
self._auto_shoot_timer.stop()
self.missed.emit()
self.can_shoot.emit(True)
@@ -301,7 +302,7 @@ class GameBoard(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange("ANGLE")
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t4.py b/examples/widgets/tutorials/cannon/t4.py
index ba0ebc41b..37a2dc9dd 100644
--- a/examples/widgets/tutorials/cannon/t4.py
+++ b/examples/widgets/tutorials/cannon/t4.py
@@ -20,7 +20,7 @@ class MyWidget(QWidget):
self.quit.setGeometry(62, 40, 75, 30)
self.quit.setFont(QFont("Times", 18, QFont.Bold))
- self.quit.clicked.connect(qApp.quit)
+ self.quit.clicked.connect(qApp.quit) # noqa: F821
if __name__ == '__main__':
diff --git a/examples/widgets/tutorials/cannon/t5.py b/examples/widgets/tutorials/cannon/t5.py
index 42faeed01..ed5d085f8 100644
--- a/examples/widgets/tutorials/cannon/t5.py
+++ b/examples/widgets/tutorials/cannon/t5.py
@@ -25,7 +25,7 @@ class MyWidget(QWidget):
slider.setRange(0, 99)
slider.setValue(0)
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
slider.valueChanged.connect(lcd.display)
layout = QVBoxLayout(self)
diff --git a/examples/widgets/tutorials/cannon/t6.py b/examples/widgets/tutorials/cannon/t6.py
index 1cc2906f2..ea2e044e6 100644
--- a/examples/widgets/tutorials/cannon/t6.py
+++ b/examples/widgets/tutorials/cannon/t6.py
@@ -33,7 +33,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
layout = QVBoxLayout(self)
layout.addWidget(quit)
diff --git a/examples/widgets/tutorials/cannon/t7.py b/examples/widgets/tutorials/cannon/t7.py
index 51128e6c7..1175107b8 100644
--- a/examples/widgets/tutorials/cannon/t7.py
+++ b/examples/widgets/tutorials/cannon/t7.py
@@ -46,7 +46,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
previous_range = None
diff --git a/examples/widgets/tutorials/cannon/t8.py b/examples/widgets/tutorials/cannon/t8.py
index b82e24a01..9bb5516b8 100644
--- a/examples/widgets/tutorials/cannon/t8.py
+++ b/examples/widgets/tutorials/cannon/t8.py
@@ -43,8 +43,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning("LCDRange.setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -88,7 +88,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t9.py b/examples/widgets/tutorials/cannon/t9.py
index 297e98e50..7cdda4e7b 100644
--- a/examples/widgets/tutorials/cannon/t9.py
+++ b/examples/widgets/tutorials/cannon/t9.py
@@ -43,8 +43,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -94,7 +94,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/modelview/2_formatting.py b/examples/widgets/tutorials/modelview/2_formatting.py
index 73c993e5f..f39ec462c 100644
--- a/examples/widgets/tutorials/modelview/2_formatting.py
+++ b/examples/widgets/tutorials/modelview/2_formatting.py
@@ -32,7 +32,7 @@ class MyModel(QAbstractTableModel):
return "<--left"
if row == 1 and col == 1:
return "right-->"
- return f"Row{row}, Column{col+1}"
+ return f"Row{row}, Column{col + 1}"
elif role == Qt.FontRole:
if row == 0 and col == 0: # change font only for cell(0,0)
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel.py b/examples/widgets/tutorials/modelview/3_changingmodel.py
index e277dd1e8..2148ec5d3 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel.py
+++ b/examples/widgets/tutorials/modelview/3_changingmodel.py
@@ -43,6 +43,7 @@ class MyModel(QAbstractTableModel):
self.dataChanged.emit(top_left, top_left, [Qt.DisplayRole])
#! [3]
+
if __name__ == '__main__':
app = QApplication(sys.argv)
table_view = QTableView()
diff --git a/examples/widgets/tutorials/modelview/6_treeview.py b/examples/widgets/tutorials/modelview/6_treeview.py
index 09300560c..cac3c6d53 100644
--- a/examples/widgets/tutorials/modelview/6_treeview.py
+++ b/examples/widgets/tutorials/modelview/6_treeview.py
@@ -8,6 +8,7 @@ from PySide6.QtWidgets import QApplication, QMainWindow, QTreeView
"""PySide6 port of the widgets/tutorials/modelview/6_treeview example from Qt v6.x"""
+
#! [1]
class MainWindow(QMainWindow):
def __init__(self, parent=None):
diff --git a/examples/widgets/tutorials/modelview/7_selections.py b/examples/widgets/tutorials/modelview/7_selections.py
index 6c519c865..c879d8f67 100644
--- a/examples/widgets/tutorials/modelview/7_selections.py
+++ b/examples/widgets/tutorials/modelview/7_selections.py
@@ -9,6 +9,7 @@ from PySide6.QtWidgets import QApplication, QMainWindow, QTreeView
"""PySide6 port of the widgets/tutorials/modelview/7_selections example from Qt v6.x"""
+
#! [1]
class MainWindow(QMainWindow):
def __init__(self, parent=None):