__init__.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 import os
00019 from airbus_docgen import env
00020 from airbus_docgen.common import html
00021 from airbus_docgen.common.html import HtmlElement, HtmlElementTree
00022 
00023 from airbus_docgen.digraph.digraph import *
00024 
00025 from airbus_docgen.docgen.config.launch import ConfigLaunch
00026 
00027 class HtmlConfigFileGenerator(HtmlElementTree):
00028     
00029     def __init__(self, index, launch_file):
00030         
00031         HtmlElementTree.__init__(self, index.getroot())
00032         
00033         self._filename = launch_file.split("/")[-1]
00034         
00035         div = self.getroot().find("./body/div")
00036         
00037         section = HtmlElement(html.Sections.section)
00038         #{
00039         
00040         title = HtmlElement(html.Sections.h1)
00041         title.text = self._filename.replace(".launch","")
00042         section.append(title)
00043         
00044         diagram_title = HtmlElement(html.Sections.h2)
00045         diagram_title.text = "1. Launch diagram"
00046         section.append(diagram_title)
00047         
00048         roslaunch = HtmlElement(html.Grouping.p)
00049         roslaunch.text = """roslaunch is a tool for easily launching multiple ROS nodes locally and remotely via SSH,
00050          as well as setting parameters on the Parameter Server.
00051          It includes options to automatically respawn processes that have already died.
00052          roslaunch takes in one or more XML configuration files (with the .launch extension) that specify the parameters to set and nodes to launch,
00053          as well as the machines that they should be run on."""
00054         section.append(roslaunch)
00055         
00056         try:
00057             launch_dot_generator = ConfigLaunch()
00058             launch_dot_generator.read(launch_file)
00059             section.append(launch_dot_generator)
00060         except Exception as ex:
00061             html.HTMLException(ex, section)
00062         #}
00063         
00064         div.append(section)
00065         
00066     def save(self):
00067         html.indent(self.getroot())
00068         print self._filename
00069         self.write(os.path.join(env.ROSDOC_GEN,
00070                                 self._filename.replace(".launch",".html")),
00071                    encoding="utf8",
00072                    method="xml")
00073     
00074     def __str__(self):
00075         html.indent(self.getroot())
00076         return html.tostring(self.getroot())


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