diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-03-25 17:20:24 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-06 11:24:08 +0200 |
commit | 27bb3f7839d9673b125f8b1b775c4398293932e2 (patch) | |
tree | b02329140fa93b3d35cc8f864672706d3325cdf7 /examples/widgets/state-machine/factstates/factstates.py | |
parent | 54f8953d629fd97460c82c977ba81d95f0dc5235 (diff) |
Port QWidget examples to snake case
Task-number: PYSIDE-1112
Change-Id: Ia42e395a3c650f4c11f05cfe5c6f67d309c4a3d3
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'examples/widgets/state-machine/factstates/factstates.py')
-rw-r--r-- | examples/widgets/state-machine/factstates/factstates.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/widgets/state-machine/factstates/factstates.py b/examples/widgets/state-machine/factstates/factstates.py index 3608f2a49..dfde45781 100644 --- a/examples/widgets/state-machine/factstates/factstates.py +++ b/examples/widgets/state-machine/factstates/factstates.py @@ -47,28 +47,28 @@ from PySide6.QtStateMachine import (QFinalState, QSignalTransition, QState, class Factorial(QObject): - xChanged = Signal(int) + x_changed = Signal(int) def __init__(self): super(Factorial, self).__init__() self.xval = -1 self.facval = 1 - def getX(self): + def get_x(self): return self.xval - def setX(self, x): + def set_x(self, x): if self.xval == x: return self.xval = x - self.xChanged.emit(x) - x = Property(int, getX, setX) - def getFact(self): + self.x_changed.emit(x) + x = Property(int, get_x, set_x) + def get_fact(self): return self.facval - def setFact(self, fac): + def set_fact(self, fac): self.facval = fac - fac = Property(int, getFact, setFact) + fac = Property(int, get_fact, set_fact) class FactorialLoopTransition(QSignalTransition): def __init__(self, fact): - super(FactorialLoopTransition, self).__init__(fact, SIGNAL('xChanged(int)')) + super(FactorialLoopTransition, self).__init__(fact, SIGNAL('x_changed(int)')) self.fact = fact def eventTest(self, e): if not super(FactorialLoopTransition, self).eventTest(e): @@ -82,7 +82,7 @@ class FactorialLoopTransition(QSignalTransition): class FactorialDoneTransition(QSignalTransition): def __init__(self, fact): - super(FactorialDoneTransition, self).__init__(fact, SIGNAL('xChanged(int)')) + super(FactorialDoneTransition, self).__init__(fact, SIGNAL('x_changed(int)')) self.fact = fact def eventTest(self, e): if not super(FactorialDoneTransition, self).eventTest(e): @@ -103,9 +103,9 @@ if __name__ == '__main__': compute.addTransition(FactorialLoopTransition(factorial)) done = QFinalState(machine) - doneTransition = FactorialDoneTransition(factorial) - doneTransition.setTargetState(done) - compute.addTransition(doneTransition) + done_transition = FactorialDoneTransition(factorial) + done_transition.setTargetState(done) + compute.addTransition(done_transition) machine.setInitialState(compute) machine.finished.connect(app.quit) |