示例#1
0
	def __init__(self, osaxname='StandardAdditions', name=None, id=None, creator=None, pid=None, url=None, aemapp=None, terms=True):
		if not _osaxcache:
			_initcaches()
		self._osaxname = osaxname
		osaxname = osaxname.lower()
		if osaxname.endswith('.osax'):
			osaxname = osaxname[:-5]
		if terms == True:
			try:
				osaxpath, terms = _osaxcache[osaxname]
			except KeyError:
				raise ValueError("Scripting addition not found: %r" % self._osaxname)
			if not terms:
				try:
					aete = aem.ae.getappterminology(osaxpath)
				except NotImplementedError:
					if osaxname == 'standardadditions':
						terms = _osaxcache[osaxname][1] = terminology.tablesformodule(StandardAdditionsGlue)
					else:
						raise
				else:
					terms = _osaxcache[osaxname][1] = terminology.tablesforaetes(aete)
		reference.Application.__init__(self, name, id, creator, pid, url, aemapp, terms)
		try:
			self.AS_appdata.target().event('ascrgdut').send(300) # make sure target application has loaded event handlers for all installed OSAXen
		except aem.EventError, e:
			if e.errornumber != -1708: # ignore 'event not handled' error
				raise
示例#2
0
文件: osax.py 项目: architg1/taar
	def __init__(self, osaxname='StandardAdditions', name=None, id=None, creator=None, pid=None, url=None, aemapp=None, terms=True):
		if not _osaxcache:
			_initcaches()
		self._osaxname = osaxname
		osaxname = osaxname.lower()
		if osaxname.endswith('.osax'):
			osaxname = osaxname[:-5]
		if terms == True:
			try:
				osaxpath, terms = _osaxcache[osaxname]
			except KeyError as e:
				raise ValueError("Scripting addition not found: {!r}".format(self._osaxname)) from e
			if not terms:
				p = SdefParser()
				p.parsefile(osaxpath)
				if osaxname == 'standardadditions':
					p.enums += kStandardAdditionsEnums # patch in missing codes for compatibility
				terms = _osaxcache[osaxname][1] = terminology.tablesformodule(p)
		reference.Application.__init__(self, name, id, creator, pid, url, aemapp, terms)
		try:
			self.AS_appdata.target().event(b'ascrgdut').send(300) # make sure target application has loaded event handlers for all installed OSAXen
		except aem.EventError as e:
			if e.errornumber != -1708: # ignore 'event not handled' error
				raise
		def _help(*args):
			raise NotImplementedError("Built-in help isn't available for scripting additions.")
		self.AS_appdata.help = _help
示例#3
0
	def __init__(self, osaxname='StandardAdditions', name=None, id=None, creator=None, pid=None, url=None, aemapp=None, terms=True):
		if not _osaxcache:
			_initcaches()
		self._osaxname = osaxname
		osaxname = osaxname.lower()
		if osaxname.endswith('.osax'):
			osaxname = osaxname[:-5]
		if terms == True:
			try:
				osaxpath, terms = _osaxcache[osaxname]
			except KeyError:
				raise KeyError("Scripting addition not found: %r" % self._osaxname)
			if not terms:
				try:
					aete = aem.ae.getappterminology(osaxpath)
				except NotImplementedError:
					if osaxname == 'standardadditions':
						terms = _osaxcache[osaxname][1] = terminology.tablesformodule(StandardAdditionsGlue)
					else:
						raise
				else:
					terms = _osaxcache[osaxname][1] = terminology.tablesforaetes(aete)
		reference.Application.__init__(self, name, id, creator, pid, url, aemapp, terms)
		try:
			self.AS_appdata.target().event('ascrgdut').send(300) # make sure target application has loaded event handlers for all installed OSAXen
		except aem.EventError, e:
			if e.errornumber != -1708: # ignore 'event not handled' error
				raise