annotate Mac/Modules/Nav.c @ 58925:eecf1bef052d 2.6

Merged revisions 78207 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line #7930: fix stripid ........
author Ezio Melotti <ezio.melotti@gmail.com>
date Tue, 16 Feb 2010 23:29:44 +0000
parents 06ce27a82e99
children e38335d4df91 b2625acc2484
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
56182
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
36 #ifndef __LP64__
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
37
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
38 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
39
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
40 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
41 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
42 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
43
648d97bd3ac6 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 /* 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
45 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
46 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
47 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
48 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
49 {
648d97bd3ac6 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 *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
51 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
52 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
53
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
54 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
55 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
56 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
57 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
58 }
648d97bd3ac6 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 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
60 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
61 }
648d97bd3ac6 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 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
63 (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
64 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
65 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
66 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
67 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
68 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
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 }
648d97bd3ac6 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
648d97bd3ac6 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 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
73 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
74 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
75 {
648d97bd3ac6 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 *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
77 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
78 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
79 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
80
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
81 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
82 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
83 PyErr_Print();
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
84 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
85 }
648d97bd3ac6 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 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
87 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
88 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
89 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
90 } 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
91 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
92 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
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 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
95 }
648d97bd3ac6 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
648d97bd3ac6 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 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
98 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
99 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
100 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
101 {
648d97bd3ac6 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 *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
103 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
104 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
105 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
106
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
107 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
108 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
109 PyErr_Print();
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
110 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
111 }
648d97bd3ac6 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 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
113 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
114 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
115 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
116 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
117 } 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
118 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
119 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
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 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
122 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
123
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
124 /* ----------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
125 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
126 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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135 {
36650
5d828703c6a1 Fix a couple of warnings on Mac OS X.
Neal Norwitz <nnorwitz@gmail.com>
parents: 30982
diff changeset
136 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
137 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
138 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
139 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
140
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
141 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
142
273a5e9aa633 Navigation 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 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
144 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
145 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
146 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
147 }
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
148 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
149 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
150 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
151 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
152 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
153 }
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
154 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
155 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
156 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
157 }
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
158 *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
159 } 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
160 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
161 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
162 } 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
163 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
164 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
165 } 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
166 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
167 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
168 } 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
169 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
170 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
171 } 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
172 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
173 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
174 } 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
175 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
176 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
177 } 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
178 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
179 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
180 } 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
181 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
182 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
183 } 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
184 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
185 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
186 } 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
187 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
188 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
189 } 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
190 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
191 return 0;
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;
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
198 } 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
199 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
200 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
201 } 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
202 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
203 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
204 } 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
205 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
206 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
207 } 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
208 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
209 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
210 }
273a5e9aa633 Navigation 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 }
273a5e9aa633 Navigation 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 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
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
273a5e9aa633 Navigation 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 /* 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
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 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
220 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
221 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
222 } 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
223
24280
1598a1e473e2 staticforward bites the dust.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23510
diff changeset
224 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
225
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
226
273a5e9aa633 Navigation 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
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
230 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
231 "(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
232 ;
648d97bd3ac6 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
648d97bd3ac6 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
235 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
236 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
237 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
238 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
239
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
240 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
241 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
242 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
243 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
244 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
245 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
246 }
648d97bd3ac6 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 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
248 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
249 }
648d97bd3ac6 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
648d97bd3ac6 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 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
252 "(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
253 ;
648d97bd3ac6 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
648d97bd3ac6 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
256 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
257 {
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
258 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
259 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
260
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
261 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
262 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
263 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
264 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
265 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
266 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
267 }
648d97bd3ac6 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 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
269 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
270 }
648d97bd3ac6 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
648d97bd3ac6 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
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
273 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
274 {"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
275 {"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
276
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
277 {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
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
273a5e9aa633 Navigation 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 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
284 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
285 {
273a5e9aa633 Navigation 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 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
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 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
289 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
290 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
291 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
292 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
293 }
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 static void
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
297 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
298 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
299 NavDisposeReply(&self->itself);
23510
82309c7325ef Replaced lots of PyMem_DEL() calls with PyObject_DEL().
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
300 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
301 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
302
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
304 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
305 {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
306 FSRef fsr;
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
307 FSSpec fss;
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
308
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
309 if( strcmp(name, "__members__") == 0 )
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
310 return Py_BuildValue(
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
311 "ssssssssss",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
312 "version", "validRecord", "replacing",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
313 "isStationery", "translationNeeded",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
314 "selection",
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
315 "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
316 "fileTranslation", "keyScript", "saveFileName");
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
317
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
318 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
319 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
320 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
321 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
322 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
323 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
324 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
325 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
326 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
327 return Py_BuildValue("l", (long)self->itself.translationNeeded);
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
328 if( strcmp(name, "selection") == 0 ) {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
329 SInt32 i;
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
330 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
331 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
332 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
333 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
334
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
335 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
336 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
337 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
338 }
648d97bd3ac6 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 ( (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
340 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
341 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
342 desc.dataHandle = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
343 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
344 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
345 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
346 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
347 }
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
348 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
349 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
350 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
351 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
352 }
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
353 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
354 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
355 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
356 }
648d97bd3ac6 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 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
358 }
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
359 if( strcmp(name, "selection_fsr") == 0 ) {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
360 SInt32 i;
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
361 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
362 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
363 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
364 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
365
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
366 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
367 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
368 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
369 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
370 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
371 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
372 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
373 desc.dataHandle = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
374 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
375 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
376 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
377 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
378 }
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
379 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
380 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
381 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
382 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
383 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
384 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
385 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
386 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
387 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
388 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
389 }
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
390 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
391 return ResObj_New((Handle)self->itself.fileTranslation);
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 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
393 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
394 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
395 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
396
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
397
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
398 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
399 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
400
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
401 static int
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
402 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
403 {
273a5e9aa633 Navigation 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 /* 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
405
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
406 /* 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
407 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
408 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
409
273a5e9aa633 Navigation 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 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
411 "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
412 ;
273a5e9aa633 Navigation 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 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
415 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
416 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
417 "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
418 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
419 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
420 /* 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
421 (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
422 (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
423 (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
424 (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
425 (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
426 (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
427 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
428 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
429 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
430 (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
431 (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
432 (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
433
273a5e9aa633 Navigation 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 /* 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
435 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
436 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
437 };
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 /* 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
440
273a5e9aa633 Navigation 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 /* ----------------------------------------------------- */
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 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
444 "(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
445 ;
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
448 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
449 {
273a5e9aa633 Navigation 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 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
460 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
461 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
462 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
463 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
464 } 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
465 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
466 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
467 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
468 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
469 eventProc, previewProc, filterProc, typeList, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
470 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
471 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
472 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
473 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
474 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
475 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
476 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
477
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
478 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
479 "(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
480 ;
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
483 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
484 {
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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
494 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
495 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
496 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
497 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
498 } 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
499 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
500 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
501 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
502 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
503 eventProc, fileType, fileCreator, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
504 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
505 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
506 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
507 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
508 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
509 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
510 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
511
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
512 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
513 "(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
514
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
515 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
516
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
517 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
518 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
519 {
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
520 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
521 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
522 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
523 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
524 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
525 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
526
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
527 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
528 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
529 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
530 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
531 } 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
532 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
533 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
534 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
535 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
536 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
537 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
538 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
539 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
540 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
541 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
542
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
543 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
544 "(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
545 ;
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
547 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
548 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
549 {
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
550 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
551 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
552 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
553 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
554 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
555
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
556 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
557 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
558 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
559 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
560 } 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
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
569 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
570 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
571
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
572 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
573 "(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
574 ;
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
576 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
577 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
578 {
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
579 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
580 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
581 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
582 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
583 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
584
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
585 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
586 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
587 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
588 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
589 } 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
590 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
591 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
592 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
593 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
594 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
595 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
596 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
597 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
598 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
599 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
600
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
601 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
602 "(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
603 ;
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
605 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
606 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
607 {
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
608 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
609 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
610 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
611 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
612 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
613 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
614 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
615 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
616 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
617
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
618 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
619 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
620 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
621 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
622 } 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
623 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
624 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
625 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
626 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
627 eventProc, previewProc, filterProc, typeList, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
628 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
629 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
630 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
631 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
632 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
633 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
634 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
635
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
636 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
637 "(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
638 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
639
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
640 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
641 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
642 {
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 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
644 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
645 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
646 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
647 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
648 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
649 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
650
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
651 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
652 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
653 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
654 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
655 } 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
656 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
657 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
658 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
659 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
660 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
661 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
662 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
663 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
664 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
665 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
666 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
667 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
668
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
669 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
670 "(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
671 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
672
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
673 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
674 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
675 {
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 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
677 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
678 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
679 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
680 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
681 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
682 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
683
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
684 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
685 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
686 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
687 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
688 } 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
689 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
690 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
691 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
692 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
693 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
694 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
695 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
696 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
697 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
698 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
699 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
700 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
701
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
702 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
703 "(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
704 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
705
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
706 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
707 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
708 {
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 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
710 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
711 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
712 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
713 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
714 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
715 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
716
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
717 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
718 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
719 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
720 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
721 } 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
722 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
723 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
724 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
725 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
726 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
727 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
728 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
729 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
730 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
731 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
732 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
733 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
734
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
735 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
736 "(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
737 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
738
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
739 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
740 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
741 {
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 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
743 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
744 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
745 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
746 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
747 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
748
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
749 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
750 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
751 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
752 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
753 } 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
754 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
755 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
756 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
757 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
758 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
759 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
760 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
761 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
762 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
763 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
764 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
765
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
766 #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
767 /* 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
768 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
769 ""
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
770 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
771
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
772
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
773 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
774 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
775 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
776
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
777 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
778 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
779 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
780 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
781 }
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 #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
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 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
785 "()->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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
788 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
789 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
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 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
792 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
793 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
794 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
795 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
796 }
273a5e9aa633 Navigation 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_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
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_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
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
273a5e9aa633 Navigation 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 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
808 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
809 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
810 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
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 /* 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
813 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
814 "()->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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
817 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
818 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
819 {
273a5e9aa633 Navigation 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 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
824 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
825 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
826 }
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
828 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
829 "()->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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
832 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
833 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
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
273a5e9aa633 Navigation 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 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
837 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
838 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
839 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
840 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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
843 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
844 "()->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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
847 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
848 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
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 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
851
273a5e9aa633 Navigation 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 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
853 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
854 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
855 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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
858 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
859 "()->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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
862 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
863 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
864 {
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
865 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
866 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
867
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
868 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
869 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
870 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
871 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
872 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
873 return Py_BuildValue(
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
874 "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
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
875 "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
876 "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
877 "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
878 "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
879 "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
880 "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
881 "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
882 "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
883 "message", PyMac_BuildStr255, &dialogOptions.message,
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
884 "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
885 ,"popupExtension", OptResObj_New, dialogOptions.popupExtension
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
886 );
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
887 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
888
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
889 /* 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
890
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
891 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
892 {"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
893 {"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
894 {"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
895 {"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
896 {"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
897 {"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
898 {"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
899 {"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
900 {"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
901 {"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
902 #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
903 {"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
904 #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
905 {"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
906 {"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
907 {"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
908 {"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
909 {"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
910 {"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
911 {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
912 };
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
913
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
914
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
915 /* 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
916
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
917 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
918 "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
919 "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
920 "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
921 "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
922 "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
923 "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
924 ;
273a5e9aa633 Navigation 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
56182
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
926
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
927 #endif /* !__LP64__ */
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
928
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
929
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
930 void
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
931 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
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 PyObject *m, *d;
46967
6df0394abbf1 Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 36650
diff changeset
934
6df0394abbf1 Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 36650
diff changeset
935 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
936 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
937
56182
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
938 #ifdef __LP64__
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
939 PyErr_SetString(PyExc_ImportError, "Navigation Services not available in 64-bit mode");
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
940 return;
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
941
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
942 #else /* !__LP64__ */
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
943
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
944 /* 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
945 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
946 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
947 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
948 }
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
949 /* 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
950 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
951 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
952 (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
953
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
954 /* 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
955 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
956 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
957 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
958
273a5e9aa633 Navigation 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 /* 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
960
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
961 /* 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
962 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
963 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
964 my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
56182
06ce27a82e99 Merged revisions 75017 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47527
diff changeset
965 #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
966
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 }
273a5e9aa633 Navigation 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