annotate Mac/Modules/Nav.c @ 27998:e27f58a50737 legacy-trunk

SF bug #690377: Dud footnote reference in distutils docs
author Raymond Hettinger <python@rcn.com>
date Fri, 21 Feb 2003 02:47:09 +0000
parents 88faa985d98c
children a2d79b93b50a
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"
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
33 #include "macglue.h"
13606
c9a4a1316170 pymactoolbox.h contains protoypes for all externally visible toolbox module
Jack Jansen <jack.jansen@cwi.nl>
parents: 12836
diff changeset
34 #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
35 #ifdef WITHOUT_FRAMEWORKS
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
36 #include <Navigation.h>
17923
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
37 #else
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
38 #include <Carbon/Carbon.h>
a895d7d739ad Fixed changed UPP routines names. The module now compiles and loads.
Jack Jansen <jack.jansen@cwi.nl>
parents: 16057
diff changeset
39 #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
40
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
41 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
42
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
43 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
44 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
45 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
46
648d97bd3ac6 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 /* 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
48 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
49 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
50 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
51 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
52 {
648d97bd3ac6 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 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
54 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
55 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
56
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
57 if (!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
58 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
59 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
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 if ( pyfunc == Py_None ) {
19648
a3c045fa49f5 Don't call PyMac_HandleEvent in unix-Python
Jack Jansen <jack.jansen@cwi.nl>
parents: 17923
diff changeset
63 #if !TARGET_API_MAC_OSX
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
64 /* Special case: give update events to the Python event handling code */
648d97bd3ac6 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 if ( callBackSelector == kNavCBEvent &&
648d97bd3ac6 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 callBackParms->eventData.eventDataParms.event->what == updateEvt)
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
67 PyMac_HandleEvent(callBackParms->eventData.eventDataParms.event);
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
68 /* Ignore others */
19648
a3c045fa49f5 Don't call PyMac_HandleEvent in unix-Python
Jack Jansen <jack.jansen@cwi.nl>
parents: 17923
diff changeset
69 #endif
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
70 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
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 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
73 (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
74 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
75 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
76 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
77 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
78 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
79 }
648d97bd3ac6 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 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
81
648d97bd3ac6 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 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
83 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
84 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
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 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
87 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
88 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
89 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
90
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
91 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
92 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
93 PyErr_Print();
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
94 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
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 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
97 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
98 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
99 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
100 } 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
101 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
102 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
103 }
648d97bd3ac6 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 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
105 }
648d97bd3ac6 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
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
107 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
108 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
109 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
110 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
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 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
113 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
114 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
115 Boolean c_rv = false;
27287
88faa985d98c Fixed the first two bugs in the new file dialogs (found by Just):
Jack Jansen <jack.jansen@cwi.nl>
parents: 27277
diff changeset
116 PyObject theItemCopy;
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
117
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
118 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
119 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
120 PyErr_Print();
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
121 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
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 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
124 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
125 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
126 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
127 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
128 } 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
129 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
130 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
131 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
132 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
133 }
648d97bd3ac6 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
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 /* ----------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
136 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
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 {
273a5e9aa633 Navigation 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 int pos = 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
148 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
149 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
150 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
151
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
152 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
153
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
154 while ( PyDict_Next(d, &pos, &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
155 if ( !key || !value || !PyString_Check(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
156 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
157 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
158 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
159 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
160 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
161 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
162 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
163 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
164 }
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
165 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
166 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
167 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
168 }
0ad23324016e Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11593
diff changeset
169 *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
170 } else if( strcmp(keystr, "version") == 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
171 if ( !PyArg_Parse(value, "h", &opt->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
172 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
173 } else if( strcmp(keystr, "dialogOptionFlags") == 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 if ( !PyArg_Parse(value, "l", &opt->dialogOptionFlags) )
273a5e9aa633 Navigation 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 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
176 } 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
177 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
178 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
179 } 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
180 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
181 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
182 } 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
183 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
184 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
185 } 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
186 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
187 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
188 } 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
189 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
190 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
191 } 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
192 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
193 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
194 } 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
195 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
196 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
197 } 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
198 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
199 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
200 } 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
201 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
202 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
203 } 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
204 *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
205 } 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
206 *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
207 } 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
208 *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
209 } 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
210 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
211 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
212 } 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
213 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
214 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
215 } 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
216 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
217 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
218 } 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
219 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
220 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
221 }
273a5e9aa633 Navigation 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 }
273a5e9aa633 Navigation 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 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
224 }
273a5e9aa633 Navigation 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 /* 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
229
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
230 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
231 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
232 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
233 } 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
234
24280
1598a1e473e2 staticforward bites the dust.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23510
diff changeset
235 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
236
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
237
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
238
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
239 /* ---------------------------------------------------------------- */
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
240
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 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
242 "(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
243 ;
648d97bd3ac6 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
648d97bd3ac6 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
246 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
247 {
648d97bd3ac6 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 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
249 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
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 if (!PyArg_ParseTuple(args, "l", &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
252 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
253 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
254 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
255 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
256 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
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 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
259 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
260 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
261
648d97bd3ac6 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 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
263 "(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
264 ;
648d97bd3ac6 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
648d97bd3ac6 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
267 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
268 {
648d97bd3ac6 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 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
270 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
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 if (!PyArg_ParseTuple(args, "l", &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
273 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
274 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
275 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
276 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
277 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
278 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
279 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
280 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
281 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
282
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
283
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
284 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
285 {"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
286 {"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
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 {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
289 };
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
290
273a5e9aa633 Navigation 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 /* ---------- */
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 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
295 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
296 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
297 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
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 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
300 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
301 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
302 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
303 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
304 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
305
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
306
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
307 static void
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
308 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
309 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
310 NavDisposeReply(&self->itself);
23510
82309c7325ef Replaced lots of PyMem_DEL() calls with PyObject_DEL().
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
311 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
312 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
313
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
314 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
315 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
316 {
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
317 FSSpec fss;
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
318 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
319
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
320 if( strcmp(name, "__members__") == 0 )
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
321 return Py_BuildValue("ssssssssss", "version", "validRecord", "replacing",
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
322 "isStationery", "translationNeeded", "selection", "selection_fsr",
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
323 "fileTranslation", "keyScript", "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
324 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
325 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
326 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
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 if( strcmp(name, "selection") == 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
335 SInt32 i, count;
648d97bd3ac6 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 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
337 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
338 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
339
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
340 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
341 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
342 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
343 }
648d97bd3ac6 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 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
345 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
346 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
347 desc.dataHandle = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
348 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
349 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
350 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
351 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
352 }
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
353 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
354 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
355 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
356 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
357 }
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
358 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
359 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
360 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
361 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
362 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
363 }
26362
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
364 if( strcmp(name, "selection_fsr") == 0 ) {
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
365 SInt32 i, count;
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
366 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
367 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
368 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
369
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
370 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
371 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
372 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
373 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
374 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
375 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
376 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
377 desc.dataHandle = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
378 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
379 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
380 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
381 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
382 }
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
383 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
384 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
385 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
386 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
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 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
389 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
390 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
391 }
6e228e1aff38 Allow access to the returned value(s) as FSRefs. Unfortunately for some
Jack Jansen <jack.jansen@cwi.nl>
parents: 24280
diff changeset
392 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
393 }
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
394 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
395 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
396 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
397 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
398 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
399 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
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
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
402 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
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
273a5e9aa633 Navigation 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 static int
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
406 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
407 {
273a5e9aa633 Navigation 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 /* 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
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 /* 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
411 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
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 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
415 "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
416 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
417
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
418 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
419 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
420 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
421 "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
422 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
423 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
424 /* 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
425 (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
426 (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
427 (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
428 (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
429 (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
430 (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
431 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
432 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
433 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
434 (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
435 (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
436 (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
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 /* 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
439 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
440 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
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 /* 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
444
273a5e9aa633 Navigation 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 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
448 "(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
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
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
452 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
453 {
273a5e9aa633 Navigation 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 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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
464 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
465 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
466 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
467 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
468 } 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
469 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
470 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
471 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
472 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
473 eventProc, previewProc, filterProc, typeList, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
474 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
475 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
476 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
477 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
478 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
479 return (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
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 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
483 "(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
484 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
485
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
486 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
487 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
488 {
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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
498 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
499 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
500 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
501 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
502 } 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
503 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
504 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
505 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
506 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
507 eventProc, fileType, fileCreator, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
508 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
509 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
510 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
511 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
512 }
648d97bd3ac6 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 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
514 }
273a5e9aa633 Navigation 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 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
517 "(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
518
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 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
520
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
521 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
522 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
523 {
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
524 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
525 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
526 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
527 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
528 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
529 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
530
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
531 if ( kw && PyObject_IsTrue(kw) ) {
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
532 if (!PyArg_ParseTuple(args, "l", &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
533 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
534 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
535 } 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
536 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
537 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
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 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
540 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
541 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
542 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
543 }
648d97bd3ac6 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 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
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 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
548 "(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
549 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
550
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
551 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
552 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
553 {
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
554 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
555 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
556 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
557 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
558 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
559
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
560 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
561 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
562 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
563 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
564 } 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
565 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
566 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
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 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
569 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
570 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
571 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
572 }
648d97bd3ac6 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 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
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 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
577 "(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
578 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
579
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
580 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
581 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
582 {
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
583 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
584 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
585 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
586 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
587 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
588
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
589 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
590 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
591 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
592 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
593 } 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
594 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
595 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
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 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
598 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
599 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
600 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
601 }
648d97bd3ac6 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 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
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 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
606 "(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
607 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
608
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
609 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
610 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
611 {
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
612 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
613 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
614 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
615 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
616 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
617 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
618 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
619 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
620 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
621
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
622 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
623 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
624 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
625 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
626 } 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
627 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
628 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
629 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
630 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
631 eventProc, previewProc, filterProc, typeList, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
632 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
633 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
634 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
635 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
636 }
648d97bd3ac6 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 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
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 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
641 "(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
642 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
643
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
644 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
645 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
646 {
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
647 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
648 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
649 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
650 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
651 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
652 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
653 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
654
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
655 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
656 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
657 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
658 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
659 } 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
660 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
661 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
662 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
663 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
664 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
665 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
666 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
667 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
668 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
669 }
648d97bd3ac6 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 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
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 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
674 "(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
675 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
676
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
677 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
678 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
679 {
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
680 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
681 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
682 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
683 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
684 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
685 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
686 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
687
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
688 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
689 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
690 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
691 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
692 } 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
693 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
694 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
695 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
696 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
697 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
698 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
699 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
700 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
701 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
702 }
648d97bd3ac6 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 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
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 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
707 "(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
708 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
709
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
710 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
711 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
712 {
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
713 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
714 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
715 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
716 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
717 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
718 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
719 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
720
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
721 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
722 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
723 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
724 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
725 } 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
726 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
727 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
728 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
729 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
730 eventProc, filterProc, (void *)dict);
12591
e442662b28e1 Got rid of PyMem_XDEL.
Jack Jansen <jack.jansen@cwi.nl>
parents: 11654
diff changeset
731 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
732 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
733 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
734 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
735 }
648d97bd3ac6 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 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
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 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
740 "(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
741 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
742
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
743 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
744 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
745 {
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
746 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
747 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
748 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
749 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
750 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
751 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
752
16057
e3259e4bec60 Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents: 14563
diff changeset
753 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
754 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
755 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
756 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
757 } 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
758 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
759 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
760 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
761 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
762 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
763 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
764 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
765 return NULL;
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
766 }
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
767 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
768 }
273a5e9aa633 Navigation 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
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
770 #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
771 /* 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
772 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
773 ""
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
774 ;
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
778 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
779 {
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 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
782 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
783 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
784 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
785 }
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
786 #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
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 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
789 "()->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
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
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
793 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
794 {
273a5e9aa633 Navigation 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 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
796 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
797 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
798 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
799 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
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 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
803 "()->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
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
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
807 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
808 {
273a5e9aa633 Navigation 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 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
810
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
811 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
812 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
813 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
814 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
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 /* 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
817 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
818 "()->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
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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
822 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
823 {
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 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
826 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
827 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
828 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
829 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
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 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
833 "()->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
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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
837 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
838 {
273a5e9aa633 Navigation 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
273a5e9aa633 Navigation 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 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
841 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
842 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
843 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
844 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
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 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
848 "()->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
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
273a5e9aa633 Navigation 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 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
852 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
853 {
273a5e9aa633 Navigation 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 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
855
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
856 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
857 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
858 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
859 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
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 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
863 "()->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
864 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
865
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
866 static PyObject *
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
867 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
868 {
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
869 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
870 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
871
648d97bd3ac6 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 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
873 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
874 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
875 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
876 }
648d97bd3ac6 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 return Py_BuildValue("{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
648d97bd3ac6 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 "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
879 "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
880 "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
881 "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
882 "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
883 "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
884 "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
885 "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
886 "message", PyMac_BuildStr255, &dialogOptions.message,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
887 "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey,
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
888 "popupExtension", OptResObj_New, dialogOptions.popupExtension);
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
889 }
273a5e9aa633 Navigation 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 /* 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
892
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
893 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
894 {"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
895 {"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
896 {"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
897 {"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
898 {"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
899 {"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
900 {"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
901 {"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
902 {"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
903 {"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
904 #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
905 {"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
906 #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
907 {"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
908 {"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
909 {"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
910 {"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
911 {"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
912 {"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
913 {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
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
273a5e9aa633 Navigation 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 /* 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
918
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
919 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
920 "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
921 "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
922 "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
923 "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
924 "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
925 "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
926 ;
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
927
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
928 void
19709
0b0c84078f91 Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19648
diff changeset
929 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
930 {
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
931 PyObject *m, *d;
273a5e9aa633 Navigation 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
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
933 /* 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
934 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
935 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
936 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
937 }
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
938 /* 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
939 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
940 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
941 (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
942
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
943 /* 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
944 d = PyModule_GetDict(m);
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
945 ErrorObject = PyString_FromString("Nav.error");
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
946 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
947
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
948 /* 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
949
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
950 /* 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
951 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
952 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
953 my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
11590
648d97bd3ac6 Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents: 11587
diff changeset
954
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
955 }
273a5e9aa633 Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
956