def model_dependencies(self):
     """Prints out variable dependencies for the model."""
     from opus_core.variables.dependency_query import DependencyChart
     model, group = self.get_model_name()
     chart = DependencyChart(self.xml_configuration,
                             model=model,
                             model_group=group,
                             specification=self.get_specification())
     chart.print_model_dependencies()
Ejemplo n.º 2
0
 def _view_dependencies(self, variable):
     chart = DependencyChart(self.project.xml_config)
     dialog = DependencyViewer(self)
     try:
         chart.graph_variable("temp", str(variable['definition']), False)
         dialog.show_graph('temp.png', variable['name'])
         dialog.show()
     except InvocationException:
         #dialog.show_error_message()
         chart.print_dependencies(str(variable['definition']))
Ejemplo n.º 3
0
 def model_dependencies(self, model=None, group=None):
     """Prints out all dependencies for the model."""
     from opus_core.variables.dependency_query import DependencyChart
     if model is None: # current model
         model, group = self.get_model_name()
         spec = self.get_specification()
     else:
         spec = None
     if model == 'all': # print dependencies for all models
         for thismodel in self.scenario_models:
             thisgroups = None
             if isinstance(thismodel, dict):
                 thisgroups = thismodel[thismodel.keys()[0]].get('group_members', None)
                 thismodel = thismodel.keys()[0]
             if not isinstance(thisgroups, list):
                 thisgroups = [thisgroups]                
             for group in thisgroups:
                 chart = DependencyChart(self.xml_configuration, model=thismodel, model_group=group)
                 chart.print_model_dependencies()
     else:
         chart = DependencyChart(self.xml_configuration, model=model, model_group=group, 
                             specification=spec)
         chart.print_model_dependencies()
 def variable_dependencies(self, name):
     """Prints out dependencies of this variable. 'name' can be either an alias from 
     the model specification or an expression."""
     from opus_core.variables.dependency_query import DependencyChart
     varname = None
     allvars = self.get_specification().get_variable_names()
     for ivar in range(len(allvars)):
         thisvar = allvars[ivar]
         if not isinstance(thisvar, VariableName):
             thisvar = VariableName(thisvar)
         if name == thisvar.get_alias():
             varname = thisvar
             break
     if varname is None:
         varname = VariableName(name)
     chart = DependencyChart(self.xml_configuration)
     chart.print_dependencies(varname.get_expression())