Beispiel #1
0
 def __init__(self, pkgdir):
     HtmlElement.__init__(self,
                          tag=html.Sections.section,
                          attrib={"class":"package"})
     self._h2_index = 0
     self._dep_pkg = None
     pkg_xml = None
     # Load and read package.xml ressource
     pkg_xml_dir = pkgdir+'/package.xml'
     if os.access(pkg_xml_dir, os.R_OK):
         pkg_xml = html.loadHtml(pkg_xml_dir)
         self._read_pkg_xml(pkgdir, pkg_xml)
     else:
         html.HTMLException("Cannot found %s !"%pkg_xml_dir, self)
     
     # Load and read CMakeLists.txt ressource
     cmakelists_dir = pkgdir+'/CMakeLists.txt'
     if os.access(cmakelists_dir, os.R_OK):
         with open(cmakelists_dir) as fp:
             cmakelists = fp.read()
             self._read_cmakelists(pkgdir, cmakelists)
     else:
         html.HTMLException("Cannot found %s !"%cmakelists_dir, self)
         
     if pkg_xml is not None:
         self._read_agi_doc_xml(pkgdir, pkg_xml)
Beispiel #2
0
 def __init__(self, pkgdir, pkg_xml):
     HtmlElement.__init__(self,
                          tag=html.Grouping.p)
     
     try:
         self.append(pkg_xml.find("./description"))
     except:
         try:
             self.text = pkg_xml.find("./description").text
         except:
             raise Exception("Connot found description tag into %s/package.xml"%pkgdir)
Beispiel #3
0
 def _read_cmakelists(self, pkgdir, cmakefile):
     
     try:
         pkg = PackageGenerations()
         dep_list = self._dep_pkg.get_dependencies_lists()
         if pkg.read(pkgdir, cmakefile, dep_list) is True:
             pkg_build_title = HtmlElement(html.Sections.h2)
             pkg_build_title.text = "%i. Package generation(s)"%self.index_h2()
             self.append(pkg_build_title)
             self.append(pkg)
     except Exception as ex:
         html.HTMLException(ex, self)
Beispiel #4
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
Beispiel #5
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
Beispiel #6
0
 def _read_agi_doc_xml(self, pkgdir, pkg_xml):
     
     agidoc_elem = pkg_xml.find("./export/agidoc")
     
     if agidoc_elem is not None:
         if 'src' in agidoc_elem.attrib:
             fdoc = os.path.join(pkgdir, agidoc_elem.attrib['src'])
             if os.path.isfile(fdoc):
                 agi = AgiDoc()
                 if agi.read(pkgdir, html.loadHtml(fdoc), self._h2_index+1) is True:
                     title = HtmlElement(html.Sections.h2)
                     title.text = "%i. More description"%self.index_h2()
                     self.append(title)
                     self.append(agi)
             else:
                 html.HTMLException("Cannot open agidoc '%s'"%fdoc, self)
     else:
         html.HTMLException("AGI documentation not found !", self)
Beispiel #7
0
 def __init__(self, name, href='#', subitem=True):
     HtmlElement.__init__(self, tag = html.Grouping.li)
     
     root = HtmlElement(tag=html.Text.a)
     root.set(html.Attrib.href, href)
     root.text = name
     self.append(root)
     
     self._container_menu = HtmlElement(tag=html.Grouping.ul)
     
     if subitem:
         self.append(self._container_menu)
Beispiel #8
0
 def read(self, pkgdir, agi_xml, index):
     
     index_node=0
     
     for node_xml in agi_xml.iter('node'):
         index_node+=1
         title = HtmlElement(html.Sections.h3)
         node_name = node_xml.attrib['name']
         title.text = "%i.%i. %s"%(index, index_node, node_name)
         self.append(title)
         
         try:
             ros_node = RosNode()
             if ros_node.read(node_name, node_xml, index, index_node) is True:
                 self.append(ros_node)
         except Exception as ex:
             html.HTMLException(ex, self)
         
     if index_node is 0:
         return False
     else:
         return True
Beispiel #9
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
Beispiel #10
0
 def read(self, node_name, node_xml, isection, iarticle):
     
     item_index = 0
     
     try:
         node_desc = NodeDescription()
         if node_desc.read(node_name, node_xml) is True:
             item_index += 1
             title = HtmlElement(html.Sections.h4)
             title.text = "%i.%i.%i. Description"%(isection, iarticle, item_index)
             self.append(title)
             self.append(node_desc)
     except Exception as ex:
         html.HTMLException(ex,self)
         
     try:
         node_io = NodeInputOutput()
         if node_io.read(node_name, node_xml) is True:
             item_index += 1
             title = HtmlElement(html.Sections.h4)
             title.text = "%i.%i.%i. Input/Output"%(isection, iarticle, item_index)
             self.append(title)
             self.append(node_io)
     except Exception as ex:
         html.HTMLException(ex,self)
         
     try:
         node_params = NodeParameters()
         if node_params.read(node_name, node_xml) is True:
             item_index += 1
             title = HtmlElement(html.Sections.h4)
             title.text = "%i.%i.%i. Parameter(s)"%(isection, iarticle, item_index)
             self.append(title)
             self.append(node_params)
     except Exception as ex:
         html.HTMLException(ex,self)
     
     if item_index is 0:
         return False
     else:
         return True
