Added missing get() method

This commit is contained in:
Jack Jansen 1996-01-29 15:45:09 +00:00
parent bdd0747193
commit 7e156a70fa
1 changed files with 24 additions and 0 deletions

View File

@ -154,10 +154,34 @@ class TalkTo:
"""Send an appleevent given code/subcode/pars/attrs and unpack the reply""" """Send an appleevent given code/subcode/pars/attrs and unpack the reply"""
return self.sendevent(self.newevent(code, subcode, parameters, attributes)) return self.sendevent(self.newevent(code, subcode, parameters, attributes))
#
# The following events are somehow "standard" and don't seem to appear in any
# suite...
#
def activate(self): def activate(self):
"""Send 'activate' command""" """Send 'activate' command"""
self.send('misc', 'actv') self.send('misc', 'actv')
def get(self, _object, _attributes={}):
"""get: get data from an object
Required argument: the object
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the data
"""
_code = 'core'
_subcode = 'getd'
_arguments = {'----':_object}
_reply, _arguments, _attributes = self.send(_code, _subcode,
_arguments, _attributes)
if _arguments.has_key('errn'):
raise MacOS.Error, decodeerror(_arguments)
if _arguments.has_key('----'):
return _arguments['----']
# Test program # Test program
# XXXX Should test more, really... # XXXX Should test more, really...