Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8426477b
Kaydet (Commit)
8426477b
authored
Eki 03, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Modified/recreated to use keyword arguments
üst
96ebbd30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
130 deletions
+67
-130
AppleScript_Suite.py
Mac/Lib/toolbox/AppleScript_Suite.py
+0
-0
Finder_Suite.py
Mac/Lib/toolbox/Finder_Suite.py
+0
-0
Metrowerks_Shell_Suite.py
Mac/Lib/toolbox/Metrowerks_Shell_Suite.py
+0
-0
Required_Suite.py
Mac/Lib/toolbox/Required_Suite.py
+44
-94
Standard_Suite.py
Mac/Lib/toolbox/Standard_Suite.py
+0
-0
aetools.py
Mac/Lib/toolbox/aetools.py
+1
-0
gensuitemodule.py
Mac/scripts/gensuitemodule.py
+22
-36
No files found.
Mac/Lib/toolbox/AppleScript_Suite.py
Dosyayı görüntüle @
8426477b
This diff is collapsed.
Click to expand it.
Mac/Lib/toolbox/Finder_Suite.py
Dosyayı görüntüle @
8426477b
This diff is collapsed.
Click to expand it.
Mac/Lib/toolbox/Metrowerks_Shell_Suite.py
Dosyayı görüntüle @
8426477b
This diff is collapsed.
Click to expand it.
Mac/Lib/toolbox/Required_Suite.py
Dosyayı görüntüle @
8426477b
...
...
@@ -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
[
'----'
]
Mac/Lib/toolbox/Standard_Suite.py
Dosyayı görüntüle @
8426477b
This diff is collapsed.
Click to expand it.
Mac/Lib/toolbox/aetools.py
Dosyayı görüntüle @
8426477b
...
...
@@ -78,6 +78,7 @@ def packevent(ae, parameters = {}, attributes = {}):
#
# Support routine for automatically generated Suite interfaces
# These routines are also useable for the reverse function.
#
def
keysubst
(
arguments
,
keydict
):
"""Replace long name keys by their 4-char counterparts, and check"""
...
...
Mac/scripts/gensuitemodule.py
Dosyayı görüntüle @
8426477b
...
...
@@ -281,10 +281,15 @@ def compileevent(fp, event):
has_arg
=
(
not
is_null
(
accepts
))
opt_arg
=
(
has_arg
and
is_optional
(
accepts
))
fp
.
write
(
"
\t
def
%
s(self, "
%
funcname
)
if
has_arg
:
fp
.
write
(
"
\t
def
%
s(self, object, *arguments):
\n
"
%
funcname
)
if
not
opt_arg
:
fp
.
write
(
"_object, "
)
# Include direct object, if it has one
else
:
fp
.
write
(
"_object=None, "
)
# Also include if it is optional
else
:
fp
.
write
(
"
\t
def
%
s(self, *arguments):
\n
"
%
funcname
)
fp
.
write
(
"_no_object=None, "
)
# For argument checking
fp
.
write
(
"_attributes={}, **_arguments):
\n
"
)
# include attribute dict and args
#
# Generate doc string (important, since it may be the only
# available documentation, due to our name-remaping)
...
...
@@ -306,65 +311,46 @@ def compileevent(fp, event):
#
fp
.
write
(
"
\t\t
_code =
%
s
\n
"
%
`code`
)
fp
.
write
(
"
\t\t
_subcode =
%
s
\n\n
"
%
`subcode`
)
if
opt_arg
:
fp
.
write
(
"
\t\t
if len(arguments):
\n
"
)
fp
.
write
(
"
\t\t\t
object = arguments[0]
\n
"
)
fp
.
write
(
"
\t\t\t
arguments = arguments[1:]
\n
"
)
fp
.
write
(
"
\t\t
else:
\n
"
)
fp
.
write
(
"
\t\t\t
object = None
\n
"
)
fp
.
write
(
"
\t\t
if len(arguments) > 1:
\n
"
)
fp
.
write
(
"
\t\t\t
raise TypeError, 'Too many arguments'
\n
"
)
fp
.
write
(
"
\t\t
if arguments:
\n
"
)
fp
.
write
(
"
\t\t\t
arguments = arguments[0]
\n
"
)
fp
.
write
(
"
\t\t\t
if type(arguments) <> type({}):
\n
"
)
fp
.
write
(
"
\t\t\t\t
raise TypeError, 'Must be a mapping'
\n
"
)
fp
.
write
(
"
\t\t
else:
\n
"
)
fp
.
write
(
"
\t\t\t
arguments = {}
\n
"
)
if
has_arg
:
fp
.
write
(
"
\t\t
arguments['----'] =
object
\n
"
)
fp
.
write
(
"
\t\t
_arguments['----'] = _
object
\n
"
)
elif
opt_arg
:
fp
.
write
(
"
\t\t
if object:
\n
"
)
fp
.
write
(
"
\t\t\t
arguments['----'] = object
\n
"
)
fp
.
write
(
"
\n
"
)
#
# Extract attributes
#
fp
.
write
(
"
\t\t
if arguments.has_key('_attributes'):
\n
"
)
fp
.
write
(
"
\t\t\t
attributes = arguments['_attributes']
\n
"
)
fp
.
write
(
"
\t\t\t
del arguments['_attributes']
\n
"
)
fp
.
write
(
"
\t\t
else:
\n
"
);
fp
.
write
(
"
\t\t\t
attributes = {}
\n
"
)
fp
.
write
(
"
\t\t
if _object:
\n
"
)
fp
.
write
(
"
\t\t\t
_arguments['----'] = _object
\n
"
)
else
:
fp
.
write
(
"
\t\t
if _no_object != None: raise TypeError, 'No direct arg expected'
\n
"
)
fp
.
write
(
"
\n
"
)
#
# Do key substitution
#
if
arguments
:
fp
.
write
(
"
\t\t
aetools.keysubst(arguments, self._argmap_
%
s)
\n
"
%
funcname
)
fp
.
write
(
"
\t\t
aetools.keysubst(_arguments, self._argmap_
%
s)
\n
"
%
funcname
)
else
:
fp
.
write
(
"
\t\t
if _arguments: raise TypeError, 'No optional args expected'
\n
"
)
for
a
in
arguments
:
if
is_enum
(
a
[
2
]):
kname
=
a
[
1
]
ename
=
a
[
2
][
0
]
fp
.
write
(
"
\t\t
aetools.enumsubst(arguments,
%
s, _Enum_
%
s)
\n
"
%
fp
.
write
(
"
\t\t
aetools.enumsubst(
_
arguments,
%
s, _Enum_
%
s)
\n
"
%
(
`kname`
,
ename
))
fp
.
write
(
"
\n
"
)
#
# Do the transaction
#
fp
.
write
(
"
\t\t
reply, arguments,
attributes = self.send(_code, _subcode,
\n
"
)
fp
.
write
(
"
\t\t\t\t
arguments,
attributes)
\n
"
)
fp
.
write
(
"
\t\t
_reply, _arguments, _
attributes = self.send(_code, _subcode,
\n
"
)
fp
.
write
(
"
\t\t\t\t
_arguments, _
attributes)
\n
"
)
#
# Error handling
#
fp
.
write
(
"
\t\t
if arguments.has_key('errn'):
\n
"
)
fp
.
write
(
"
\t\t\t
raise MacOS.Error, aetools.decodeerror(arguments)
\n
"
)
fp
.
write
(
"
\t\t
if
_
arguments.has_key('errn'):
\n
"
)
fp
.
write
(
"
\t\t\t
raise MacOS.Error, aetools.decodeerror(
_
arguments)
\n
"
)
fp
.
write
(
"
\t\t
# XXXX Optionally decode result
\n
"
)
#
# Decode result
#
fp
.
write
(
"
\t\t
if arguments.has_key('----'):
\n
"
)
fp
.
write
(
"
\t\t
if
_
arguments.has_key('----'):
\n
"
)
if
is_enum
(
returns
):
fp
.
write
(
"
\t\t\t
# XXXX Should do enum remapping here...
\n
"
)
fp
.
write
(
"
\t\t\t
return arguments['----']
\n
"
)
fp
.
write
(
"
\t\t\t
return
_
arguments['----']
\n
"
)
fp
.
write
(
"
\n
"
)
# print "\n# Command %s -- %s (%s, %s)" % (`name`, `desc`, `code`, `subcode`)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment