Exemple #1
0
    def addItem(self, parent, item_name, href="#"):
        """
        Append element "<li><a href="$href">$pkg_name</a></li>" into <ul> parent stack element
        """
        li = HtmlElement(tag=html.Grouping.li)
        a = HtmlElement(tag=html.Text.a)
        a.set(html.Attrib.href, href)
        a.text = item_name
        li.append(a)
        parent.append(li)

        return li
Exemple #2
0
    def addSubItem(self, parent, item_name):
        """
        Append element "<li><a>$menu_name</a><ul/></li>" into parent element
        """
        item = HtmlElement(tag=html.Grouping.li)
        name = HtmlElement(tag=html.Text.a)
        name.text = item_name
        item.append(name)
        subitem = HtmlElement(tag=html.Grouping.ul)
        item.append(subitem)
        parent.append(item)

        return subitem
Exemple #3
0
    def _read_pkg_xml(self, pkgdir, pkg_xml):

        pkg_name = HtmlElement(html.Sections.h1)
        pkg_name.text = pkg_xml.find("./name").text
        self.append(pkg_name)

        p = HtmlElement(html.Grouping.p)
        p.set("align", "center")
        img = HtmlElement(html.EmbeddedContent.img)
        img.set("src", "../dot/gen/%s.png" % pkg_xml.find("./name").text)

        p.append(img)
        self.append(p)

        pkg_summary_title = HtmlElement(html.Sections.h2)
        pkg_summary_title.text = "%i. Package Summary" % self.index_h2()
        self.append(pkg_summary_title)

        try:
            self.append(PackageSummary(pkgdir, pkg_xml))
        except Exception as ex:
            html.HTMLException(ex, self)

        pkg_desc_title = HtmlElement(html.Sections.h2)
        pkg_desc_title.text = "%i. Package description" % self.index_h2()
        self.append(pkg_desc_title)

        try:
            self.append(PackageDescription(pkgdir, pkg_xml))
        except Exception as ex:
            html.HTMLException(ex, self)

        pkg_dep_title = HtmlElement(html.Sections.h2)
        pkg_dep_title.text = "%i. Package dependencies" % self.index_h2()
        self.append(pkg_dep_title)

        try:
            self._dep_pkg = PackageDependencies(pkgdir, pkg_xml)
            self.append(self._dep_pkg)
        except Exception as ex:
            html.HTMLException(ex, self)
    def __init__(self, pkgdir, pkg_xml):
        HtmlElement.__init__(self,
                             tag=html.Sections.article,
                             attrib={"class": "pkg-dep"})

        self._dep_lists = []

        p = HtmlElement(html.Grouping.p)
        p.text = 'List of first order '
        dep_href = HtmlElement(html.Text.a)
        dep_href.set("href", "http://wiki.ros.org/catkin/package.xml")
        dep_href.set("target", "_blank")
        dep_href.text = "package dependencies :"
        p.append(dep_href)

        ul = HtmlElement(html.Grouping.ul)

        for dep in pkg_xml.iter("build_depend"):
            li = HtmlElement(html.Grouping.li)
            li.text = dep.text
            self._dep_lists.append(dep.text)
            ul.append(li)

        p.append(ul)
        self.append(p)
Exemple #5
0
    def read(self, pkgdir, f_cmake, digraph):

        has_action = False
        add_ac_dot_model = AddActionFilesDotModel()

        p = HtmlElement(html.Grouping.p)
        p.text = 'List of generated '
        dep_href = HtmlElement(html.Text.a)
        dep_href.set("href", "http://wiki.ros.org")
        dep_href.set("target", "_blank")
        dep_href.text = "action file :"
        p.append(dep_href)

        ul = HtmlElement(html.Grouping.ul)
        for msg in re.finditer(r"(.*?)\.action", f_cmake):
            msfound = msg.group()
            if '#' not in msfound:
                li = HtmlElement(html.Grouping.li)
                rac = msfound.replace(' ', '')
                li.text = rac
                add_ac_dot_model.add(rac)
                ul.append(li)
                has_action = True

        p.append(ul)
        self.append(p)

        if has_action is True:
            digraph.addNode(add_ac_dot_model)
            digraph.connect(digraph.getRootNode(), add_ac_dot_model)

        return has_action
