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
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)
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
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
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)
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)
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
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 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
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)
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)