summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/toolbox/Required_Suite.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-10-03 14:35:58 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-10-03 14:35:58 (GMT)
commit8426477bbb7647755352bdbd7bee834da8ad2899 (patch)
treebca798f42d3a1ef6c3e663ac332212cc621fd0cd /Mac/Lib/toolbox/Required_Suite.py
parent96ebbd30823e40d9bf130d157b6de09741c4826c (diff)
downloadcpython-8426477bbb7647755352bdbd7bee834da8ad2899.zip
cpython-8426477bbb7647755352bdbd7bee834da8ad2899.tar.gz
cpython-8426477bbb7647755352bdbd7bee834da8ad2899.tar.bz2
Modified/recreated to use keyword arguments
Diffstat (limited to 'Mac/Lib/toolbox/Required_Suite.py')
-rw-r--r--Mac/Lib/toolbox/Required_Suite.py138
1 files changed, 44 insertions, 94 deletions
diff --git a/Mac/Lib/toolbox/Required_Suite.py b/Mac/Lib/toolbox/Required_Suite.py
index 4f317c9..9ef255e 100644
--- a/Mac/Lib/toolbox/Required_Suite.py
+++ b/Mac/Lib/toolbox/Required_Suite.py
@@ -17,7 +17,7 @@ _code = 'reqd'
class Required_Suite:
- def open(self, object, *arguments):
+ 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
@@ -25,32 +25,19 @@ class Required_Suite:
_code = 'aevt'
_subcode = 'odoc'
- if len(arguments) > 1:
- raise TypeError, 'Too many arguments'
- if arguments:
- arguments = arguments[0]
- if type(arguments) <> type({}):
- raise TypeError, 'Must be a mapping'
- else:
- arguments = {}
- arguments['----'] = object
-
- if arguments.has_key('_attributes'):
- attributes = arguments['_attributes']
- del arguments['_attributes']
- else:
- attributes = {}
-
-
- reply, arguments, attributes = self.send(_code, _subcode,
- arguments, attributes)
- if arguments.has_key('errn'):
- raise MacOS.Error, aetools.decodeerror(arguments)
+ _arguments['----'] = _object
+
+ if _arguments: raise TypeError, 'No optional args expected'
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise MacOS.Error, aetools.decodeerror(_arguments)
# XXXX Optionally decode result
- if arguments.has_key('----'):
- return arguments['----']
+ if _arguments.has_key('----'):
+ return _arguments['----']
- def _print(self, object, *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
@@ -58,90 +45,53 @@ class Required_Suite:
_code = 'aevt'
_subcode = 'pdoc'
- if len(arguments) > 1:
- raise TypeError, 'Too many arguments'
- if arguments:
- arguments = arguments[0]
- if type(arguments) <> type({}):
- raise TypeError, 'Must be a mapping'
- else:
- arguments = {}
- arguments['----'] = object
-
- if arguments.has_key('_attributes'):
- attributes = arguments['_attributes']
- del arguments['_attributes']
- else:
- attributes = {}
-
-
- reply, arguments, attributes = self.send(_code, _subcode,
- arguments, attributes)
- if arguments.has_key('errn'):
- raise MacOS.Error, aetools.decodeerror(arguments)
+ _arguments['----'] = _object
+
+ if _arguments: raise TypeError, 'No optional args expected'
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise MacOS.Error, aetools.decodeerror(_arguments)
# XXXX Optionally decode result
- if arguments.has_key('----'):
- return arguments['----']
+ if _arguments.has_key('----'):
+ return _arguments['----']
- def quit(self, *arguments):
+ def quit(self, _no_object=None, _attributes={}, **_arguments):
"""quit: Quit application
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'aevt'
_subcode = 'quit'
- if len(arguments) > 1:
- raise TypeError, 'Too many arguments'
- if arguments:
- arguments = arguments[0]
- if type(arguments) <> type({}):
- raise TypeError, 'Must be a mapping'
- else:
- arguments = {}
-
- if arguments.has_key('_attributes'):
- attributes = arguments['_attributes']
- del arguments['_attributes']
- else:
- attributes = {}
-
-
- reply, arguments, attributes = self.send(_code, _subcode,
- arguments, attributes)
- if arguments.has_key('errn'):
- raise MacOS.Error, aetools.decodeerror(arguments)
+ if _no_object != None: raise TypeError, 'No direct arg expected'
+
+ if _arguments: raise TypeError, 'No optional args expected'
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise MacOS.Error, aetools.decodeerror(_arguments)
# XXXX Optionally decode result
- if arguments.has_key('----'):
- return arguments['----']
+ if _arguments.has_key('----'):
+ return _arguments['----']
- def run(self, *arguments):
+ def run(self, _no_object=None, _attributes={}, **_arguments):
"""run: Sent to an application when it is double-clicked
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'aevt'
_subcode = 'oapp'
- if len(arguments) > 1:
- raise TypeError, 'Too many arguments'
- if arguments:
- arguments = arguments[0]
- if type(arguments) <> type({}):
- raise TypeError, 'Must be a mapping'
- else:
- arguments = {}
-
- if arguments.has_key('_attributes'):
- attributes = arguments['_attributes']
- del arguments['_attributes']
- else:
- attributes = {}
-
-
- reply, arguments, attributes = self.send(_code, _subcode,
- arguments, attributes)
- if arguments.has_key('errn'):
- raise MacOS.Error, aetools.decodeerror(arguments)
+ if _no_object != None: raise TypeError, 'No direct arg expected'
+
+ if _arguments: raise TypeError, 'No optional args expected'
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise MacOS.Error, aetools.decodeerror(_arguments)
# XXXX Optionally decode result
- if arguments.has_key('----'):
- return arguments['----']
+ if _arguments.has_key('----'):
+ return _arguments['----']