Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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())