没有任何数据可供显示
| 开源项目社区 | 当前位置 : |
|
| www.trustie.net/open_source_projects | 主页 > 开源项目社区 > pyscxml |
|
pyscxml
|
| 1 | 0 | 229 |
| 贡献者 | 讨论 | 代码提交 |
This project supplies an SCXML compiler and interpreter for the Python programming language.
Here's how to use it:
Add the src folder to your pythonpath, either by installing a package from the downloads or by otherwise linking to the project source folder downloaded through subversion. Write up an SCXML document you would like interpreted. Make sure to keep to the supported tags. Now you just need to connect the two. Some sample code below. from scxml.pyscxml import StateMachine
xml = open("my_scxml_doc.xml").read()
sm = StateMachine(xml)
sm.start()
From here on, you can use the send method of the StateMachine instance to send events to your statemachine. The syntax is sm.send(eventName, delay=0) where eventName is a string representing the event attribute of a Transition element in your SCXML document and delay is an integer in seconds. Some tracing information of the state changes is printed to stdout.
List of supported elements: scxml state transition parallel history (type=deep or shallow) final onentry onexit raise cancel log
The In() predicate is also supported with logical operations, e.g
标签:
