diff options
Diffstat (limited to 'examples/widgets/tutorials/cannon/t14.py')
-rw-r--r-- | examples/widgets/tutorials/cannon/t14.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/widgets/tutorials/cannon/t14.py b/examples/widgets/tutorials/cannon/t14.py index aa0f8876b..3c94408f3 100644 --- a/examples/widgets/tutorials/cannon/t14.py +++ b/examples/widgets/tutorials/cannon/t14.py @@ -8,10 +8,10 @@ import sys import math import random -from PySide6.QtCore import (QPoint, QRect, QTime, QTimer, QSize, Qt, SIGNAL, - SLOT, Signal, Slot) +from PySide6.QtCore import (QPoint, QRect, QTime, QTimer, QSize, Qt, + Signal, Slot, qWarning) from PySide6.QtGui import (QColor, QFont, QKeySequence, QPainter, QPalette, - QShortcut, QRegion) + QShortcut, QRegion, QTransform) from PySide6.QtWidgets import (QApplication, QFrame, QGridLayout, QHBoxLayout, QLabel, QLCDNumber, QPushButton, QSizePolicy, QSlider, QVBoxLayout, QWidget) @@ -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) @@ -341,7 +342,7 @@ class GameBoard(QWidget): QShortcut(QKeySequence(Qt.Key_Enter), self, self.fire) QShortcut(QKeySequence(Qt.Key_Return), self, self.fire) - QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q), self, self.close) + QShortcut(QKeySequence(Qt.CTRL | Qt.Key_Q), self, self.close) top_layout = QHBoxLayout() top_layout.addWidget(shoot) |