aesuperclass.diffTEXTR*ch')~C6C6mBINIndex: Lib/aepack.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aepack.py,v retrieving revision 1.3 diff -r1.3 aepack.py 26a27 > import os 61c62 < _sample_fss = macfs.FSSpec(':') --- > _sample_fss = macfs.FSSpec(os.curdir) 65a67,75 > def packkey(ae, key, value): > if hasattr(key, 'which'): > keystr = key.which > elif hasattr(key, 'want'): > keystr = key.want > else: > keystr = key > ae.AEPutParamDesc(keystr, pack(value)) > 80a91,95 > if t == UnicodeType: > data = t.encode('utf16') > if data[:2] == '\xfe\xff': > data = data[2:] > return AE.AECreateDesc('utxt', data) 91,95d105 < if t == UnicodeType: < data = t.encode('utf16') < if data[:2] == '\xfe\xff': < data = data[2:] < return AE.AECreateDesc('utxt', data) 104c114,115 < record.AEPutParamDesc(key, pack(value)) --- > packkey(record, key, value) > #record.AEPutParamDesc(key, pack(value)) 107a119,122 > if hasattr(x, 'which'): > return AE.AECreateDesc('TEXT', x.which) > if hasattr(x, 'want'): > return AE.AECreateDesc('TEXT', x.want) 110c125 < def unpack(desc): --- > def unpack(desc, formodulename=""): 122c137 < l.append(unpack(item)) --- > l.append(unpack(item, formodulename)) 128c143 < d[keyword] = unpack(item) --- > d[keyword] = unpack(item, formodulename) 132c147 < return mkaetext(unpack(record)) --- > return mkaetext(unpack(record, formodulename)) 140,141d154 < if t == typeUnicodeText: < return unicode(desc.data, 'utf16') 158c171 < return mkinsertionloc(unpack(record)) --- > return mkinsertionloc(unpack(record, formodulename)) 182c195,199 < return mkobject(unpack(record)) --- > # If we have been told the name of the module we are unpacking aedescs for, > # we can attempt to create the right type of python object from that module. > if formodulename: > return mkobjectfrommodule(unpack(record, formodulename), formodulename) > return mkobject(unpack(record, formodulename)) 219c236 < return mkrange(unpack(record)) --- > return mkrange(unpack(record, formodulename)) 222c239 < return mkcomparison(unpack(record)) --- > return mkcomparison(unpack(record, formodulename)) 225c242 < return mklogical(unpack(record)) --- > return mklogical(unpack(record, formodulename)) 315a333,342 > def mkobjectfrommodule(dict, modulename): > want = dict['want'].type > module = __import__(modulename) > codenamemapper = module._classdeclarations > classtype = codenamemapper.get(want, None) > newobj = mkobject(dict) > if classtype: > newobj.__class__ = classtype > return newobj > 325,326c352,353 < macfs.FSSpec(':'), < macfs.FSSpec(':').NewAliasMinimal(), --- > macfs.FSSpec(os.curdir), > macfs.FSSpec(os.curdir).NewAliasMinimal(), Index: Lib/aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aetools.py,v retrieving revision 1.3 diff -r1.3 aetools.py 31c31 < from aepack import pack, unpack, coerce, AEDescType --- > from aepack import packkey, pack, unpack, coerce, AEDescType 59c59 < def unpackevent(ae): --- > def unpackevent(ae, formodulename=""): 66c66 < parameters['----'] = unpack(dirobj) --- > parameters['----'] = unpack(dirobj, formodulename=formodulename) 71c71 < parameters[key] = unpack(ae.AEGetParamDesc(key, '****')) --- > parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename=formodulename) 80c80 < attributes[key] = unpack(desc) --- > attributes[key] = unpack(desc, formodulename=formodulename) 85c85 < ae.AEPutParamDesc(key, pack(value)) --- > packkey(ae, key, value) 87c87 < ae.AEPutAttributeDesc(key, pack(value)) --- > packkey(ae, key, value) 132a133 > _moduleName = None # Can be overridden by subclasses 186c187 < parameters, attributes = unpackevent(reply) --- > parameters, attributes = unpackevent(reply, self._moduleName) 212a214,236 > > _reply, _arguments, _attributes = self.send(_code, _subcode, > _arguments, _attributes) > if _arguments.has_key('errn'): > raise Error, decodeerror(_arguments) > > if _arguments.has_key('----'): > item = _arguments['----'] > if as: > item.__class__ = as > return item > > def _set(self, _object, _arguments = {}, _attributes = {}): > """ _set: set data for an object > Required argument: the object > Keyword argument _parameters: Parameter dictionary for the set operation > Keyword argument _attributes: AppleEvent attribute dictionary > Returns: the data > """ > _code = 'core' > _subcode = 'setd' > > _arguments['----'] = _object Index: Lib/aetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aetypes.py,v retrieving revision 1.2 diff -r1.2 aetypes.py 12c12 < def pack(*args): --- > def pack(*args, **kwargs): 14c14 < return apply(pack, args) --- > return apply(pack, args, kwargs) 71a72,94 > # dsp added positional specifiers > class end: > def __init__(self, of): > self.of = of > > def __repr__(self): > return "end of %s" % `self.of` > > def __aepack__(self): > rec = {'kobj': self.of, 'kpos': Enum('end ')} > return pack(rec, forcetype='insl') > > class beginning: > def __init__(self, of): > self.of = of > > def __repr__(self): > return "beginning of %s" % `self.of` > > def __aepack__(self): > rec = {'kobj': self.of, 'kpos': Enum('bgng')} > return pack(rec, forcetype='insl') > 496d518 < 526c548,549 < --- > > # dsp changed __getattr__ to call __find_property__ 528,534c551,571 < if self._elemdict.has_key(name): < cls = self._elemdict[name] < return DelayedComponentItem(cls, self) < if self._propdict.has_key(name): < cls = self._propdict[name] < return cls(self) < raise AttributeError, name --- > result = self.__find_property__(self.__class__, name) > if result == None: > raise AttributeError, "%s not found in %s" % (name, self) > return result > > # dsp wrote __find_property__ to recurse superclasses while looking for properties or elements > def __find_property__(self, klass, name): > if hasattr(klass, '_elemdict'): > if klass._elemdict.has_key(name): > cls = klass._elemdict[name] > return DelayedComponentItem(cls, self) > if hasattr(klass, '_propdict'): > if klass._propdict.has_key(name): > cls = klass._propdict[name] > return cls(self) > if klass.__bases__: > for superclass in klass.__bases__: > result = self.getProp(superclass, name) > if result: > return result > return None Index: scripts/gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.21 diff -r1.21 gensuitemodule.py 28d27 < cur = CurResFile() 30,52c29,44 < rf = OpenRFPerm(fullname, 0, 1) < try: < UseResFile(rf) < resources = [] < for i in range(Count1Resources('aete')): < res = Get1IndResource('aete', 1+i) < resources.append(res) < for i in range(Count1Resources('aeut')): < res = Get1IndResource('aeut', 1+i) < resources.append(res) < print "\nLISTING aete+aeut RESOURCES IN", `fullname` < aetelist = [] < for res in resources: < print "decoding", res.GetResInfo(), "..." < data = res.data < aete = decode(data) < aetelist.append((aete, res.GetResInfo())) < finally: < if rf <> cur: < CloseResFile(rf) < UseResFile(cur) < # switch back (needed for dialogs in Python) < UseResFile(cur) --- > import macresource > macresource.need('aete', 0, fullname) > resources = [] > for i in range(Count1Resources('aete')): > res = Get1IndResource('aete', 1+i) > resources.append(res) > for i in range(Count1Resources('aeut')): > res = Get1IndResource('aeut', 1+i) > resources.append(res) > print "\nLISTING aete+aeut RESOURCES IN", `fullname` > aetelist = [] > for res in resources: > print "decoding", res.GetResInfo(), "..." > data = res.data > aete = decode(data) > aetelist.append((aete, res.GetResInfo())) 54c46 < --- > 235c227 < macfs.SetFolder(os.path.join(sys.prefix, ':Mac:Lib:lib-scriptpackages')) --- > macfs.SetFolder(os.path.join(sys.prefix, 'Mac', 'Lib', 'lib-scriptpackages')) 270c262,263 < fp.write("Resource %s resid %d %s\n"%(resinfo[1], resinfo[0], resinfo[2])) --- > if resinfo: > fp.write("Resource %s resid %d %s\n"%(resinfo[1], resinfo[0], resinfo[2])) 285a279,289 > > # Generate a code-to-name mapper for all of the types (classes) declared in this module > if allprecompinfo: > fp.write("\n#\n# Indices of types declared in this module\n#\n") > fp.write("import StdSuites\n") > fp.write("_classdeclarations = {\n") > for codenamemapper in allprecompinfo: > for k, v in codenamemapper.getall('class'): > fp.write("\t%s : %s,\n" % (`k`, v)) > fp.write("}\n") > 291c295,296 < fp.write("\t_signature = '%s'\n\n"%creatorsignature) --- > fp.write("\t_signature = '%s'\n"%creatorsignature) > fp.write("\t_moduleName = '%s'\n\n"%packagename) 641a647 > if fss.as_pathname() == ":cancelled": return 703a710 > superclasses = [] 707a715,716 > if pcode == "c@#^": > superclasses.append(what) 720c729,746 < --- > > if superclasses: > # This class has a superclass. We know it's code, find it's name. > superclassnames = [] > for superclass in superclasses: > superId, superDesc, dummy = superclass > superclassname, fullyqualifiedname, module = self.findcodename("class", superId) > if module: > if self.fp: > self.fp.write("from %s import %s\n" % (module, superclassname)) > superclassnames.append(superclassname) > if self.fp: > self.fp.write("%s.__bases__ = (" % (cname,)) > for superclassname in superclassnames: > self.fp.write(superclassname) > self.fp.write(", ") > self.fp.write(")\n") > 848c874 < print identify('for') \ No newline at end of file --- > #print identify('for') \ No newline at end of file LL2H Verdana,7,7C6!&LL2'@=2MPSR