diff options
Diffstat (limited to 'examples/widgets/animation')
-rw-r--r-- | examples/widgets/animation/animatedtiles/animatedtiles.py | 27 | ||||
-rw-r--r-- | examples/widgets/animation/animatedtiles/animatedtiles.pyproject | 3 | ||||
-rw-r--r-- | examples/widgets/animation/appchooser/appchooser.py | 2 | ||||
-rw-r--r-- | examples/widgets/animation/appchooser/appchooser.pyproject | 2 | ||||
-rw-r--r-- | examples/widgets/animation/easing/easing.py | 14 | ||||
-rw-r--r-- | examples/widgets/animation/easing/images/qt-logo.png | bin | 5149 -> 0 bytes | |||
-rw-r--r-- | examples/widgets/animation/easing/ui_form.py | 16 | ||||
-rw-r--r-- | examples/widgets/animation/states/states.py | 2 | ||||
-rw-r--r-- | examples/widgets/animation/states/states.pyproject | 2 |
9 files changed, 33 insertions, 35 deletions
diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.py b/examples/widgets/animation/animatedtiles/animatedtiles.py index b621ec117..02fc75bf5 100644 --- a/examples/widgets/animation/animatedtiles/animatedtiles.py +++ b/examples/widgets/animation/animatedtiles/animatedtiles.py @@ -15,7 +15,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsItem, QGraphicsPixmapItem, QGraphicsWidget, QStyle) from PySide6.QtStateMachine import QState, QStateMachine -import animatedtiles_rc +import animatedtiles_rc # noqa: F401 # Deriving from more than one wrapped class is not supported, so we use @@ -95,7 +95,7 @@ class Button(QGraphicsWidget): painter.drawEllipse(r.adjusted(5, 5, -5, -5)) painter.drawPixmap(-self._pix.width() / 2, -self._pix.height() / 2, - self._pix) + self._pix) def mousePressEvent(self, ev): self.pressed.emit() @@ -123,7 +123,7 @@ if __name__ == '__main__': for i in range(64): item = Pixmap(kinetic_pix) item.pixmap_item.setOffset(-kinetic_pix.width() / 2, - -kinetic_pix.height() / 2) + -kinetic_pix.height() / 2) item.pixmap_item.setZValue(i) items.append(item) scene.addItem(item.pixmap_item) @@ -161,23 +161,25 @@ if __name__ == '__main__': for i, item in enumerate(items): # Ellipse. ellipse_state.assignProperty(item, 'pos', - QPointF(math.cos((i / 63.0) * 6.28) * 250, - math.sin((i / 63.0) * 6.28) * 250)) + QPointF(math.cos((i / 63.0) * 6.28) * 250, + math.sin((i / 63.0) * 6.28) * 250)) # Figure 8. figure_8state.assignProperty(item, 'pos', - QPointF(math.sin((i / 63.0) * 6.28) * 250, - math.sin(((i * 2) / 63.0) * 6.28) * 250)) + QPointF(math.sin((i / 63.0) * 6.28) * 250, + math.sin(((i * 2) / 63.0) * 6.28) * 250)) # Random. random_state.assignProperty(item, 'pos', - QPointF(-250 + generator.bounded(0, 500), - -250 + generator.bounded(0, 500))) + QPointF(-250 + generator.bounded(0, 500), + -250 + generator.bounded(0, 500))) # Tiled. + width = kinetic_pix.width() + height = kinetic_pix.height() tiled_state.assignProperty(item, 'pos', - QPointF(((i % 8) - 4) * kinetic_pix.width() + kinetic_pix.width() / 2, - ((i // 8) - 4) * kinetic_pix.height() + kinetic_pix.height() / 2)) + QPointF(((i % 8) - 4) * width + width / 2, + ((i // 8) - 4) * height + height / 2)) # Centered. centered_state.assignProperty(item, 'pos', QPointF()) @@ -188,8 +190,7 @@ if __name__ == '__main__': view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate) view.setBackgroundBrush(QBrush(bg_pix)) view.setCacheMode(QGraphicsView.CacheBackground) - view.setRenderHints( - QPainter.Antialiasing | QPainter.SmoothPixmapTransform) + view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform) view.show() states = QStateMachine() diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.pyproject b/examples/widgets/animation/animatedtiles/animatedtiles.pyproject index 08ee55685..20f4abe43 100644 --- a/examples/widgets/animation/animatedtiles/animatedtiles.pyproject +++ b/examples/widgets/animation/animatedtiles/animatedtiles.pyproject @@ -1,4 +1,3 @@ { - "files": ["animatedtiles.qrc", "animatedtiles.py", - "animatedtiles_rc.py"] + "files": ["animatedtiles.qrc", "animatedtiles.py"] } diff --git a/examples/widgets/animation/appchooser/appchooser.py b/examples/widgets/animation/appchooser/appchooser.py index e49f37dec..610050210 100644 --- a/examples/widgets/animation/appchooser/appchooser.py +++ b/examples/widgets/animation/appchooser/appchooser.py @@ -11,7 +11,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsScene, QGraphicsView, QGraphicsWidget) from PySide6.QtStateMachine import QState, QStateMachine -import appchooser_rc +import appchooser_rc # noqa: F401 class Pixmap(QGraphicsWidget): diff --git a/examples/widgets/animation/appchooser/appchooser.pyproject b/examples/widgets/animation/appchooser/appchooser.pyproject index 14bc351a1..f4c122bef 100644 --- a/examples/widgets/animation/appchooser/appchooser.pyproject +++ b/examples/widgets/animation/appchooser/appchooser.pyproject @@ -1,3 +1,3 @@ { - "files": ["appchooser_rc.py", "appchooser.py", "appchooser.qrc"] + "files": ["appchooser.py", "appchooser.qrc"] } diff --git a/examples/widgets/animation/easing/easing.py b/examples/widgets/animation/easing/easing.py index f8cba0060..ba5032458 100644 --- a/examples/widgets/animation/easing/easing.py +++ b/examples/widgets/animation/easing/easing.py @@ -125,7 +125,6 @@ class Window(QWidget): curve_types = [(f"QEasingCurve.{e.name}", e) for e in QEasingCurve.Type if e.value <= 40] - with QPainter(pix) as painter: for curve_name, curve_type in curve_types: @@ -144,14 +143,13 @@ class Window(QWidget): # Start point. painter.setBrush(Qt.red) - start = QPoint(y_axis, - x_axis - curve_scale * curve.valueForProgress(0)) + start = QPoint(y_axis, x_axis - curve_scale * curve.valueForProgress(0)) painter.drawRect(start.x() - 1, start.y() - 1, 3, 3) # End point. painter.setBrush(Qt.blue) end = QPoint(y_axis + curve_scale, - x_axis - curve_scale * curve.valueForProgress(1)) + x_axis - curve_scale * curve.valueForProgress(1)) painter.drawRect(end.x() - 1, end.y() - 1, 3, 3) curve_path = QPainterPath() @@ -159,7 +157,7 @@ class Window(QWidget): t = 0.0 while t <= 1.0: to = QPointF(y_axis + curve_scale * t, - x_axis - curve_scale * curve.valueForProgress(t)) + x_axis - curve_scale * curve.valueForProgress(t)) curve_path.lineTo(to) t += 1.0 / curve_scale @@ -185,14 +183,14 @@ class Window(QWidget): self._anim.setCurrentTime(0) is_elastic = (curve_type.value >= QEasingCurve.InElastic.value - and curve_type.value <= QEasingCurve.OutInElastic.value) + and curve_type.value <= QEasingCurve.OutInElastic.value) is_bounce = (curve_type.value >= QEasingCurve.InBounce.value - and curve_type.value <= QEasingCurve.OutInBounce.value) + and curve_type.value <= QEasingCurve.OutInBounce.value) self._ui.periodSpinBox.setEnabled(is_elastic) self._ui.amplitudeSpinBox.setEnabled(is_elastic or is_bounce) self._ui.overshootSpinBox.setEnabled(curve_type.value >= QEasingCurve.InBack.value - and curve_type.value <= QEasingCurve.OutInBack.value) + and curve_type.value <= QEasingCurve.OutInBack.value) def path_changed(self, index): self._anim.set_path_type(index) diff --git a/examples/widgets/animation/easing/images/qt-logo.png b/examples/widgets/animation/easing/images/qt-logo.png Binary files differdeleted file mode 100644 index 14ddf2a02..000000000 --- a/examples/widgets/animation/easing/images/qt-logo.png +++ /dev/null diff --git a/examples/widgets/animation/easing/ui_form.py b/examples/widgets/animation/easing/ui_form.py index 0ff7a1547..2925cbae7 100644 --- a/examples/widgets/animation/easing/ui_form.py +++ b/examples/widgets/animation/easing/ui_form.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- ################################################################################ -## Form generated from reading UI file 'form2.ui' +## Form generated from reading UI file 'form.ui' ## -## Created by: Qt User Interface Compiler version 6.4.0 +## Created by: Qt User Interface Compiler version 6.7.0 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -29,7 +29,7 @@ class Ui_Form(object): self.gridLayout.setObjectName(u"gridLayout") self.easingCurvePicker = QListWidget(Form) self.easingCurvePicker.setObjectName(u"easingCurvePicker") - sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.easingCurvePicker.sizePolicy().hasHeightForWidth()) @@ -73,7 +73,7 @@ class Ui_Form(object): self.groupBox = QGroupBox(Form) self.groupBox.setObjectName(u"groupBox") - sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) + sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) @@ -83,7 +83,7 @@ class Ui_Form(object): self.formLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) self.label = QLabel(self.groupBox) self.label.setObjectName(u"label") - sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) @@ -95,7 +95,7 @@ class Ui_Form(object): self.periodSpinBox = QDoubleSpinBox(self.groupBox) self.periodSpinBox.setObjectName(u"periodSpinBox") self.periodSpinBox.setEnabled(False) - sizePolicy3 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth(self.periodSpinBox.sizePolicy().hasHeightForWidth()) @@ -142,7 +142,7 @@ class Ui_Form(object): self.verticalLayout.addWidget(self.groupBox) - self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.verticalLayout.addItem(self.verticalSpacer) @@ -151,7 +151,7 @@ class Ui_Form(object): self.graphicsView = QGraphicsView(Form) self.graphicsView.setObjectName(u"graphicsView") - sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth()) diff --git a/examples/widgets/animation/states/states.py b/examples/widgets/animation/states/states.py index 9b85e8373..509c3a7aa 100644 --- a/examples/widgets/animation/states/states.py +++ b/examples/widgets/animation/states/states.py @@ -16,7 +16,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsLinearLayout, from PySide6.QtStateMachine import QState, QStateMachine -import states_rc +import states_rc # noqa: F401 class Pixmap(QGraphicsObject): diff --git a/examples/widgets/animation/states/states.pyproject b/examples/widgets/animation/states/states.pyproject index d94cf2e65..45ad44e97 100644 --- a/examples/widgets/animation/states/states.pyproject +++ b/examples/widgets/animation/states/states.pyproject @@ -1,3 +1,3 @@ { - "files": ["states.py", "states_rc.py"] + "files": ["states.py"] } |