aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 10:09:33 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 13:21:52 +0200
commitdf43156bb35a442c4988631e1c2b0bd0fc11e618 (patch)
tree77e6c531967013e5628f04e48ba035197b8a737c /examples/declarative/extending
parent130e79e4658d2438f66ab8aeb5e186349e3cb740 (diff)
Examples: Fix some space-related flake warnings
Task-number: PYSIDE-1112 Change-Id: Ib8991199e4822673d6a25cba0023dbe3b03f5938 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/declarative/extending')
-rw-r--r--examples/declarative/extending/chapter1-basics/basics.py5
-rw-r--r--examples/declarative/extending/chapter2-methods/methods.py10
-rw-r--r--examples/declarative/extending/chapter3-bindings/bindings.py8
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py9
-rw-r--r--examples/declarative/extending/chapter5-listproperties/listproperties.py9
5 files changed, 26 insertions, 15 deletions
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py
index 9cbead9cc..db508d297 100644
--- a/examples/declarative/extending/chapter1-basics/basics.py
+++ b/examples/declarative/extending/chapter1-basics/basics.py
@@ -50,11 +50,12 @@ from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickPaintedItem, QQuickView
+
class PieChart (QQuickPaintedItem):
nameChanged = Signal()
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._name = u''
self._color = QColor()
@@ -63,7 +64,7 @@ class PieChart (QQuickPaintedItem):
pen = QPen(self.color, 2)
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
+ painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
@Property(QColor)
def color(self):
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py
index a37376ca8..c0fd0050a 100644
--- a/examples/declarative/extending/chapter2-methods/methods.py
+++ b/examples/declarative/extending/chapter2-methods/methods.py
@@ -50,12 +50,13 @@ from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickPaintedItem, QQuickView
-class PieChart (QQuickPaintedItem):
+
+class PieChart(QQuickPaintedItem):
chartCleared = Signal()
nameChanged = Signal()
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._name = u''
self._color = QColor()
@@ -64,7 +65,7 @@ class PieChart (QQuickPaintedItem):
pen = QPen(self.color, 2)
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
+ painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
@Property(QColor)
def color(self):
@@ -82,12 +83,13 @@ class PieChart (QQuickPaintedItem):
def name(self, value):
self._name = value
- @Slot() # This should be something like @Invokable
+ @Slot() # This should be something like @Invokable
def clearChart(self):
self.color = Qt.transparent
self.update()
self.chartCleared.emit()
+
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
diff --git a/examples/declarative/extending/chapter3-bindings/bindings.py b/examples/declarative/extending/chapter3-bindings/bindings.py
index d19df7f24..3bb70dbab 100644
--- a/examples/declarative/extending/chapter3-bindings/bindings.py
+++ b/examples/declarative/extending/chapter3-bindings/bindings.py
@@ -50,13 +50,14 @@ from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickPaintedItem, QQuickView
+
class PieChart (QQuickPaintedItem):
chartCleared = Signal()
nameChanged = Signal()
colorChanged = Signal()
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._name = u''
self._color = QColor()
@@ -65,7 +66,7 @@ class PieChart (QQuickPaintedItem):
pen = QPen(self._color, 2)
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
+ painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
@Property(QColor, notify=colorChanged)
def color(self):
@@ -86,12 +87,13 @@ class PieChart (QQuickPaintedItem):
def name(self, value):
self._name = value
- @Slot() # This should be something like @Invokable
+ @Slot() # This should be something like @Invokable
def clearChart(self):
self.color = Qt.transparent
self.update()
self.chartCleared.emit()
+
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
index 1bf9387f5..0cd8feb61 100644
--- a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
+++ b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
@@ -50,9 +50,10 @@ from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem
+
class PieSlice (QQuickPaintedItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._color = QColor()
@@ -68,10 +69,11 @@ class PieSlice (QQuickPaintedItem):
pen = QPen(self._color, 2)
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
+ painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
+
class PieChart (QQuickItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickItem.__init__(self, parent)
self._name = None
self._pieSlice = None
@@ -93,6 +95,7 @@ class PieChart (QQuickItem):
self._pieSlice = value
self._pieSlice.setParentItem(self)
+
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
diff --git a/examples/declarative/extending/chapter5-listproperties/listproperties.py b/examples/declarative/extending/chapter5-listproperties/listproperties.py
index 646a14458..4f24a3a87 100644
--- a/examples/declarative/extending/chapter5-listproperties/listproperties.py
+++ b/examples/declarative/extending/chapter5-listproperties/listproperties.py
@@ -50,8 +50,9 @@ from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import qmlRegisterType, ListProperty
from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem
+
class PieSlice (QQuickPaintedItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._color = QColor()
self._fromAngle = 0
@@ -85,10 +86,11 @@ class PieSlice (QQuickPaintedItem):
pen = QPen(self._color, 2)
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), self._fromAngle * 16, self._angleSpan * 16)
+ painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), self._fromAngle * 16, self._angleSpan * 16)
+
class PieChart (QQuickItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickItem.__init__(self, parent)
self._name = u''
self._slices = []
@@ -107,6 +109,7 @@ class PieChart (QQuickItem):
slices = ListProperty(PieSlice, appendSlice)
+
if __name__ == '__main__':
app = QGuiApplication(sys.argv)