2002-01-22 19:20:12 -04:00
|
|
|
"""Suite builtin_Suite: Every application supports open, reopen, print, run, and quit
|
|
|
|
Level 1, version 1
|
|
|
|
"""
|
|
|
|
|
|
|
|
import aetools
|
|
|
|
import MacOS
|
|
|
|
|
|
|
|
_code = 'aevt'
|
|
|
|
|
|
|
|
class builtin_Suite_Events:
|
|
|
|
|
2004-07-18 03:16:08 -03:00
|
|
|
def open(self, _object, _attributes={}, **_arguments):
|
|
|
|
"""open: Open the specified object(s)
|
|
|
|
Required argument: list of objects to open
|
|
|
|
Keyword argument _attributes: AppleEvent attribute dictionary
|
|
|
|
"""
|
|
|
|
_code = 'aevt'
|
|
|
|
_subcode = 'odoc'
|
|
|
|
|
|
|
|
if _arguments: raise TypeError, 'No optional args expected'
|
|
|
|
_arguments['----'] = _object
|
|
|
|
|
|
|
|
|
|
|
|
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
|
|
|
_arguments, _attributes)
|
|
|
|
if _arguments.get('errn', 0):
|
|
|
|
raise aetools.Error, aetools.decodeerror(_arguments)
|
|
|
|
# XXXX Optionally decode result
|
|
|
|
if _arguments.has_key('----'):
|
|
|
|
return _arguments['----']
|
|
|
|
|
|
|
|
def run(self, _no_object=None, _attributes={}, **_arguments):
|
|
|
|
"""run: Run an application. Most applications will open an empty, untitled window.
|
|
|
|
Keyword argument _attributes: AppleEvent attribute dictionary
|
|
|
|
"""
|
|
|
|
_code = 'aevt'
|
|
|
|
_subcode = 'oapp'
|
|
|
|
|
|
|
|
if _arguments: raise TypeError, 'No optional args expected'
|
2008-03-29 12:24:25 -03:00
|
|
|
if _no_object is not None: raise TypeError, 'No direct arg expected'
|
2004-07-18 03:16:08 -03:00
|
|
|
|
|
|
|
|
|
|
|
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
|
|
|
_arguments, _attributes)
|
|
|
|
if _arguments.get('errn', 0):
|
|
|
|
raise aetools.Error, aetools.decodeerror(_arguments)
|
|
|
|
# XXXX Optionally decode result
|
|
|
|
if _arguments.has_key('----'):
|
|
|
|
return _arguments['----']
|
|
|
|
|
|
|
|
def reopen(self, _no_object=None, _attributes={}, **_arguments):
|
|
|
|
"""reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
|
|
|
|
Keyword argument _attributes: AppleEvent attribute dictionary
|
|
|
|
"""
|
|
|
|
_code = 'aevt'
|
|
|
|
_subcode = 'rapp'
|
|
|
|
|
|
|
|
if _arguments: raise TypeError, 'No optional args expected'
|
2008-03-29 12:24:25 -03:00
|
|
|
if _no_object is not None: raise TypeError, 'No direct arg expected'
|
2004-07-18 03:16:08 -03:00
|
|
|
|
|
|
|
|
|
|
|
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
|
|
|
_arguments, _attributes)
|
|
|
|
if _arguments.get('errn', 0):
|
|
|
|
raise aetools.Error, aetools.decodeerror(_arguments)
|
|
|
|
# XXXX Optionally decode result
|
|
|
|
if _arguments.has_key('----'):
|
|
|
|
return _arguments['----']
|
|
|
|
|
|
|
|
def _print(self, _object, _attributes={}, **_arguments):
|
|
|
|
"""print: Print the specified object(s)
|
|
|
|
Required argument: list of objects to print
|
|
|
|
Keyword argument _attributes: AppleEvent attribute dictionary
|
|
|
|
"""
|
|
|
|
_code = 'aevt'
|
|
|
|
_subcode = 'pdoc'
|
|
|
|
|
|
|
|
if _arguments: raise TypeError, 'No optional args expected'
|
|
|
|
_arguments['----'] = _object
|
|
|
|
|
|
|
|
|
|
|
|
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
|
|
|
_arguments, _attributes)
|
|
|
|
if _arguments.get('errn', 0):
|
|
|
|
raise aetools.Error, aetools.decodeerror(_arguments)
|
|
|
|
# XXXX Optionally decode result
|
|
|
|
if _arguments.has_key('----'):
|
|
|
|
return _arguments['----']
|
|
|
|
|
|
|
|
_argmap_quit = {
|
|
|
|
'saving' : 'savo',
|
|
|
|
}
|
|
|
|
|
|
|
|
def quit(self, _no_object=None, _attributes={}, **_arguments):
|
|
|
|
"""quit: Quit an application
|
|
|
|
Keyword argument saving: specifies whether to save currently open documents
|
|
|
|
Keyword argument _attributes: AppleEvent attribute dictionary
|
|
|
|
"""
|
|
|
|
_code = 'aevt'
|
|
|
|
_subcode = 'quit'
|
|
|
|
|
|
|
|
aetools.keysubst(_arguments, self._argmap_quit)
|
2008-03-29 12:24:25 -03:00
|
|
|
if _no_object is not None: raise TypeError, 'No direct arg expected'
|
2004-07-18 03:16:08 -03:00
|
|
|
|
|
|
|
aetools.enumsubst(_arguments, 'savo', _Enum_savo)
|
|
|
|
|
|
|
|
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
|
|
|
_arguments, _attributes)
|
|
|
|
if _arguments.get('errn', 0):
|
|
|
|
raise aetools.Error, aetools.decodeerror(_arguments)
|
|
|
|
# XXXX Optionally decode result
|
|
|
|
if _arguments.has_key('----'):
|
|
|
|
return _arguments['----']
|
|
|
|
|
|
|
|
_argmap_close = {
|
|
|
|
'saving' : 'savo',
|
|
|
|
'saving_in' : 'kfil',
|
|
|
|
}
|
2002-01-22 19:20:12 -04:00
|
|
|
|
|
|
|
_Enum_savo = {
|
2004-07-18 03:16:08 -03:00
|
|
|
'yes' : 'yes ', # Save objects now
|
|
|
|
'no' : 'no ', # Do not save objects
|
|
|
|
'ask' : 'ask ', # Ask the user whether to save
|
2002-01-22 19:20:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Indices of types declared in this module
|
|
|
|
#
|
|
|
|
_classdeclarations = {
|
|
|
|
}
|
|
|
|
|
|
|
|
_propdeclarations = {
|
|
|
|
}
|
|
|
|
|
|
|
|
_compdeclarations = {
|
|
|
|
}
|
|
|
|
|
|
|
|
_enumdeclarations = {
|
2004-07-18 03:16:08 -03:00
|
|
|
'savo' : _Enum_savo,
|
2002-01-22 19:20:12 -04:00
|
|
|
}
|