Commit 2eda2447 authored by Jack Jansen's avatar Jack Jansen

Enums we cannot find are set to None, and enumsubst understands this (no...

Enums we cannot find are set to None, and enumsubst understands this (no substitution done). This is need for what I think are bugs in the Finder aete resources (some events use unknown enums).
parent 12b2b766
...@@ -103,7 +103,7 @@ def keysubst(arguments, keydict): ...@@ -103,7 +103,7 @@ def keysubst(arguments, keydict):
def enumsubst(arguments, key, edict): def enumsubst(arguments, key, edict):
"""Substitute a single enum keyword argument, if it occurs""" """Substitute a single enum keyword argument, if it occurs"""
if not arguments.has_key(key): if not arguments.has_key(key) or edict is None:
return return
v = arguments[key] v = arguments[key]
ok = edict.values() ok = edict.values()
...@@ -129,8 +129,9 @@ def decodeerror(arguments): ...@@ -129,8 +129,9 @@ def decodeerror(arguments):
class TalkTo: class TalkTo:
"""An AE connection to an application""" """An AE connection to an application"""
_signature = None # Can be overridden by subclasses
def __init__(self, signature, start=0, timeout=0): def __init__(self, signature=None, start=0, timeout=0):
"""Create a communication channel with a particular application. """Create a communication channel with a particular application.
Addressing the application is done by specifying either a Addressing the application is done by specifying either a
...@@ -138,6 +139,8 @@ class TalkTo: ...@@ -138,6 +139,8 @@ class TalkTo:
to an AEDesc. to an AEDesc.
""" """
self.target_signature = None self.target_signature = None
if signature is None:
signature = self._signature
if type(signature) == AEDescType: if type(signature) == AEDescType:
self.target = signature self.target = signature
elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): elif type(signature) == InstanceType and hasattr(signature, '__aepack__'):
......
...@@ -667,9 +667,10 @@ class ObjectCompiler: ...@@ -667,9 +667,10 @@ class ObjectCompiler:
return return
pname = identify(name) pname = identify(name)
if self.namemappers[0].hascode('property', code): if self.namemappers[0].hascode('property', code):
# XXXX Why don't we handle these the same as classes?? # plural forms and such
othername, dummy, dummy = self.namemappers[0].findcodename('property', code)
if self.fp: if self.fp:
self.fp.write("# repeated property %s %s\n"%(pname, what[1])) self.fp.write("\n%s = %s\n"%(pname, othername))
else: else:
if self.fp: if self.fp:
self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write("class %s(aetools.NProperty):\n" % pname)
...@@ -747,7 +748,7 @@ class ObjectCompiler: ...@@ -747,7 +748,7 @@ class ObjectCompiler:
name, fullname, module = self.findcodename('enum', enum) name, fullname, module = self.findcodename('enum', enum)
if not name: if not name:
if self.fp: if self.fp:
self.fp.write("# XXXX enum %s not found!!\n"%(enum)) self.fp.write("_Enum_%s = None # XXXX enum %s not found!!\n"%(identify(enum), enum))
return return
if module: if module:
if self.fp: if self.fp:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment