Commit 0a949e2e authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib][gui] XML parsers now have a property allowing direct access to model handler;

=> deletion of useless get_model accessor
parent d4e78976
......@@ -169,9 +169,9 @@ def test_main():
print("HANDLER")
print(dir(parser.handler))
print(dir(parser.parser))
print(dir(parser.get_model()))
print(dir(parser.model))
print("ICI")
# print(parser.get_model().get_simple_node())
# print(parser.model.get_simple_node())
print(parser.handler.node_dict)
print(parser.handler.top_pile)
print(parser.handler.pile_dict)
......
......@@ -94,10 +94,10 @@ def get_transitions(parser):
.. code-block:: python
>>> print(dir(parser))
['get_model', 'handler', 'model', 'parser']
['handler', 'model', 'parser']
>>> # Direct access
>>> events = list()
>>> for transition in parser.get_model().transition_list:
>>> for transition in parser.model.transition_list:
... events.append(transition.event)
>>>
>>> # Indirect access via a handler
......@@ -123,7 +123,7 @@ def get_transitions(parser):
# (ce que fait get_statistics d'ailleurs...)
transitions = defaultdict(list)
for trans in parser.get_model().transition_list:
for trans in parser.model.transition_list:
# Get the names of clocks
# Some event have many clocks (like _h_2755) for the same
......@@ -332,7 +332,7 @@ def parse_condition(condition, all_nodes, inhibitors_nodes):
# In practice this is time consuming and useless for what we want to do
#parser = MakeModelFromXmlFile(BIO_MOLDELS_DIR +
# "Whole NCI-PID database translated into CADBIOM formalism(and).bcx")
#parser.get_model().accept(tvi)
#parser.model.accept(tvi)
symb_tab = tvi.tab_symb
# Get tree object from condition string
cond_sexpr = compile_cond(condition, symb_tab, err)
......
......@@ -691,9 +691,8 @@ class ImportBioPAXParams(object):
if self.remove_strongly_connected_components:
model = model_corrections.add_start_nodes(self.cadbiom_file)
else:
model = MakeModelFromXmlFile(self.cadbiom_file).get_model()
model = MakeModelFromXmlFile(self.cadbiom_file).model
model.modified = False # ?????
self.charter.add_edit_mvc(model.name, model)
self.destroy()
......
......@@ -300,7 +300,7 @@ class MCLAnalyser(object):
"""
parsing = MakeModelFromXmlFile(file_name)
# chart model
self.build_from_chart_model(parsing.get_model())
self.build_from_chart_model(parsing.model)
def build_from_pid_file(self, file_name, has_clock=True, ai_interpretation=0):
"""Build an MCLAnalyser from a .xml file of PID database
......@@ -311,7 +311,7 @@ class MCLAnalyser(object):
file_name, self.reporter, has_clock, ai_interpretation
)
# chart model
self.build_from_chart_model(parsing.get_model())
self.build_from_chart_model(parsing.model)
def build_from_cadlang(self, file_name):
"""Build an MCLAnalyser from a .cal, Cadlang file
......
......@@ -324,7 +324,7 @@ class TestStaticAnalysis(unittest.TestCase):
file_name = '/home/gandrieu/these/cadbiom model/fevrier2012_newParser/whole_pid_man_noInhib_modif.bcx'
parser = MakeModelFromXmlFile(file_name)
report = Reporter()
model = parser.get_model()
model = parser.model
sta.build_from_chart_model(model)
graph = sta.make_dependence_dg()
# GENE RESEARCH
......@@ -368,7 +368,7 @@ class TestStaticAnalysis(unittest.TestCase):
parser = MakeModelFromXmlFile(file_name)
report = Reporter()
model = parser.get_model()
model = parser.model
sta = StaticAnalyzer(report)
sta.build_from_chart_model(model)
graph = sta.make_dependence_dg()
......@@ -417,7 +417,7 @@ class TestStaticAnalysis(unittest.TestCase):
parser = MakeModelFromXmlFile(file_name)
report = Reporter()
model = parser.get_model()
model = parser.model
sta = StaticAnalyzer(report)
sta.build_from_chart_model(model)
graph = sta.make_dependence_dg()
......@@ -471,7 +471,7 @@ class TestStaticAnalysis(unittest.TestCase):
parser = MakeModel_from_xml_file(file_name)
report = Reporter()
model = parser.get_model()
model = parser.model
sa = StaticAnalyzer(report)
sta.build_from_chart_model(model)
graph=sa.make_dependence_dg()
......
......@@ -104,7 +104,7 @@ class StaticAnalyzer(object):
"""
parsing = MakeModelFromXmlFile(file_name)
# chart model
self.model = parsing.get_model()
self.model = parsing.model
def build_from_pid_file(self, file_name, has_clock=True,
ai_interpretation=0):
......@@ -115,7 +115,7 @@ class StaticAnalyzer(object):
parser = MakeModelFromPidFile(file_name, self.reporter,
has_clock, ai_interpretation)
# chart model
self.model = parser.get_model()
self.model = parser.model
def get_frontier_node_names(self):
"""
......
......@@ -490,13 +490,6 @@ class MakeModelFromXmlFile:
"""
return self.handler.model
def get_model(self):
"""Return the model generated from the XML file
:rtype: <ChartModel>
"""
return self.handler.model
class MakeModelFromXmlString:
"""Parse a xml description as string"""
......@@ -523,10 +516,3 @@ class MakeModelFromXmlString:
:rtype: <ChartModel>
"""
return self.handler.model
def get_model(self):
"""Return the model generated from the XML string
:rtype: <ChartModel>
"""
return self.handler.model
......@@ -196,12 +196,6 @@ class PidXmlParser:
# The model is currently not modified in comparison to the file
model.modified = False
def get_model(self):
"""
model accessor
"""
return self.model
# def set_extern_localisations(self, l_loc):
# """
# Define external localisations in PID
......
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