When using a nested state machine, the UI interface is not updated when the web client jumps within a sub-state, and the interface needs to be refreshed before it can be updated. #41
Morning-zz
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
from transitions.extensions import HierarchicalMachine
from transitions_gui import NestedWebMachine
count_states = ['1', '2', '3', 'done']
count_trans = [
['increase', '1', '2'],
['increase', '2', '3'],
['decrease', '3', '2'],
['decrease', '2', '1'],
['done', '3', 'done'],
['reset', '*', '1']
]
counter = HierarchicalMachine(states=count_states, transitions=count_trans, initial='1')
counter.increase() # love my counter
states = ['waiting', 'collecting', {'name': 'counting', 'children': counter}]
transitions = [
['collect', '', 'collecting'],
['wait', '', 'waiting'],
['count', 'collecting', 'counting']
]
collector = HierarchicalMachine(states=states, transitions=transitions, initial='waiting')
collector = NestedWebMachine(states=states, transitions=transitions, initial='waiting', ignore_invalid_triggers=True,auto_transitions=True)
collector.collect() # collecting
collector.count() # let's see what we got; counting_1
collector.increase() # counting_2
collector.increase() # counting_3
collector.done() # collector.state == counting_done
collector.wait() # collector.state == waiting
When the state jumps to the sub-state, the UI interface will not update the current state. Clicking the jump signal can jump, but the UI interface will not be displayed and will need to refresh the web page to display.
Beta Was this translation helpful? Give feedback.
All reactions