Beispiel #11
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
Beispiel #12
0
 def __init__(self):
     HtmlElement.__init__(self,
                          tag=html.Sections.section,
                          attrib={"class":"nodes"})
Beispiel #13
0
 def __init__(self):
     HtmlElement.__init__(self,
                          tag=html.Sections.article,
                          attrib={"class": "io-node"})
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
0
 def __init__(self):
     HtmlElement.__init__(self,
                          tag=html.Sections.article,
                          attrib={"class": "generation"})
Beispiel #17
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)
Beispiel #18
0
 def __init__(self):
     HtmlElement.__init__(self, tag=html.Sections.article)
Beispiel #19
0
 def __init__(self):
     HtmlElement.__init__(self,
                          tag=html.Sections.article,
                          attrib={"class":"parameters"})
Beispiel #20
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
Beispiel #21
0
 def __init__(self, menu_id):
     HtmlElement.__init__(self, tag=html.Grouping.div)
     self.set(html.Attrib.id, menu_id)
Beispiel #22
0
    def read(self, pkgdir, f_cmake, dep_pkg_list):

        index = 0
        pkg_name = pkgdir.split('/')[-1]
        digraph = self._create_digraph(pkg_name, dep_pkg_list)

        #         p = HtmlElement(html.Grouping.p)
        #         img = HtmlElement(html.EmbeddedContent.img)
        #         img.set("src","resources/dot/gen/%s.png"%pkg_name)
        #
        #         p.append(img)
        #         self.append(p)

        try:
            msgs = MessageFilesGeneration()
            if msgs.read(pkgdir, f_cmake, digraph) is True:
                index += 1
                title = HtmlElement(html.Sections.h3)
                title.text = "4.%i Message(s)" % index
                self.append(title)
                self.append(msgs)
        except Exception as ex:
            html.HTMLException(ex, self)

        try:
            ac = ActionFilesGeneration()
            if ac.read(pkgdir, f_cmake, digraph) is True:
                index += 1
                title = HtmlElement(html.Sections.h3)
                title.text = "4.%i Action(s)" % index
                self.append(title)
                self.append(ac)
        except Exception as ex:
            html.HTMLException(ex, self)

        try:
            srv = ServiceFilesGeneration()
            if srv.read(pkgdir, f_cmake, digraph) is True:
                index += 1
                title = HtmlElement(html.Sections.h3)
                title.text = "4.%i Service(s)" % index
                self.append(title)
                self.append(srv)
        except Exception as ex:
            html.HTMLException(ex, self)

        try:
            lib = LibrarieGeneration()
            if lib.read(pkgdir, f_cmake, digraph) is True:
                index += 1
                title = HtmlElement(html.Sections.h3)
                title.text = "4.%i Librarie(s)" % index
                self.append(title)
                self.append(lib)
        except Exception as ex:
            html.HTMLException(ex, self)

        try:
            exe = ExecutableGeneration()
            if exe.read(pkgdir, f_cmake, digraph) is True:
                index += 1
                title = HtmlElement(html.Sections.h3)
                title.text = "4.%i Executable(s)" % index
                self.append(title)
                self.append(exe)
        except Exception as ex:
            html.HTMLException(ex, self)

        try:
            pyexe = PyExecutableGeneration()
            if pyexe.read(pkgdir, pkg_name, digraph) is True:
                index += 1
                title = HtmlElement(html.Sections.h3)
                title.text = "4.%i Python executable(s)" % index
                self.append(title)
                self.append(pyexe)
        except Exception as ex:
            html.HTMLException(ex, self)

        digraph.saveDot(env.ROSDOC_DOT + "/gen/%s.dot" % pkg_name)
        digraph.dotToPng(env.ROSDOC_DOT + "/gen/%s.png" % pkg_name)

        if index is 0:
            return False
        else:
            return True
Beispiel #23
0
 def __init__(self):
     HtmlElement.__init__(self, tag=html.Grouping.p)
Beispiel #24
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
Beispiel #25
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)
Beispiel #26
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)
Beispiel #27
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)