Exemple #6
0
    def read(self, pkgdir, f_cmake, digraph):

        has_exec = False
        add_exec_dot_model = AddExecutableDotModel()

        p = HtmlElement(html.Grouping.p)
        p.text = 'List of generated '
        dep_href = HtmlElement(html.Text.a)
        dep_href.set("href", "http://wiki.ros.org/catkin/CMakeLists.txt")
        dep_href.set("target", "_blank")
        dep_href.text = "executables :"
        p.append(dep_href)

        ul = HtmlElement(html.Grouping.ul)

        for lib in re.finditer("(.*?)add_executable\((?P<exec>(.+?){1,})",
                               f_cmake):
            libfound = lib.group()
            if '#' not in libfound:
                li = HtmlElement(html.Grouping.li)
                rexec = lib.group('exec').split('/')[0].split(' ')[0]
                li.text = rexec
                add_exec_dot_model.add(rexec)
                ul.append(li)
                has_exec = True

        p.append(ul)
        self.append(p)

        if has_exec is True:
            digraph.addNode(add_exec_dot_model)
            digraph.connect(digraph.getRootNode(), add_exec_dot_model)

        return has_exec
Exemple #7
0
    def read(self, node_name, node_xml):

        digraph = self._create_digraph(node_name)

        for child in node_xml.find('io'):
            if child.tag == "topics":
                try:
                    self._read_topics(child, digraph)
                except:
                    continue
            elif child.tag == "actionlib":
                try:
                    self._read_actionlibs(child, digraph)
                except:
                    continue
            elif child.tag == "services":
                try:
                    self._read_services(child, digraph)
                except:
                    continue
            else:
                html.HTMLException(
                    "Unknown io tag '%s' from node %s !" %
                    (child.tag, node_name), self)

        digraph.saveDot(env.ROSDOC_DOT + "/io/%s.dot" % node_name)
        digraph.dotToPng(env.ROSDOC_DOT + "/io/%s.png" % node_name)

        p = HtmlElement(html.Grouping.p)
        p.set("align", "center")
        img = HtmlElement(html.EmbeddedContent.img)
        img.set("src", "../dot/io/%s.png" % node_name)

        p.append(img)
        self.append(p)

        return True
Exemple #8
0
    def read(self, launch_file):
        
        digraph = Digraph("LaunchGraph")
        digraph.setAttrib(Digraph.NODESEP, 0.1)
#         digraph.setAttrib(Digraph.RANKDIR, 'LR')
         
        nconf = NODE("node")
        nconf.setAttrib(NODE.SHAPE, SHAPE.Plaintext)
        digraph.addNode(nconf)
        
        name = launch_file.split('/')[-1].split('.')[0]
        
        pkg = NODE(name)
        pkg.setAttrib(NODE.SHAPE, SHAPE.Ellipse)
        pkg.setAttrib(NODE.STYLE, STYLE.FILLED)
        pkg.setAttrib(NODE.COLOR, RgbColor.CornflowerBlue)
        pkg.setAttrib(NODE.FONTSIZE, 22)
        digraph.addRootNode(pkg)
        
        self._parse(launch_file, digraph)
        
        digraph.saveDot(env.ROSDOC_DOT+"/launch/%s.dot"%name)
        digraph.dotToPng(env.ROSDOC_DOT+"/launch/%s.png"%name)
        
        a = HtmlElement(html.Text.a)
        a.set(html.Attrib.href,"../dot/launch/%s.png"%name)
        a.set("target", "_blank")
        
        p = HtmlElement(html.Grouping.p)
        p.set("align","center")
        img = HtmlElement(html.EmbeddedContent.img)
        img.set("src","../dot/launch/%s.png"%name)
        
        p.append(img)
        a.append(p)
        self.append(a)
Exemple #9
0
 def __init__(self, packages_dir_list):
     HtmlElement.__init__(self,
                          tag=html.Sections.article,
                          attrib={"class":"ros_ws"})
     
     self.generate_ws_dot(packages_dir_list)
     
     a = HtmlElement(html.Text.a)
     a.set(html.Attrib.href,"../dot/agi_workspace.png")
     a.set("target", "_blank")
     
     p = HtmlElement(html.Grouping.p)
     p.set("align","center")
     
     img = HtmlElement(html.EmbeddedContent.img)
     img.set("src","../dot/agi_workspace.png")
     img.set("width","1024")
     img.set("height","150")
     
     p.append(img)
     
     a.append(p)
     
     self.append(a)
Exemple #10
0
    def read(self, pkgdir, pkg_name, digraph):

        has_exec = False
        add_exec_dot_model = AddExecutableDotModel(
            "add_py_executable", "Python executable generated")

        p = HtmlElement(html.Grouping.p)
        p.text = 'List of generated '
        dep_href = HtmlElement(html.Text.a)
        dep_href.set("href", "http://wiki.ros.org/catkin/CMakeLists.txt")
        dep_href.set("target", "_blank")
        dep_href.text = "python executables :"
        p.append(dep_href)

        ul = HtmlElement(html.Grouping.ul)

        fscripts = pkgdir + '/scripts'
        fnodes = pkgdir + '/nodes'

        if os.path.isdir(fscripts):
            for filename in os.listdir(fscripts):
                if filename != "__init__.py":
                    li = HtmlElement(html.Grouping.li)
                    li.text = filename
                    add_exec_dot_model.add(filename)
                    ul.append(li)
                    has_exec = True

        if os.path.isdir(fnodes):
            for filename in os.listdir(fnodes):
                if filename != "__init__.py":
                    li = HtmlElement(html.Grouping.li)
                    li.text = filename
                    add_exec_dot_model.add(filename)
                    ul.append(li)
                    has_exec = True

        p.append(ul)
        self.append(p)

        if has_exec is True:
            digraph.addNode(add_exec_dot_model)
            digraph.connect(digraph.getRootNode(), add_exec_dot_model)

        return has_exec
