Commit 2f867d3d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Render label of start transitions (not all cases)

parent 3ac9f575
......@@ -527,7 +527,7 @@ class Edge(Connection):
# Add the transition label, if any (none for the START edge)
font = QFont('arial', pointSize=8)
metrics = QFontMetrics(font)
label = self.edge.get('label', '')
label = self.edge.get('label', '') or ''
lines = label.split('\n')
width = metrics.width(max(lines)) # longest line
height = metrics.height() * len(lines)
......
......@@ -494,7 +494,13 @@ def create_dot_graph(root_ast, basic=False):
label = label.strip().replace('\n', ' ')
except AttributeError:
# START transition may have no inputString
label = ''
for each in root_ast.content.named_start:
# each is of type ogAST.Start
if each.transition == trans:
label = each.inputString[:-6]
break
else:
label = ''
def find_terminators(trans):
''' Recursively find all NEXTSTATES '''
......@@ -514,8 +520,12 @@ def create_dot_graph(root_ast, basic=False):
LOG.error('Missing label: ' + join.inputString)
else:
# Don't recurse forever in case of livelock
if corr_label.inputString != trans.inputString:
next_states.extend(find_terminators(corr_label))
try:
if corr_label.inputString != trans.inputString:
next_states.extend(find_terminators(corr_label))
except AttributeError:
# START transition -> no inputString
pass
return set(next_states)
# Determine the list of terminators in this transition
......
......@@ -1183,5 +1183,5 @@ class StateStart(Start):
def update_completion_list(self, pr_text):
''' Update nested state entry points '''
CONTEXT.state_entrypoints = set(CONTEXT.state_entrypoints
+ [unicode(self)])
CONTEXT.state_entrypoints = \
set(CONTEXT.state_entrypoints) | set(unicode(self))
......@@ -29,6 +29,7 @@ exit_aggreg;
SUBSTRUCTURE
STATE a;
SUBSTRUCTURE
in (hehe);
/* CIF PROCEDURE (159, 386), (77, 35) */
PROCEDURE entry;
/* CIF START (119, 58), (70, 35) */
......@@ -38,6 +39,10 @@ exit_aggreg;
/* CIF RETURN (136, 158), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF START (306, 314), (72, 35) */
START hehe ;
/* CIF NEXTSTATE (308, 364), (70, 35) */
NEXTSTATE a1;
/* CIF START (0, 57), (70, 35) */
START;
/* CIF PROCEDURECALL (-64, 107), (198, 35) */
......@@ -125,9 +130,9 @@ dcl x myInteger;
STATE the_end;
/* CIF INPUT (640, 358), (107, 35) */
INPUT reset_all(x);
/* CIF PROCEDURECALL (544, 408), (300, 35) */
/* CIF PROCEDURECALL (543, 408), (300, 35) */
CALL writeln('Entering again aggregation');
/* CIF NEXTSTATE (659, 458), (70, 35) */
/* CIF NEXTSTATE (658, 458), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (0, 299), (70, 35) */
......
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