Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11590 Modified Files: Nav.c Log Message: Allow access to the returned value(s) as FSRefs. Unfortunately for some reason getting at saveFileName doesn't work, so it currently only really works for opening files for reading. Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Nav.c 17 Jul 2002 16:30:34 -0000 1.18 --- Nav.c 22 Nov 2002 23:39:52 -0000 1.19 *************** *** 317,324 **** { FSSpec fss; if( strcmp(name, "__members__") == 0 ) ! return Py_BuildValue("sssssss", "version", "validRecord", "replacing", ! "isStationery", "translationNeeded", "selection", "fileTranslation"); if( strcmp(name, "version") == 0 ) return Py_BuildValue("h", self->itself.version); --- 317,326 ---- { FSSpec fss; + FSRef fsr; if( strcmp(name, "__members__") == 0 ) ! return Py_BuildValue("ssssssssss", "version", "validRecord", "replacing", ! "isStationery", "translationNeeded", "selection", "selection_fsr", ! "fileTranslation", "keyScript", "saveFileName"); if( strcmp(name, "version") == 0 ) return Py_BuildValue("h", self->itself.version); *************** *** 365,370 **** --- 367,406 ---- return rv; } + if( strcmp(name, "selection_fsr") == 0 ) { + SInt32 i, count; + OSErr err; + PyObject *rv, *rvitem; + AEDesc desc; + + if (err=AECountItems(&self->itself.selection, &count)) { + PyErr_Mac(ErrorObject, err); + return NULL; + } + if ( (rv=PyList_New(count)) == NULL ) + return NULL; + for(i=0; i<count; i++) { + desc.dataHandle = NULL; + if (err=AEGetNthDesc(&self->itself.selection, i+1, typeFSRef, NULL, &desc)) { + Py_DECREF(rv); + PyErr_Mac(ErrorObject, err); + return NULL; + } + if (err=AEGetDescData(&desc, &fsr, sizeof(FSRef))) { + Py_DECREF(rv); + PyErr_Mac(ErrorObject, err); + return NULL; + } + rvitem = PyMac_BuildFSRef(&fsr); + PyList_SetItem(rv, i, rvitem); + AEDisposeDesc(&desc); + } + return rv; + } if( strcmp(name, "fileTranslation") == 0 ) return ResObj_New((Handle)self->itself.fileTranslation); + if( strcmp(name, "keyScript") == 0 ) + return Py_BuildValue("h", (short)self->itself.keyScript); + if( strcmp(name, "saveFileName") == 0 ) + return Py_BuildValue("O&", CFStringRefObj_New, self->itself.saveFileName);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4