示例#1
0
	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))
示例#2
0
 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))
示例#3
0
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)
示例#4
0
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)
示例#5
0
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)
示例#6
0
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)
示例#7
0
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()
示例#8
0
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()
示例#9
0
	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))
示例#10
0
					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'

示例#11
0
					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

示例#12
0
                    )  # 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'