Exemple #11
0
 def __init__(self, index, launch_file):
     
     HtmlElementTree.__init__(self, index.getroot())
     
     self._filename = launch_file.split("/")[-1]
     
     div = self.getroot().find("./body/div")
     
     section = HtmlElement(html.Sections.section)
     #{
     
     title = HtmlElement(html.Sections.h1)
     title.text = self._filename.replace(".launch","")
     section.append(title)
     
     diagram_title = HtmlElement(html.Sections.h2)
     diagram_title.text = "1. Launch diagram"
     section.append(diagram_title)
     
     roslaunch = HtmlElement(html.Grouping.p)
     roslaunch.text = """roslaunch is a tool for easily launching multiple ROS nodes locally and remotely via SSH,
      as well as setting parameters on the Parameter Server.
      It includes options to automatically respawn processes that have already died.
      roslaunch takes in one or more XML configuration files (with the .launch extension) that specify the parameters to set and nodes to launch,
      as well as the machines that they should be run on."""
     section.append(roslaunch)
     
     try:
         launch_dot_generator = ConfigLaunch()
         launch_dot_generator.read(launch_file)
         section.append(launch_dot_generator)
     except Exception as ex:
         html.HTMLException(ex, section)
     #}
     
     div.append(section)
Exemple #12
0
 def __init__(self, pkgdir, pkg_xml):
     HtmlElement.__init__(self,
                          tag=html.Grouping.ul)
     
     version = HtmlElement(html.Grouping.li)
     version.text = "Version : %s"%pkg_xml.find("./version").text
     self.append(version)
     
     mtr = pkg_xml.find("./maintainer")
     
     maintainer_li = HtmlElement(html.Grouping.li)
     maintainer_li.text = "Maintainer : "
     maintainer = HtmlElement(html.Text.a)
     try:
         maintainer.set(html.Attrib.href, "mailto:%s"%mtr.attrib['email'])
     except:
         pass
     maintainer.text = mtr.text
     maintainer_li.append(maintainer)
     self.append(maintainer_li)
     
     llicense = HtmlElement(html.Grouping.li)
     llicense.text = "License : %s"%pkg_xml.find("./license").text
     self.append(llicense)
     
     if pkg_xml.find("./url") is not None:
         li = HtmlElement(html.Grouping.li)
         li.text = "Link : "
         url = HtmlElement(html.Text.a)
         url.set("href",pkg_xml.find("./url").text)
         url.set("target", "_blank")
         url.text  = pkg_xml.find("./url").text
         li.append(url)
         self.append(li)
         
     if pkg_xml.find("./export/rosdoc") is not None:
         li = HtmlElement(html.Grouping.li)
         li.text = "Sources : "
         doxygen = HtmlElement(html.Text.a)
         ref = pkgdir+"/doc/html/index.html"
         doxygen.set("href", ref)
         doxygen.set("target", "_blank")
         doxygen.text = "doxygen"
         li.append(doxygen)
         self.append(li)
Exemple #13
0
 def __init__(self, index, packages_dir):
     
     HtmlElementTree.__init__(self, index.getroot())
     
     div = self.getroot().find("./body/div")
     
     section = HtmlElement(html.Sections.section)
     #{
     
     title = HtmlElement(html.Sections.h2)
     title.text = "1. Overview"
     section.append(title)
     
     aros_title = HtmlElement(html.Sections.h3)
     aros_title.text = "1.1 About ROS"
     section.append(aros_title)
     
     aros_article = HtmlElement(html.Sections.article)
     aros_article.text = """The Robot Operating System (ROS) is a flexible framework for writing robot software.
        It is a collection of tools,
        libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms."""
     section.append(aros_article)
     
     ws_title = HtmlElement(html.Sections.h3)
     ws_title.text = "1.2 AGI ROS Workspace"
     section.append(ws_title)
     
     try:
         section.append(RosWorkspace(packages_dir))
     except Exception as ex:
         html.HTMLException(ex, section)
     
     dev_title = HtmlElement(html.Sections.h3)
     dev_title.text = "1.3 Team"
     section.append(dev_title)
     
     ref_title = HtmlElement(html.Sections.h3)
     ref_title.text = "1.4 References"
     section.append(ref_title)
     
     #}
     
     div.append(section)