Commit 3be85dd7 authored by VIGNET Pierre's avatar VIGNET Pierre

Move Static analysis to proper menu

parent a0cd232f
......@@ -219,6 +219,34 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Make dependency graph</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu8">
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="transitionGraph">
<property name="visible">True</property>
<property name="label" translatable="yes">Transition graph</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="dependencyGraph">
<property name="visible">True</property>
<property name="label" translatable="yes">Dependency graph</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="fullDependencyGraph">
<property name="visible">True</property>
<property name="label" translatable="yes">Full dependency graph</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
......@@ -264,6 +292,7 @@
</child>
</widget>
</child>
</widget>
</child>
</widget>
......
......@@ -179,13 +179,19 @@ class Charter(object):
menu_item = self.wtree.get_widget("basal_activated_genes")
menu_item.connect("activate", self.on_basal_activated_genes)
menu_item = self.wtree.get_widget("dependance_graph")
menu_item = self.wtree.get_widget("transitionGraph")
menu_item.connect("activate", self.on_dependency_graph)
menu_item = self.wtree.get_widget("dependencyGraph")
menu_item.connect("activate", self.on_dependency_graph)
menu_item = self.wtree.get_widget("fullDependencyGraph")
menu_item.connect("activate", self.on_dependency_graph)
# Model Handling buttons
button = self.wtree.get_widget("Check_button")
button.set_label(button.get_label() + " (F8)")
self.add_accelerator(button, "F8")
button.connect("clicked", self.check)
button.connect("clicked", self.on_check)
button = self.wtree.get_widget("Simu_button")
button.set_label(button.get_label() + " (F9)")
......@@ -799,6 +805,7 @@ class Charter(object):
# Static analysis
@check_curent_model
def on_stats_info(self, widget):
"""Static analysis: Fill window with model informations.
"""
reporter = CompilReporter()
# get stats from StaticAnalyzer
......@@ -811,6 +818,7 @@ class Charter(object):
@check_curent_model
def on_frontier_scc(self, widget):
"""Static analysis: Compute connected components which are on the frontier
"""
reporter = CompilReporter()
stan = StaticAnalyzer(reporter)
......@@ -823,6 +831,7 @@ class Charter(object):
@check_curent_model
def on_basal_activated_genes(self, widget):
"""Static analysis: Compute basal activated genes
"""
reporter = CompilReporter()
stan = StaticAnalyzer(reporter)
......@@ -834,13 +843,64 @@ class Charter(object):
@check_curent_model
def on_dependency_graph(self, widget):
"""Static analysis: Computation and export of dependency graphs
"""
Computation and export of the dependency graph
"""
if self.current_edit_mvc:
reporter = CompilReporter()
StaticAnalyzer(reporter)
DependencyGraphWindow(self.current_edit_mvc, reporter, self)
selected_menu = widget.get_name()
reporter = CompilReporter()
static_analyser = StaticAnalyzer(reporter)
static_analyser.build_from_chart_model(self.current_edit_mvc.model)
# Detect type of selected menu
if selected_menu == "transitionGraph":
graph = static_analyser.make_transition_dg()
elif selected_menu == "dependencyGraph":
graph = static_analyser.make_dependence_dg(True)
else:
graph = static_analyser.make_full_dependence_dg(True)
# Open Filechooser to export graph file
ch_opt = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE,
gtk.RESPONSE_OK)
choice = gtk.FileChooserDialog("Save the graph as ...", None,
gtk.FILE_CHOOSER_ACTION_SAVE, ch_opt)
choice.set_default_response(gtk.RESPONSE_OK)
choice.set_current_name(
self.current_edit_mvc.model.name + '_' + \
selected_menu + ".graphml")
# add a filter to see only graphml files (*.graphml)
filter = gtk.FileFilter()
filter.set_name("graphml files")
filter.add_pattern("*.graphml")
choice.add_filter(filter)
# add a filter to see only dot files (*.dot)
filter = gtk.FileFilter()
filter.set_name("dot files")
filter.add_pattern("*.dot")
choice.add_filter(filter)
# add a filter to see all
no_filter = gtk.FileFilter()
no_filter.set_name("all")
no_filter.add_pattern("*")
choice.add_filter(no_filter)
response = choice.run()
if response == gtk.RESPONSE_OK:
# Export to desired file type
if 'dot' in choice.get_filter().get_name():
# Dot
static_analyser.export_2_dot(graph, choice.get_filename())
else:
# Graphml
static_analyser.export_2_graphml(graph, choice.get_filename())
elif response == gtk.RESPONSE_CANCEL:
pass
choice.destroy()
def win_register(self, window):
"""Register a sub window
......@@ -861,8 +921,9 @@ class Charter(object):
self.subwindows.remove(window)
window.destroy()
# solve
def check(self, widget):
# Solve model
@check_curent_model
def on_check(self, widget):
"""
Launch checker
"""
......
......@@ -328,8 +328,11 @@ class StaticAnalyzer(object):
trans = gnode.outgoing_trans[0]
pva = self.get_tr_principal_variables(trans)
res.append((gep, pva))
return res
# Nothing found => return empty result
if len(res) == 0:
return [[]]
return res
def __tr_estim(self, trans, e_visitor, tab_symb):
"""
......
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