params.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2015 Airbus
00004 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #   http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 from airbus_docgen.common import html
00019 from airbus_docgen.common.html import HtmlElement
00020 from airbus_docgen.digraph.digraph import *
00021 from airbus_docgen.digraph.model.topic import getStandardTDModel
00022 
00023 
00024 class NodeParameters(HtmlElement):
00025     
00026     def __init__(self):
00027         HtmlElement.__init__(self,
00028                              tag=html.Sections.article,
00029                              attrib={"class":"parameters"})
00030         
00031     def read(self, node_name, node_xml):
00032         
00033         has_params = False
00034         node_params = node_xml.find("parameters")
00035         
00036         if node_params.find("param") is not None:
00037         
00038             table = TABLE()
00039             
00040             title = TD()
00041             title.setAttrib(TD.ALIGN, ALIGN.Center)
00042             title.setAttrib(TD.COLSPAN, 5)
00043             title.setText("Launch parameters")
00044             table.addTR(TR(title))
00045             
00046             ptr = TR()
00047             ptr.addTD(getStandardTDModel("Name",        bgcolor=RgbColor.White, align=ALIGN.Center))
00048             ptr.addTD(getStandardTDModel("Type",        bgcolor=RgbColor.White, align=ALIGN.Center))
00049             ptr.addTD(getStandardTDModel("Default",     bgcolor=RgbColor.White, align=ALIGN.Center))
00050             ptr.addTD(getStandardTDModel("Unit",        bgcolor=RgbColor.White, align=ALIGN.Center))
00051             ptr.addTD(getStandardTDModel("Description", bgcolor=RgbColor.White, align=ALIGN.Center))
00052             table.addTR(ptr)
00053             
00054             for param in node_params.iter('param'):
00055                 
00056                 ptr = TR()
00057                 
00058                 ptr.addTD(getStandardTDModel(self.get_pattrib(param, 'name'),
00059                                              bgcolor=RgbColor.White,
00060                                              align = ALIGN.Left))
00061                 
00062                 ptr.addTD(getStandardTDModel(self.get_pattrib(param, "type"),
00063                                              bgcolor=RgbColor.White,
00064                                              align = ALIGN.Center))
00065                 
00066                 ptr.addTD(getStandardTDModel(self.get_pattrib(param, "default"),
00067                                              bgcolor=RgbColor.White,
00068                                              align = ALIGN.Center))
00069                 
00070                 ptr.addTD(getStandardTDModel(self.get_pattrib(param, "unit"),
00071                                              bgcolor=RgbColor.White,
00072                                              align = ALIGN.Center))
00073                 
00074                 ptr.addTD(getStandardTDModel(str(param.text),
00075                                              bgcolor=RgbColor.White,
00076                                              align=ALIGN.Left))
00077                 
00078                 table.addTR(ptr)
00079                 has_params = True
00080             
00081             if has_params is True:
00082                 self.append(table)
00083         
00084         return has_params
00085     
00086     def get_pattrib(self, param, key):
00087         
00088         if key in param.attrib:
00089             return param.attrib[key]
00090         else:
00091             return "None"
00092         
00093     


airbus_docgen
Author(s): Matignon Martin
autogenerated on Thu Jun 6 2019 17:59:08