Commit f7818c68 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Use square shape for stop symbols in statecharts

parent 00abd8d5
...@@ -376,7 +376,7 @@ def update(scene): ...@@ -376,7 +376,7 @@ def update(scene):
strict=False, directed=True, splines='spline', start='rand') strict=False, directed=True, splines='spline', start='rand')
lookup = {Point: 'point', Record: 'record', lookup = {Point: 'point', Record: 'record',
Diamond: 'diamond', Stop: 'plaintext'} Diamond: 'diamond', Stop: 'square'}
for node in nodes: for node in nodes:
center_pos = node['pos'] center_pos = node['pos']
bb_height = scene.itemsBoundingRect().height() bb_height = scene.itemsBoundingRect().height()
...@@ -466,7 +466,7 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''): ...@@ -466,7 +466,7 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
# Statechart symbols lookup table # Statechart symbols lookup table
lookup = {'point': Point, 'record': Record, lookup = {'point': Point, 'record': Record,
'diamond': Diamond, 'plaintext': Stop} 'diamond': Diamond, 'square': Stop}
try: try:
# Bonus: the tool can render any dot graph... # Bonus: the tool can render any dot graph...
graph = graphtree.get('graph', None) or dotgraph.AGraph('taste.dot') graph = graphtree.get('graph', None) or dotgraph.AGraph('taste.dot')
...@@ -560,8 +560,8 @@ def create_dot_graph(root_ast, basic=False): ...@@ -560,8 +560,8 @@ def create_dot_graph(root_ast, basic=False):
for each in [term for term in root_ast.terminators for each in [term for term in root_ast.terminators
if term.kind == 'return']: if term.kind == 'return']:
# create a new node for each RETURN statement (in nested states) # create a new node for each RETURN statement (in nested states)
ident = each.inputString or 'default' ident = each.inputString or ' '
graph.add_node(ident, label=ident, shape='plaintext') graph.add_node(ident, label=ident, shape='square', width=10.0 / 72.0)
for state, inputs in root_ast.mapping.viewitems(): for state, inputs in root_ast.mapping.viewitems():
# Add edges # Add edges
transitions = \ transitions = \
...@@ -632,7 +632,7 @@ def create_dot_graph(root_ast, basic=False): ...@@ -632,7 +632,7 @@ def create_dot_graph(root_ast, basic=False):
if term.inputString.strip() == '-': if term.inputString.strip() == '-':
target = state target = state
else: else:
target = term.inputString.lower() or 'default' target = term.inputString.lower() or ' '
if basic: if basic:
target_states[target].add(label) target_states[target].add(label)
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment