Commit 6f649a24 authored by VIGNET Pierre's avatar VIGNET Pierre

Move Static Analysis window to the main menus

parent c4d4f10a
......@@ -178,11 +178,54 @@
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuBar" id="menubar2">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="static_analysis_menu">
<property name="visible">True</property>
<property name="label" translatable="yes">Static analysis</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu9">
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="model_infos">
<property name="visible">True</property>
<property name="label" translatable="yes">Model informations</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="scc_search">
<property name="visible">True</property>
<property name="label" translatable="yes">Search Strongly Connected Components (SCC)</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="basal_activated_genes">
<property name="visible">True</property>
<property name="label" translatable="yes">Basal activated genes</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="dependance_graph">
<property name="visible">True</property>
<property name="label" translatable="yes">Make dependance graph</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="Help">
<property name="visible">True</property>
......@@ -222,11 +265,6 @@
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
......@@ -317,19 +355,6 @@
<widget class="GtkHButtonBox" id="handling_box">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_START</property>
<child>
<widget class="GtkButton" id="sa_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">Static Analysis</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="Check_button">
<property name="visible">True</property>
......
......@@ -356,7 +356,7 @@ class ImportPIDParam(object):
"""
Widget for model importing
"""
def __init__(self, chart):
def __init__(self, chart, parent):
self.charter = chart
# window creation
......
......@@ -54,6 +54,8 @@ BG_COLOR = "#FFFF99"
class ChartStatControler(object):
"""
Control of static analysis
/!\ This class is fully deprecated and is no longer used /!\
"""
def __init__(self, emvc, reporter):
self.edit_mvc = emvc
......@@ -152,12 +154,14 @@ class ChartStatControler(object):
"""
register a sub wundow
"""
print "register"
self.subwin.append(win)
def win_remove(self, win):
"""
unregister a sub window
"""
print "remove"
self.subwin.remove(win)
def clean_subwin(self):
......@@ -165,6 +169,7 @@ class ChartStatControler(object):
sub windows management
"""
for win in self.subwin:
print "clean"
win.destroy()
self.subwin = []
......@@ -172,6 +177,7 @@ class ChartStatControler(object):
"""
Standard call back
"""
print "on destroy"
self.clean_subwin()
if self.main_window:
self.main_window.destroy()
......
......@@ -63,7 +63,8 @@ from chart_simulator.chart_simul_controler import \
from chart_checker.chart_checker_controler import ChartChecker
from chart_misc_widgets import SearchManager, SearchFrontier, \
LegendWindow, ImportPIDParam, ImportBioPAXParams
from cadbiom_gui.gt_gui.chart_static.chart_stat_controler import ChartStatControler
from cadbiom_gui.gt_gui.chart_static.chart_stat_controler import \
STATWindow, SCCWindow, BAGWindow, DependencyGraphWindow
from cadbiom.models.guard_transitions.chart_model import ChartModel
from cadbiom.models.guard_transitions.translators.chart_lang import LangVisitor
......@@ -73,6 +74,10 @@ from cadbiom.models.guard_transitions.translators.chart_xml import \
from cadbiom.models.guard_transitions.translators.cadlangLexer import cadlangLexer
from cadbiom.models.guard_transitions.translators.cadlangParser import cadlangParser
# Custom imports
from cadbiom.models.guard_transitions.analyser.static_analysis \
import StaticAnalyzer
from layout import LayoutVisitor
import pkg_resources
......@@ -86,6 +91,9 @@ class Charter(object):
self.ident = "charter"
self.cad_manager = cad
# Gestion of the destroy of all subwindows opened from this one
self.subwindows = set()
# simul options
self.simul_strict = True
self.sim_flat_graph = False
......@@ -121,8 +129,6 @@ class Charter(object):
menu_bar.set_size_request(0, 25)
menu_bar.modify_bg(gtk.STATE_NORMAL, color)
menu_bar = self.wtree.get_widget("menubar2")
menu_bar.modify_bg(gtk.STATE_NORMAL, color)
menu_item = self.wtree.get_widget("doc_menu")
menu_item.connect("activate", self.show_doc)
menu_item = self.wtree.get_widget("legend_menu")
......@@ -161,14 +167,16 @@ class Charter(object):
menu_item = self.wtree.get_widget("circo")
menu_item.connect("activate", self.do_layout, "circo")
menu_item = self.wtree.get_widget("model_infos")
menu_item.connect("activate", self.on_stats_info)
menu_item = self.wtree.get_widget("scc_search")
menu_item.connect("activate", self.on_frontier_scc)
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.connect("activate", self.on_dependency_graph)
# Model Handling buttons
button = self.wtree.get_widget("Simu_button")
button.connect("clicked", self.on_simulate)
button = self.wtree.get_widget("sa_button")
button.connect("clicked", self.on_static)
button = self.wtree.get_widget("Check_button")
button.set_label(button.get_label() + " (F8)")
self.add_accelerator(button, "F8")
......@@ -362,7 +370,7 @@ class Charter(object):
bhan = self.button_handlers[k]
bhan[0].set_sensitive(True)
def on_destroy(self, widget, xxx):
def on_destroy(self, widget, _dummy_event):
"""
destroy if everything OK
"""
......@@ -732,13 +740,78 @@ class Charter(object):
# static analysis
def on_static(self, widget):
# def on_static(self, widget):
# """
# Call static analysis
# """
# if self.current_edit_mvc:
# reporter = CompilReporter()
# chart_static = ChartStatControler(self.current_edit_mvc, reporter)
def on_stats_info(self, widget):
"""
Call static analysis
Fill window with model informations.
"""
if self.current_edit_mvc:
reporter = CompilReporter()
chart_static = ChartStatControler(self.current_edit_mvc, reporter)
# get stats from StaticAnalyzer
stan = StaticAnalyzer(reporter)
stan.build_from_chart_model(self.current_edit_mvc.model)
ststat = stan.get_statistics()
window = STATWindow(ststat, self.current_edit_mvc, reporter, self)
# Get Main widget and connect its "destroy" event
window.window.connect("destroy", self.win_remove)
def on_frontier_scc(self, widget):
"""
Compute connected components which are on the frontier
"""
if self.current_edit_mvc:
reporter = CompilReporter()
stan = StaticAnalyzer(reporter)
stan.build_from_chart_model(self.current_edit_mvc.model)
# errors??
lscc = stan.get_frontier_scc()
window = SCCWindow(lscc, self.current_edit_mvc, reporter, self)
# Get Main widget and connect its "destroy" event
window.window.connect("destroy", self.win_remove)
def on_basal_activated_genes(self, widget):
"""
Compute basal activated genes
"""
if self.current_edit_mvc:
reporter = CompilReporter()
stan = StaticAnalyzer(reporter)
stan.build_from_chart_model(self.current_edit_mvc.model)
lwbag = stan.get_why_basal_genes()
window = BAGWindow(lwbag, self.current_edit_mvc, reporter, self)
# Get Main widget and connect its "destroy" event
window.window.connect("destroy", self.win_remove)
def on_dependency_graph(self, widget):
"""
Computation and export of the dependance graph
"""
if self.current_edit_mvc:
reporter = CompilReporter()
StaticAnalyzer(reporter)
DependencyGraphWindow(self.current_edit_mvc, reporter, self)
def win_register(self, window):
"""Register a sub window
This window will be destroyed when you connect its main widget
event "destroy" to subwin_on_destroy()
"""
self.subwindows.add(window)
def win_remove(self, window):
"""Destroy a sub window
This window will be destroyed when you connect its main widget
event "destroy" to subwin_on_destroy()
"""
self.subwindows.remove(window)
window.destroy()
# solve
def check(self, widget):
......
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