annotate Mac/Modules/Nav.c @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 52294af4b663
children 06ce27a82e99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1 /***********************************************************
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3 The Netherlands.
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5 All Rights Reserved
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7 Permission to use, copy, modify, and distribute this software and its
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8 documentation for any purpose and without fee is hereby granted,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9 provided that the above copyright notice appear in all copies and that
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 both that copyright notice and this permission notice appear in
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 supporting documentation, and that the names of Stichting Mathematisch
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
12 Centrum or CWI or Corporation for National Research Initiatives or
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
13 CNRI not be used in advertising or publicity pertaining to
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
14 distribution of the software without specific, written prior
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 permission.
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17 While CWI is the initial source for this software, a modified version
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
18 is made available by the Corporation for National Research Initiatives
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
19 (CNRI) at the Internet address ftp://ftp.python.org.
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
20
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28 PERFORMANCE OF THIS SOFTWARE.
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
30 ******************************************************************/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
31
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
32 #include "Python.h"
13606
c9a4a1316170 pymactoolbox.h contains protoypes for all externally visible toolbox module
Jack Jansen <jack.jansen@cwi.nl>
parents: 12836
diff changeset
33 #include "pymactoolbox.h"
17923
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
34 #include <Carbon/Carbon.h>
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
35
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36 static PyObject *ErrorObject;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
37
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
38 static NavEventUPP my_eventProcUPP;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
39 static NavPreviewUPP my_previewProcUPP;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
40 static NavObjectFilterUPP my_filterProcUPP;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
41
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
42 /* Callback functions */
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
43 static pascal void
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
44 my_eventProc(NavEventCallbackMessage callBackSelector,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
45 NavCBRecPtr callBackParms,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
46 NavCallBackUserData callbackUD)
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
47 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
48 PyObject *dict = (PyObject *)callbackUD;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
49 PyObject *pyfunc;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
50 PyObject *rv;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
51
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
52 if (!dict) return;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
53 if ( (pyfunc = PyDict_GetItemString(dict, "eventProc")) == NULL ) {
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
54 PyErr_Print();
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
55 return;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
56 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
57 if ( pyfunc == Py_None ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
58 return;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
59 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
60 rv = PyObject_CallFunction(pyfunc, "ls#", (long)callBackSelector,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
61 (void *)callBackParms, sizeof(NavCBRec));
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
62 if ( rv )
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
63 Py_DECREF(rv);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
64 else {
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
65 PySys_WriteStderr("Nav: exception in eventProc callback\n");
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
66 PyErr_Print();
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
67 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
68 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
69
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
70 static pascal Boolean
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
71 my_previewProc(NavCBRecPtr callBackParms,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
72 NavCallBackUserData callbackUD)
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
73 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
74 PyObject *dict = (PyObject *)callbackUD;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
75 PyObject *pyfunc;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
76 PyObject *rv;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
77 Boolean c_rv = false;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
78
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
79 if (!dict) return false;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
80 if ( (pyfunc = PyDict_GetItemString(dict, "previewProc")) == NULL ) {
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
81 PyErr_Print();
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
82 return false;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
83 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
84 rv = PyObject_CallFunction(pyfunc, "s#", (void *)callBackParms, sizeof(NavCBRec));
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
85 if ( rv ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
86 c_rv = PyObject_IsTrue(rv);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
87 Py_DECREF(rv);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
88 } else {
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
89 PySys_WriteStderr("Nav: exception in previewProc callback\n");
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
90 PyErr_Print();
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
91 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
92 return c_rv;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
93 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
94
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
95 static pascal Boolean
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
96 my_filterProc(AEDesc *theItem, void *info,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
97 NavCallBackUserData callbackUD,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
98 NavFilterModes filterMode)
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
99 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
100 PyObject *dict = (PyObject *)callbackUD;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
101 PyObject *pyfunc;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
102 PyObject *rv;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
103 Boolean c_rv = false;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
104
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
105 if (!dict) return false;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
106 if ( (pyfunc = PyDict_GetItemString(dict, "filterProc")) == NULL ) {
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
107 PyErr_Print();
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
108 return false;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
109 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
110 rv = PyObject_CallFunction(pyfunc, "O&s#h",
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
111 AEDesc_NewBorrowed, theItem, info, sizeof(NavFileOrFolderInfo), (short)filterMode);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
112 if ( rv ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
113 c_rv = PyObject_IsTrue(rv);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
114 Py_DECREF(rv);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
115 } else {
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
116 PySys_WriteStderr("Nav: exception in filterProc callback\n");
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
117 PyErr_Print();
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
118 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
119 return c_rv;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
120 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
121
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
122 /* ----------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
123 static int
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
124 filldialogoptions(PyObject *d,
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
125 AEDesc **defaultLocationP,
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
126 NavDialogOptions *opt,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
127 NavEventUPP *eventProcP,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
128 NavPreviewUPP *previewProcP,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
129 NavObjectFilterUPP *filterProcP,
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
130 NavTypeListHandle *typeListP,
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
131 OSType *fileTypeP,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
132 OSType *fileCreatorP)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
133 {
36650
5d828703c6a1 Fix a couple of warnings on Mac OS X.
Neal Norwitz <nnorwitz@gmail.com>
parents: 30982
diff changeset
134 Py_ssize_t pos = 0;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
135 PyObject *key, *value;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
136 char *keystr;
11654
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
137 AEDesc *defaultLocation_storage;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
138
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
139 NavGetDefaultDialogOptions(opt);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
140
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
141 while ( PyDict_Next(d, &pos, &key, &value) ) {
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
142 if ( !key || !value || !PyString_Check(key) ) {
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
143 PyErr_SetString(ErrorObject, "DialogOption has non-string key");
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
144 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
145 }
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
146 keystr = PyString_AsString(key);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
147 if( strcmp(keystr, "defaultLocation") == 0 ) {
11654
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
148 if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) {
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
149 PyErr_NoMemory();
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
150 return 0;
11654
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
151 }
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
152 if ( !PyArg_Parse(value, "O&", AEDesc_Convert, defaultLocation_storage) ) {
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
153 PyMem_DEL(defaultLocation_storage);
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
154 return 0;
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
155 }
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
156 *defaultLocationP = defaultLocation_storage;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
157 } else if( strcmp(keystr, "version") == 0 ) {
28654
1e9004553e1d Converted manually written code to the new K format specifier.
Jack Jansen <jack.jansen@cwi.nl>
parents: 28224
diff changeset
158 if ( !PyArg_Parse(value, "H", &opt->version) )
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
159 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
160 } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) {
28655
16f47bd431c4 Oops, 'k' is the new format code for un unchecked 32 bit quantity,
Jack Jansen <jack.jansen@cwi.nl>
parents: 28654
diff changeset
161 if ( !PyArg_Parse(value, "k", &opt->dialogOptionFlags) )
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
162 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
163 } else if( strcmp(keystr, "location") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
164 if ( !PyArg_Parse(value, "O&", PyMac_GetPoint, &opt->location) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
165 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
166 } else if( strcmp(keystr, "clientName") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
167 if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->clientName) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
168 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
169 } else if( strcmp(keystr, "windowTitle") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
170 if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->windowTitle) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
171 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
172 } else if( strcmp(keystr, "actionButtonLabel") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
173 if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->actionButtonLabel) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
174 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
175 } else if( strcmp(keystr, "cancelButtonLabel") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
176 if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->cancelButtonLabel) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
177 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
178 } else if( strcmp(keystr, "savedFileName") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
179 if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->savedFileName) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
180 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
181 } else if( strcmp(keystr, "message") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
182 if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->message) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
183 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
184 } else if( strcmp(keystr, "preferenceKey") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
185 if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
186 return 0;
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
187 #ifndef __LP64__
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
188 } else if( strcmp(keystr, "popupExtension") == 0 ) {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
189 if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
190 return 0;
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
191 #endif /* !__LP64__ */
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
192 } else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
193 *eventProcP = my_eventProcUPP;
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
194 } else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) {
27277
cbf355f28ca9 For reasons unknown previewProc and filterProc were disabled. Enabled them.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26769
diff changeset
195 *previewProcP = my_previewProcUPP;
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
196 } else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) {
27277
cbf355f28ca9 For reasons unknown previewProc and filterProc were disabled. Enabled them.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26769
diff changeset
197 *filterProcP = my_filterProcUPP;
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
198 #ifndef __LP64__
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
199 } else if( typeListP && strcmp(keystr, "typeList") == 0 ) {
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
200 if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
201 return 0;
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
202 #endif /* !__LP64__ */
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
203 } else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
204 if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) )
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
205 return 0;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
206 } else if( fileCreatorP && strcmp(keystr, "fileCreator") == 0 ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
207 if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileCreatorP) )
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
208 return 0;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
209 } else {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
210 PyErr_Format(ErrorObject, "Unknown DialogOption key: %s", keystr);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
211 return 0;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
212 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
213 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
214 return 1;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
215 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
216
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
217 /* ----------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
218
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
219 /* Declarations for objects of type NavReplyRecord */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
220
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
221 typedef struct {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
222 PyObject_HEAD
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
223 NavReplyRecord itself;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
224 } navrrobject;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
225
24280
1598a1e473e2 staticforward bites the dust.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23510
diff changeset
226 static PyTypeObject Navrrtype;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
227
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
228
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
229
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
230 /* ---------------------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
231
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
232 static char nav_NavTranslateFile__doc__[] =
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
233 "(NavTranslationOptions)->None"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
234 ;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
235
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
236 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
237 nav_NavTranslateFile(navrrobject *self, PyObject *args)
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
238 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
239 NavTranslationOptions howToTranslate;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
240 OSErr err;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
241
28655
16f47bd431c4 Oops, 'k' is the new format code for un unchecked 32 bit quantity,
Jack Jansen <jack.jansen@cwi.nl>
parents: 28654
diff changeset
242 if (!PyArg_ParseTuple(args, "k", &howToTranslate))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
243 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
244 err = NavTranslateFile(&self->itself, howToTranslate);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
245 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
246 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
247 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
248 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
249 Py_INCREF(Py_None);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
250 return Py_None;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
251 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
252
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
253 static char nav_NavCompleteSave__doc__[] =
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
254 "(NavTranslationOptions)->None"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
255 ;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
256
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
257 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
258 nav_NavCompleteSave(navrrobject *self, PyObject *args)
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
259 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
260 NavTranslationOptions howToTranslate;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
261 OSErr err;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
262
28655
16f47bd431c4 Oops, 'k' is the new format code for un unchecked 32 bit quantity,
Jack Jansen <jack.jansen@cwi.nl>
parents: 28654
diff changeset
263 if (!PyArg_ParseTuple(args, "k", &howToTranslate))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
264 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
265 err = NavCompleteSave(&self->itself, howToTranslate);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
266 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
267 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
268 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
269 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
270 Py_INCREF(Py_None);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
271 return Py_None;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
272 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
273
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
274
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
275 static struct PyMethodDef navrr_methods[] = {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
276 {"NavTranslateFile", (PyCFunction)nav_NavTranslateFile, METH_VARARGS, nav_NavTranslateFile__doc__},
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
277 {"NavCompleteSave", (PyCFunction)nav_NavCompleteSave, METH_VARARGS, nav_NavCompleteSave__doc__},
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
278
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
279 {NULL, NULL} /* sentinel */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
280 };
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
281
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
282 /* ---------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
283
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
284
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
285 static navrrobject *
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
286 newnavrrobject(NavReplyRecord *itself)
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
287 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
288 navrrobject *self;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
289
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
290 self = PyObject_NEW(navrrobject, &Navrrtype);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
291 if (self == NULL)
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
292 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
293 self->itself = *itself;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
294 return self;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
295 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
296
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
297
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
298 static void
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
299 navrr_dealloc(navrrobject *self)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
300 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
301 NavDisposeReply(&self->itself);
23510
82309c7325ef Replaced lots of PyMem_DEL() calls with PyObject_DEL().
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
302 PyObject_DEL(self);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
303 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
304
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
305 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
306 navrr_getattr(navrrobject *self, char *name)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
307 {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
308 FSRef fsr;
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
309 #ifndef __LP64__
12836
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
310 FSSpec fss;
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
311 #endif /* !__LP64__ */
12836
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
312
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
313 if( strcmp(name, "__members__") == 0 )
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
314 return Py_BuildValue(
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
315 #ifndef __LP64__
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
316 "ssssssssss",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
317 #else /* __LP64__ */
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
318 "ssssssssss",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
319 #endif /* __LP64__ */
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
320 "version", "validRecord", "replacing",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
321 "isStationery", "translationNeeded",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
322 #ifndef __LP64__
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
323 "selection",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
324 #endif /* !__LP64__ */
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
325 "selection_fsr",
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
326 "fileTranslation", "keyScript", "saveFileName");
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
327
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
328 if( strcmp(name, "version") == 0 )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
329 return Py_BuildValue("h", self->itself.version);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
330 if( strcmp(name, "validRecord") == 0 )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
331 return Py_BuildValue("l", (long)self->itself.validRecord);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
332 if( strcmp(name, "replacing") == 0 )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
333 return Py_BuildValue("l", (long)self->itself.replacing);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
334 if( strcmp(name, "isStationery") == 0 )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
335 return Py_BuildValue("l", (long)self->itself.isStationery);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
336 if( strcmp(name, "translationNeeded") == 0 )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
337 return Py_BuildValue("l", (long)self->itself.translationNeeded);
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
338 #ifndef __LP64__
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
339 if( strcmp(name, "selection") == 0 ) {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
340 SInt32 i;
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
341 long count;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
342 OSErr err;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
343 PyObject *rv, *rvitem;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
344 AEDesc desc;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
345
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
346 if ((err=AECountItems(&self->itself.selection, &count))) {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
347 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
348 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
349 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
350 if ( (rv=PyList_New(count)) == NULL )
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
351 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
352 for(i=0; i<count; i++) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
353 desc.dataHandle = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
354 if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSS, NULL, &desc))) {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
355 Py_DECREF(rv);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
356 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
357 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
358 }
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
359 if ((err=AEGetDescData(&desc, &fss, sizeof(FSSpec)))) {
12836
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
360 Py_DECREF(rv);
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
361 PyErr_Mac(ErrorObject, err);
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
362 return NULL;
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
363 }
3fe304050434 Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12591
diff changeset
364 rvitem = PyMac_BuildFSSpec(&fss);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
365 PyList_SetItem(rv, i, rvitem);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
366 AEDisposeDesc(&desc);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
367 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
368 return rv;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
369 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
370 #endif /* !__LP64__ */
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
371 if( strcmp(name, "selection_fsr") == 0 ) {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
372 SInt32 i;
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
373 long count;
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
374 OSErr err;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
375 PyObject *rv, *rvitem;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
376 AEDesc desc;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
377
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
378 if ((err=AECountItems(&self->itself.selection, &count))) {
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
379 PyErr_Mac(ErrorObject, err);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
380 return NULL;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
381 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
382 if ( (rv=PyList_New(count)) == NULL )
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
383 return NULL;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
384 for(i=0; i<count; i++) {
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
385 desc.dataHandle = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
386 if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSRef, NULL, &desc))) {
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
387 Py_DECREF(rv);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
388 PyErr_Mac(ErrorObject, err);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
389 return NULL;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
390 }
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
391 if ((err=AEGetDescData(&desc, &fsr, sizeof(FSRef)))) {
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
392 Py_DECREF(rv);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
393 PyErr_Mac(ErrorObject, err);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
394 return NULL;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
395 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
396 rvitem = PyMac_BuildFSRef(&fsr);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
397 PyList_SetItem(rv, i, rvitem);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
398 AEDisposeDesc(&desc);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
399 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
400 return rv;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
401 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
402 #ifndef __LP64__
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
403 if( strcmp(name, "fileTranslation") == 0 )
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
404 return ResObj_New((Handle)self->itself.fileTranslation);
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
405 #endif
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
406 if( strcmp(name, "keyScript") == 0 )
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
407 return Py_BuildValue("h", (short)self->itself.keyScript);
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
408 if( strcmp(name, "saveFileName") == 0 )
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
409 return Py_BuildValue("O&", CFStringRefObj_New, self->itself.saveFileName);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
410
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
411
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
412 return Py_FindMethod(navrr_methods, (PyObject *)self, name);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
413 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
414
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
415 static int
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
416 navrr_setattr(navrrobject *self, char *name, PyObject *v)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
417 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
418 /* Set attribute 'name' to value 'v'. v==NULL means delete */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
419
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
420 /* XXXX Add your own setattr code here */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
421 return -1;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
422 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
423
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
424 static char Navrrtype__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
425 "Record containing result of a Nav file selection call. Use dir() for member names."
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
426 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
427
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
428 static PyTypeObject Navrrtype = {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
429 PyObject_HEAD_INIT(&PyType_Type)
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
430 0, /*ob_size*/
21313
91dd223829c6 Patch supplied by Burton Radons for his own SF bug #487390: Modifying
Guido van Rossum <guido@python.org>
parents: 19709
diff changeset
431 "Nav.NavReplyRecord", /*tp_name*/
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
432 sizeof(navrrobject), /*tp_basicsize*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
433 0, /*tp_itemsize*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
434 /* methods */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
435 (destructor)navrr_dealloc, /*tp_dealloc*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
436 (printfunc)0, /*tp_print*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
437 (getattrfunc)navrr_getattr, /*tp_getattr*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
438 (setattrfunc)navrr_setattr, /*tp_setattr*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
439 (cmpfunc)0, /*tp_compare*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
440 (reprfunc)0, /*tp_repr*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
441 0, /*tp_as_number*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
442 0, /*tp_as_sequence*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
443 0, /*tp_as_mapping*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
444 (hashfunc)0, /*tp_hash*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
445 (ternaryfunc)0, /*tp_call*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
446 (reprfunc)0, /*tp_str*/
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
447
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
448 /* Space for future expansion */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
449 0L,0L,0L,0L,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
450 Navrrtype__doc__ /* Documentation string */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
451 };
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
452
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
453 /* End of code for NavReplyRecord objects */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
454
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
455 /* ----------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
456
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
457 static char nav_NavGetFile__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
458 "(DialogOptions dict or kwargs+defaultLocation,eventProc,previewProc,filterProc,typeList) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
459 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
460
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
461 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
462 nav_NavGetFile(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
463 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
464 PyObject *dict;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
465 AEDesc *defaultLocation = NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
466 NavReplyRecord reply;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
467 NavDialogOptions dialogOptions;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
468 NavEventUPP eventProc = NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
469 NavPreviewUPP previewProc = NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
470 NavObjectFilterUPP filterProc = NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
471 NavTypeListHandle typeList = NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
472 OSErr err;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
473
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
474 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
475 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
476 return NULL;
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
477 dict = kw;
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
478 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
479 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
480 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, &previewProc, &filterProc, &typeList, NULL, NULL))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
481 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
482 err = NavGetFile(defaultLocation, &reply, &dialogOptions,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
483 eventProc, previewProc, filterProc, typeList, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
484 PyMem_DEL(defaultLocation);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
485 if ( err ) {
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
486 PyErr_Mac(ErrorObject, err);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
487 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
488 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
489 return (PyObject *)newnavrrobject(&reply);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
490 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
491
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
492 static char nav_NavPutFile__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
493 "(DialogOptions dict or kwargs+defaultLocation,eventProc,fileCreator,fileType) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
494 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
495
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
496 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
497 nav_NavPutFile(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
498 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
499 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
500 AEDesc *defaultLocation = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
501 NavReplyRecord reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
502 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
503 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
504 OSType fileType;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
505 OSType fileCreator;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
506 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
507
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
508 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
509 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
510 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
511 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
512 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
513 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
514 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, NULL, NULL, &fileType, &fileCreator))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
515 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
516 err = NavPutFile(defaultLocation, &reply, &dialogOptions,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
517 eventProc, fileType, fileCreator, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
518 PyMem_DEL(defaultLocation);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
519 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
520 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
521 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
522 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
523 return (PyObject *)newnavrrobject(&reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
524 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
525
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
526 static char nav_NavAskSaveChanges__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
527 "(NavAskSaveChangesAction, DialogOptions dict or kwargs+eventProc) -> NavAskSaveChangesResult"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
528
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
529 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
530
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
531 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
532 nav_NavAskSaveChanges(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
533 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
534 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
535 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
536 NavAskSaveChangesAction action;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
537 NavAskSaveChangesResult reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
538 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
539 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
540
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
541 if ( kw && PyObject_IsTrue(kw) ) {
28655
16f47bd431c4 Oops, 'k' is the new format code for un unchecked 32 bit quantity,
Jack Jansen <jack.jansen@cwi.nl>
parents: 28654
diff changeset
542 if (!PyArg_ParseTuple(args, "k", &action))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
543 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
544 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
545 } else if (!PyArg_ParseTuple(args, "lO!", &action, &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
546 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
547 if (!filldialogoptions(dict, NULL, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
548 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
549 err = NavAskSaveChanges(&dialogOptions, action, &reply, eventProc, (void *)dict);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
550 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
551 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
552 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
553 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
554 return Py_BuildValue("l", (long)reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
555 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
556
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
557 static char nav_NavCustomAskSaveChanges__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
558 "(DialogOptions dict or kwargs+eventProc) -> NavAskSaveChangesResult"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
559 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
560
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
561 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
562 nav_NavCustomAskSaveChanges(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
563 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
564 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
565 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
566 NavAskSaveChangesResult reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
567 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
568 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
569
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
570 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
571 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
572 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
573 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
574 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
575 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
576 if (!filldialogoptions(dict, NULL, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
577 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
578 err = NavCustomAskSaveChanges(&dialogOptions, &reply, eventProc, (void *)dict);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
579 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
580 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
581 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
582 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
583 return Py_BuildValue("l", (long)reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
584 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
585
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
586 static char nav_NavAskDiscardChanges__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
587 "(DialogOptions dict or kwargs+eventProc) -> NavAskSaveChangesResult"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
588 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
589
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
590 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
591 nav_NavAskDiscardChanges(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
592 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
593 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
594 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
595 NavAskSaveChangesResult reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
596 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
597 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
598
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
599 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
600 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
601 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
602 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
603 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
604 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
605 if (!filldialogoptions(dict, NULL, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
606 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
607 err = NavAskDiscardChanges(&dialogOptions, &reply, eventProc, (void *)dict);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
608 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
609 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
610 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
611 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
612 return Py_BuildValue("l", (long)reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
613 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
614
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
615 static char nav_NavChooseFile__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
616 "(DialogOptions dict or kwargs+defaultLocation,eventProc,previewProc,filterProc,typeList) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
617 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
618
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
619 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
620 nav_NavChooseFile(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
621 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
622 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
623 AEDesc *defaultLocation = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
624 NavReplyRecord reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
625 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
626 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
627 NavPreviewUPP previewProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
628 NavObjectFilterUPP filterProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
629 NavTypeListHandle typeList = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
630 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
631
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
632 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
633 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
634 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
635 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
636 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
637 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
638 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, &previewProc, &filterProc, &typeList, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
639 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
640 err = NavChooseFile(defaultLocation, &reply, &dialogOptions,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
641 eventProc, previewProc, filterProc, typeList, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
642 PyMem_DEL(defaultLocation);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
643 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
644 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
645 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
646 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
647 return (PyObject *)newnavrrobject(&reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
648 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
649
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
650 static char nav_NavChooseFolder__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
651 "(DialogOptions dict or kwargs+defaultLocation,eventProc,filterProc) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
652 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
653
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
654 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
655 nav_NavChooseFolder(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
656 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
657 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
658 AEDesc *defaultLocation = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
659 NavReplyRecord reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
660 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
661 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
662 NavObjectFilterUPP filterProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
663 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
664
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
665 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
666 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
667 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
668 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
669 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
670 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
671 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, &filterProc, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
672 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
673 err = NavChooseFolder(defaultLocation, &reply, &dialogOptions,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
674 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
675 PyMem_DEL(defaultLocation);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
676 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
677 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
678 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
679 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
680 return (PyObject *)newnavrrobject(&reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
681 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
682
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
683 static char nav_NavChooseVolume__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
684 "(DialogOptions dict or kwargs+defaultLocation,eventProc,filterProc) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
685 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
686
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
687 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
688 nav_NavChooseVolume(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
689 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
690 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
691 AEDesc *defaultLocation = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
692 NavReplyRecord reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
693 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
694 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
695 NavObjectFilterUPP filterProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
696 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
697
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
698 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
699 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
700 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
701 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
702 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
703 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
704 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, &filterProc, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
705 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
706 err = NavChooseVolume(defaultLocation, &reply, &dialogOptions,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
707 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
708 PyMem_DEL(defaultLocation);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
709 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
710 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
711 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
712 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
713 return (PyObject *)newnavrrobject(&reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
714 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
715
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
716 static char nav_NavChooseObject__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
717 "(DialogOptions dict or kwargs+defaultLocation,eventProc,filterProc) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
718 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
719
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
720 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
721 nav_NavChooseObject(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
722 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
723 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
724 AEDesc *defaultLocation = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
725 NavReplyRecord reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
726 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
727 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
728 NavObjectFilterUPP filterProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
729 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
730
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
731 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
732 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
733 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
734 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
735 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
736 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
737 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, &filterProc, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
738 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
739 err = NavChooseObject(defaultLocation, &reply, &dialogOptions,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
740 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
741 PyMem_DEL(defaultLocation);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
742 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
743 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
744 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
745 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
746 return (PyObject *)newnavrrobject(&reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
747 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
748
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
749 static char nav_NavNewFolder__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
750 "(DialogOptions dict or kwargs+defaultLocation,eventProc) -> NavReplyRecord"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
751 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
752
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
753 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
754 nav_NavNewFolder(PyObject *self, PyObject *args, PyObject *kw)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
755 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
756 PyObject *dict;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
757 AEDesc *defaultLocation = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
758 NavReplyRecord reply;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
759 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
760 NavEventUPP eventProc = NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
761 OSErr err;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
762
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
763 if ( kw && PyObject_IsTrue(kw) ) {
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
764 if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
765 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
766 dict = kw;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
767 } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
768 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
769 if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
770 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
771 err = NavNewFolder(defaultLocation, &reply, &dialogOptions, eventProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
772 PyMem_DEL(defaultLocation);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
773 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
774 PyErr_Mac(ErrorObject, err);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
775 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
776 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
777 return (PyObject *)newnavrrobject(&reply);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
778 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
779
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
780 #if 0
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
781 /* XXXX I don't know what to do with the void * argument */
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
782 static char nav_NavCustomControl__doc__[] =
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
783 ""
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
784 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
785
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
786
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
787 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
788 nav_NavCustomControl(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
789 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
790
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
791 if (!PyArg_ParseTuple(args, ""))
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
792 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
793 Py_INCREF(Py_None);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
794 return Py_None;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
795 }
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
796 #endif
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
797
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
798 static char nav_NavServicesCanRun__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
799 "()->int"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
800 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
801
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
802 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
803 nav_NavServicesCanRun(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
804 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
805 Boolean rv;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
806 if (!PyArg_ParseTuple(args, ""))
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
807 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
808 rv = NavServicesCanRun();
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
809 return Py_BuildValue("l", (long)rv);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
810 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
811
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
812 static char nav_NavServicesAvailable__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
813 "()->int"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
814 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
815
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
816 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
817 nav_NavServicesAvailable(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
818 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
819 Boolean rv;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
820
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
821 if (!PyArg_ParseTuple(args, ""))
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
822 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
823 rv = NavServicesAvailable();
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
824 return Py_BuildValue("l", (long)rv);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
825 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
826 /* XX */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
827 static char nav_NavLoad__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
828 "()->None"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
829 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
830
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
831 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
832 nav_NavLoad(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
833 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
834
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
835 if (!PyArg_ParseTuple(args, ""))
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
836 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
837 NavLoad();
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
838 Py_INCREF(Py_None);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
839 return Py_None;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
840 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
841
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
842 static char nav_NavUnload__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
843 "()->None"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
844 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
845
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
846 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
847 nav_NavUnload(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
848 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
849
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
850 if (!PyArg_ParseTuple(args, ""))
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
851 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
852 NavUnload();
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
853 Py_INCREF(Py_None);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
854 return Py_None;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
855 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
856
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
857 static char nav_NavLibraryVersion__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
858 "()->int"
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
859 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
860
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
861 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
862 nav_NavLibraryVersion(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
863 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
864 UInt32 rv;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
865
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
866 if (!PyArg_ParseTuple(args, ""))
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
867 return NULL;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
868 rv = NavLibraryVersion();
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
869 return Py_BuildValue("l", (long)rv);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
870 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
871
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
872 static char nav_NavGetDefaultDialogOptions__doc__[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
873 "()->dict\nPass dict or keyword args with same names to other calls."
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
874 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
875
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
876 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
877 nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
878 {
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
879 NavDialogOptions dialogOptions;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
880 OSErr err;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
881
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
882 err = NavGetDefaultDialogOptions(&dialogOptions);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
883 if ( err ) {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
884 PyErr_Mac(ErrorObject, err);
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
885 return NULL;
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
886 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
887 return Py_BuildValue(
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
888 #ifndef __LP64__
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
889 "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
890 #else /* __LP64__ */
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
891 "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
892 #endif /* __LP64__ */
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
893 "version", dialogOptions.version,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
894 "dialogOptionFlags", dialogOptions.dialogOptionFlags,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
895 "location", PyMac_BuildPoint, dialogOptions.location,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
896 "clientName", PyMac_BuildStr255, &dialogOptions.clientName,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
897 "windowTitle", PyMac_BuildStr255, &dialogOptions.windowTitle,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
898 "actionButtonLabel", PyMac_BuildStr255, &dialogOptions.actionButtonLabel,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
899 "cancelButtonLabel", PyMac_BuildStr255, &dialogOptions.cancelButtonLabel,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
900 "savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
901 "message", PyMac_BuildStr255, &dialogOptions.message,
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
902 "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
903 #ifndef __LP64__
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
904 ,"popupExtension", OptResObj_New, dialogOptions.popupExtension
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
905 #endif /* __LP64__ */
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
906 );
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
907 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
908
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
909 /* List of methods defined in the module */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
910
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
911 static struct PyMethodDef nav_methods[] = {
11587
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
912 {"NavGetFile", (PyCFunction)nav_NavGetFile, METH_VARARGS|METH_KEYWORDS, nav_NavGetFile__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
913 {"NavPutFile", (PyCFunction)nav_NavPutFile, METH_VARARGS|METH_KEYWORDS, nav_NavPutFile__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
914 {"NavAskSaveChanges", (PyCFunction)nav_NavAskSaveChanges, METH_VARARGS|METH_KEYWORDS, nav_NavAskSaveChanges__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
915 {"NavCustomAskSaveChanges", (PyCFunction)nav_NavCustomAskSaveChanges, METH_VARARGS|METH_KEYWORDS, nav_NavCustomAskSaveChanges__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
916 {"NavAskDiscardChanges", (PyCFunction)nav_NavAskDiscardChanges, METH_VARARGS|METH_KEYWORDS, nav_NavAskDiscardChanges__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
917 {"NavChooseFile", (PyCFunction)nav_NavChooseFile, METH_VARARGS|METH_KEYWORDS, nav_NavChooseFile__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
918 {"NavChooseFolder", (PyCFunction)nav_NavChooseFolder, METH_VARARGS|METH_KEYWORDS, nav_NavChooseFolder__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
919 {"NavChooseVolume", (PyCFunction)nav_NavChooseVolume, METH_VARARGS|METH_KEYWORDS, nav_NavChooseVolume__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
920 {"NavChooseObject", (PyCFunction)nav_NavChooseObject, METH_VARARGS|METH_KEYWORDS, nav_NavChooseObject__doc__},
3ffdf05f5635 Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents: 11581
diff changeset
921 {"NavNewFolder", (PyCFunction)nav_NavNewFolder, METH_VARARGS|METH_KEYWORDS, nav_NavNewFolder__doc__},
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
922 #if 0
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
923 {"NavCustomControl", (PyCFunction)nav_NavCustomControl, METH_VARARGS, nav_NavCustomControl__doc__},
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
924 #endif
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
925 {"NavServicesCanRun", (PyCFunction)nav_NavServicesCanRun, METH_VARARGS, nav_NavServicesCanRun__doc__},
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
926 {"NavServicesAvailable", (PyCFunction)nav_NavServicesAvailable, METH_VARARGS, nav_NavServicesAvailable__doc__},
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
927 {"NavLoad", (PyCFunction)nav_NavLoad, METH_VARARGS, nav_NavLoad__doc__},
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
928 {"NavUnload", (PyCFunction)nav_NavUnload, METH_VARARGS, nav_NavUnload__doc__},
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
929 {"NavLibraryVersion", (PyCFunction)nav_NavLibraryVersion, METH_VARARGS, nav_NavLibraryVersion__doc__},
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
930 {"NavGetDefaultDialogOptions", (PyCFunction)nav_NavGetDefaultDialogOptions, METH_VARARGS, nav_NavGetDefaultDialogOptions__doc__},
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
931 {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
932 };
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
933
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
934
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
935 /* Initialization function for the module (*must* be called initNav) */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
936
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
937 static char Nav_module_documentation[] =
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
938 "Interface to Navigation Services\n"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
939 "Most calls accept a NavDialogOptions dictionary or keywords with the same names, pass {}\n"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
940 "if you want the default options.\n"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
941 "Use NavGetDefaultDialogOptions() to find out common option names.\n"
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
942 "See individual docstrings for additional keyword args/dictentries supported by each call.\n"
11593
cab3ff551f4b Added a line about passing None as eventProc to the docstring to get movable
Jack Jansen <jack.jansen@cwi.nl>
parents: 11590
diff changeset
943 "Pass None as eventProc to get movable-modal dialogs that process updates through the standard Python mechanism."
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
944 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
945
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
946 void
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
947 initNav(void)
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
948 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
949 PyObject *m, *d;
46967
6df0394abbf1 Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 36650
diff changeset
950
6df0394abbf1 Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 36650
diff changeset
951 if (PyErr_WarnPy3k("In 3.x, Nav is removed.", 1))
6df0394abbf1 Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 36650
diff changeset
952 return;
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
953
14563
03e6150fd8d5 Fixes that should make it possible to run Python on machines without NavServices installed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14465
diff changeset
954 /* Test that we have NavServices */
03e6150fd8d5 Fixes that should make it possible to run Python on machines without NavServices installed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14465
diff changeset
955 if ( !NavServicesAvailable() ) {
03e6150fd8d5 Fixes that should make it possible to run Python on machines without NavServices installed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14465
diff changeset
956 PyErr_SetString(PyExc_ImportError, "Navigation Services not available");
03e6150fd8d5 Fixes that should make it possible to run Python on machines without NavServices installed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14465
diff changeset
957 return;
03e6150fd8d5 Fixes that should make it possible to run Python on machines without NavServices installed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14465
diff changeset
958 }
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
959 /* Create the module and add the functions */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
960 m = Py_InitModule4("Nav", nav_methods,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
961 Nav_module_documentation,
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
962 (PyObject*)NULL,PYTHON_API_VERSION);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
963
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
964 /* Add some symbolic constants to the module */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
965 d = PyModule_GetDict(m);
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
966 ErrorObject = PyString_FromString("Nav.error");
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
967 PyDict_SetItemString(d, "error", ErrorObject);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
968
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
969 /* XXXX Add constants here */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
970
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
971 /* Set UPPs */
17923
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
972 my_eventProcUPP = NewNavEventUPP(my_eventProc);
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
973 my_previewProcUPP = NewNavPreviewUPP(my_previewProc);
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
974 my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
975
11581
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
976 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
977