diff --git a/doc/source/img/engine_states.svg b/doc/source/img/engine_states.svg index 8ef68c3ec..079002ecf 100644 --- a/doc/source/img/engine_states.svg +++ b/doc/source/img/engine_states.svg @@ -1,8 +1,8 @@ - - -Engines statesGAME_OVERREVERTEDSUCCESSSUSPENDEDFAILUREUNDEFINEDRESUMINGSCHEDULINGANALYZINGWAITINGstart + +Engines statesGAME_OVERREVERTEDSUCCESSSUSPENDEDFAILUREUNDEFINEDRESUMINGSCHEDULINGANALYZINGWAITINGstart diff --git a/doc/source/img/flow_states.svg b/doc/source/img/flow_states.svg index 5a1cdcbd9..80bf1a0a6 100644 --- a/doc/source/img/flow_states.svg +++ b/doc/source/img/flow_states.svg @@ -1,8 +1,8 @@ - - -Flow statesPENDINGRUNNINGFAILURESUSPENDINGREVERTEDSUCCESSRESUMINGSUSPENDEDstart + +Flow statesPENDINGRUNNINGFAILURESUSPENDINGREVERTEDSUCCESSRESUMINGSUSPENDEDstart diff --git a/doc/source/img/retry_states.svg b/doc/source/img/retry_states.svg index a2ba2fa90..8b0c63573 100644 --- a/doc/source/img/retry_states.svg +++ b/doc/source/img/retry_states.svg @@ -1,8 +1,8 @@ - - -Retries statesPENDINGRUNNINGSUCCESSFAILURERETRYINGREVERTINGREVERTEDstart + +Retries statesPENDINGRUNNINGSUCCESSFAILURERETRYINGREVERTINGREVERTEDstart diff --git a/doc/source/img/task_states.svg b/doc/source/img/task_states.svg index c281be8eb..14a1f098f 100644 --- a/doc/source/img/task_states.svg +++ b/doc/source/img/task_states.svg @@ -1,8 +1,8 @@ - - -Tasks statesPENDINGRUNNINGSUCCESSFAILUREREVERTINGREVERTEDstart + +Tasks statesPENDINGRUNNINGSUCCESSFAILUREREVERTINGREVERTEDstart diff --git a/tools/state_graph.py b/tools/state_graph.py index e83426bf8..c5d72d025 100755 --- a/tools/state_graph.py +++ b/tools/state_graph.py @@ -57,6 +57,18 @@ def make_machine(start_state, transitions, disallowed): return machine +def map_color(internal_states, state): + if state in internal_states: + return 'blue' + if state == states.FAILURE: + return 'red' + if state == states.REVERTED: + return 'darkorange' + if state == states.SUCCESS: + return 'green' + return None + + def main(): parser = optparse.OptionParser() parser.add_option("-f", "--file", dest="filename", @@ -119,14 +131,16 @@ def main(): for (start_state, _on_event, end_state) in source: if start_state not in nodes: start_node_attrs = node_attrs.copy() - if start_state in internal_states: - start_node_attrs['fontcolor'] = 'blue' + text_color = map_color(internal_states, start_state) + if text_color: + start_node_attrs['fontcolor'] = text_color nodes[start_state] = pydot.Node(start_state, **start_node_attrs) g.add_node(nodes[start_state]) if end_state not in nodes: end_node_attrs = node_attrs.copy() - if end_state in internal_states: - end_node_attrs['fontcolor'] = 'blue' + text_color = map_color(internal_states, end_state) + if text_color: + end_node_attrs['fontcolor'] = text_color nodes[end_state] = pydot.Node(end_state, **end_node_attrs) g.add_node(nodes[end_state]) g.add_edge(pydot.Edge(nodes[start_state], nodes[end_state]))