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

Fix statechart message selection

Window for selecting messages was displayed only when clicking from the
Block scene
parent 1c90c9da
......@@ -569,7 +569,7 @@ def locked():
return g_statechart_lock
def create_dot_graph(root_ast, basic=False, scene=None):
def create_dot_graph(root_ast, basic=False, scene=None, view=None):
''' Return a dot.AGraph item, from an ogAST.Process or child entry
Set basic=True to generate a simple graph with at most one edge
between two states and no diamond nodes
......@@ -612,7 +612,7 @@ def create_dot_graph(root_ast, basic=False, scene=None):
else: ("Statechart settings read from configuration file")
if scene and scene.views():
if scene and view:
# Load and display a table for the user to filter out messages that
# are not relevant to display on the statechart - and make it lighter
# Repeat for substates, too.
......@@ -629,7 +629,7 @@ def create_dot_graph(root_ast, basic=False, scene=None):
ui_file = QtCore.QFile(":/statechart_cfg.ui")
dialog = loader.load(ui_file)
dialog.setParent (scene.views()[0], QtCore.Qt.Dialog)
dialog.setParent (view, QtCore.Qt.Dialog)
okButton = dialog.findChild(QtGui.QPushButton, "okButton")
rightButton = dialog.findChild(QtGui.QToolButton, "toRight")
leftButton = dialog.findChild(QtGui.QToolButton, "toLeft")
......@@ -1026,8 +1026,9 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
def sdl_to_statechart(self, basic=True):
''' Create a graphviz representation of the SDL model '''
def sdl_to_statechart(self, basic=True, view=None):
''' Create a graphviz representation of the SDL model
Optionally take a QGraphicsView to use as parent for modals '''
pr_raw = Pr.parse_scene(self)
pr_data = unicode('\n'.join(pr_raw))
ast, _, _ = ogParser.parse_pr(string=pr_data)
......@@ -1046,7 +1047,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# dot supports only vertically-aligned states, and fdp does not
# support curved edges and is buggy with pygraphviz anyway)
# Helper.flatten(process_ast)
return Statechart.create_dot_graph(process_ast, basic, scene=self)
return Statechart.create_dot_graph(process_ast, basic,
scene=self, view=view)
def export_branch_to_picture(self, symbol, filename, doc_format):
......@@ -2340,7 +2342,7 @@ class OG_MainWindow(QtGui.QMainWindow, object):
# so the lock is necessary to prevent recursive execution
scene = self.view.top_scene()
graph = scene.sdl_to_statechart()
graph = scene.sdl_to_statechart(view=self.view)
Supports Markdown
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