def __init__(self, path, url, out=_Out()): self.output = out if path: self.terms = aeteparser.parseapp(path) else: from remoteterminology import getRemoteAetes self.terms = aeteparser.parsedata(getRemoteAetes(url))
def doc(apppath, outdir, style='py-appscript', options=[]): """Render XHTML files listing a scriptable application/scripting addition's classes and commands. apppath : str -- name or path to application/path to scripting addition outdir : str -- the directory to write the dictionary to (will be created if it doesn't already exist) style : str -- keyword formatting style ('py-appscript', 'rb-appscript' or 'applescript') options : list of str -- formatting options (zero or more of: 'collapse', 'showall') Result : bool -- False if no terminology was found and no file was written; else True """ terms = aeteparser.parseapp(findapp.byname(apppath), style) return renderdictionary(terms, outdir, style, options)
def doc(apppath, outfile, style='py-appscript', options=[], template=None): """Render an XHTML file listing a scriptable application/scripting addition's classes and commands. apppath : str -- name or path to application/path to scripting addition outfile : str -- the file to write style : str -- keyword formatting style ('py-appscript', 'rb-appscript' or 'applescript') options : list of str -- formatting options (zero or more of: 'collapse', 'showall') template : str -- custom HTML template to use Result : bool -- False if no terminology was found and no file was written; else True """ terms = aeteparser.parseapp(findapp.byname(apppath), style) result = renderdictionary(terms, style, options, template) if result: f = open(outfile, 'w') f.write(str(result)) f.close() return bool(result)
def doc(path, file, style='appscript', options=[], template=None): """Render an XHTML file listing a scriptable application's classes and commands. path : str -- name or path to application file : str -- HTML file's destination. style : str -- keyword formatting style ('appscript' or 'applescript') options : list of str -- formatting options ([] or ['collapse']) template : str -- custom HTML template to use """ if path.endswith('.sdef'): terms = sdefparser.parsefile(path, style) elif path.endswith('.aete'): terms = aeteparser.parsefile(path, style) else: terms = aeteparser.parseapp(findapp.byname(path), style) if terms.suites(): if template: tpl = Template(renderTemplate, template) else: tpl = _template result = encodeNonASCII(tpl.render(terms, typerenderers[style](), options)) f = open(expanduser(file), 'w') f.write(str(result)) f.close()
def doc(path, file, style='appscript', options=[], template=None): """Render an XHTML file listing a scriptable application's classes and commands. path : str -- name or path to application file : str -- HTML file's destination. style : str -- keyword formatting style ('appscript' or 'applescript') options : list of str -- formatting options ([] or ['collapse']) template : str -- custom HTML template to use """ if path.endswith('.sdef'): terms = sdefparser.parsefile(path, style) elif path.endswith('.aete'): terms = aeteparser.parsefile(path, style) else: terms = aeteparser.parseapp(findapp.byname(path), style) if terms.suites(): if template: tpl = Template(renderTemplate, template) else: tpl = _template result = encodeNonASCII( tpl.render(terms, typerenderers[style](), options)) f = open(expanduser(file), 'w') f.write(str(result)) f.close()
def __init__(self, path, url, out=_Out()): self.output = out if path: self.terms = aeteparser.parseapp(path) else: self.terms = aeteparser.parsedata(terminology.getaetedata(url=url))
elemclass = elem.type.realvalue() # TO DO: asking for realvalue is dodgy; need to ensure we get a class definition iscontinued = elem.type in visited if maxdepth < 2: p, e = self._relationships(elemclass) iscontinued = iscontinued or p or e self.renderer.add(elem.name, None, True, i == len(elements), iscontinued) if not elem.type in visited and maxdepth > 1: render(elemclass, allvisited, maxdepth - 1) self.renderer.up() klass = self.terms.classes().byname(classname) self.renderer.add(classname, None, False, False) render(klass, [], maxdepth) ###################################################################### # TEST ###################################################################### if __name__ == '__main__': #p = '/Applications/TextEdit.app' p = '/System/Library/CoreServices/Finder.app' # p = '/System/Library/CoreServices/System Events.app' #p = '/Applications/Automator.app' #p = '/Applications/Microsoft Office X/Microsoft Word' terms = aeteparser.parseapp(p, style='applescript') o = RelationshipGrapher(terms, TextRenderer()) o.draw(maxdepth=5) # 'folder'
self.renderer.add(thisClass.name, True, False, True) # render classname, marking it as 'to be continued' for _ in lst[:-1]: self.renderer.up() else: # print full tree for klass in self.terms.classes(): if not [o for o in klass.parents() if o.kind == 'class']: # is it a root class? (ignores invalid superclasses, e.g. Mail 2.0.7) self._renderSubclasses([klass.name], []) ###################################################################### # TEST ###################################################################### if __name__ == '__main__': # p = '/Applications/TextEdit.app' # p = '/System/Library/CoreServices/Finder.app' # p = '/Applications/Automator.app' #p = '/Applications/Microsoft Office X/Microsoft Word' p = '/Applications/ical.app' terms = aeteparser.parseapp(p) o = InheritanceGrapher(terms, TextRenderer()) from time import time as t #tt=t() o.draw() print '\n\n\n' o.draw('window') # #print t()-tt
) # TO DO: asking for realvalue is dodgy; need to ensure we get a class definition iscontinued = elem.type in visited if maxdepth < 2: p, e = self._relationships(elemclass) iscontinued = iscontinued or p or e self.renderer.add(elem.name, None, True, i == len(elements), iscontinued) if not elem.type in visited and maxdepth > 1: render(elemclass, allvisited, maxdepth - 1) self.renderer.up() klass = self.terms.classes().byname(classname) self.renderer.add(classname, None, False, False) render(klass, [], maxdepth) ###################################################################### # TEST ###################################################################### if __name__ == '__main__': #p = '/Applications/TextEdit.app' p = '/System/Library/CoreServices/Finder.app' # p = '/System/Library/CoreServices/System Events.app' #p = '/Applications/Automator.app' #p = '/Applications/Microsoft Office X/Microsoft Word' terms = aeteparser.parseapp(p, style='applescript') o = RelationshipGrapher(terms, TextRenderer()) o.draw(maxdepth=5) # 'folder'