Mercurial > cpython-lru_cache-weakref
annotate Mac/Modules/Nav.c @ 25838:8540887bcec6 2.2
Backport of 2.183:
Fix memory leak in add_subclass() found by NealN with valgrind.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 18 Oct 2002 13:42:21 +0000 |
| parents | 91dd223829c6 |
| children | 82309c7325ef |
| 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 ) { |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
59 PyErr_Clear(); |
|
648d97bd3ac6
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 { |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
77 fprintf(stderr, "Nav: exception in eventProc callback\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
|
78 PyErr_Clear(); |
|
648d97bd3ac6
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 ) { |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
93 PyErr_Clear(); |
|
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 { |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
101 fprintf(stderr, "Nav: exception in previewProc callback\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
|
102 PyErr_Clear(); |
|
648d97bd3ac6
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; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
116 |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
117 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
|
118 if ( (pyfunc = PyDict_GetItemString(dict, "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
|
119 PyErr_Clear(); |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
120 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
|
121 } |
|
648d97bd3ac6
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 rv = PyObject_CallFunction(pyfunc, "O&s#h", |
|
648d97bd3ac6
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 AEDesc_New, theItem, info, sizeof(NavFileOrFolderInfo), (short)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
|
124 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
|
125 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
|
126 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
|
127 } else { |
|
648d97bd3ac6
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 fprintf(stderr, "Nav: exception in filterProc callback\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
|
129 PyErr_Clear(); |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
130 } |
|
648d97bd3ac6
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 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
|
132 } |
|
648d97bd3ac6
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 |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
134 /* ----------------------------------------------------- */ |
|
273a5e9aa633
Navigation 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 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 { |
|
273a5e9aa633
Navigation 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 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
|
147 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
|
148 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
|
149 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
|
150 |
|
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
|
151 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
|
152 |
|
273a5e9aa633
Navigation 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 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
|
154 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
|
155 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
|
156 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
|
157 } |
|
273a5e9aa633
Navigation 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 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 } |
|
0ad23324016e
Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents:
11593
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 } |
|
0ad23324016e
Handling of defaultLocation argument was wrong, causing a crash when used. Fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents:
11593
diff
changeset
|
168 *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
|
169 } 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
|
170 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
|
171 return 0; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
172 } else if( strcmp(keystr, "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
|
173 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
|
174 return 0; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
175 } else if( strcmp(keystr, "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
|
176 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
|
177 return 0; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
178 } else if( strcmp(keystr, "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
|
179 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
|
180 return 0; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
181 } else if( strcmp(keystr, "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
|
182 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
|
183 return 0; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
184 } else if( strcmp(keystr, "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
|
185 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
|
186 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
|
187 } 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
|
188 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
|
189 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
|
190 } 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
|
191 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
|
192 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
|
193 } 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
|
194 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
|
195 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
|
196 } 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
|
197 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
|
198 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
|
199 } 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
|
200 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
|
201 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
|
202 } 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
|
203 *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
|
204 } else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) { |
|
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 PyErr_SetString(ErrorObject, "No callbacks implemented yet"); |
|
3ffdf05f5635
Allow keyword arguments, and the dialog is now actually shown. No way to
Jack Jansen <jack.jansen@cwi.nl>
parents:
11581
diff
changeset
|
206 return 0; |
|
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 ) { |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
208 PyErr_SetString(ErrorObject, "No callbacks implemented yet"); |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
209 return 0; |
|
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
|
210 } 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
|
211 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
|
212 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
|
213 } 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
|
214 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
|
215 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
|
216 } 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
|
217 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
|
218 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
|
219 } 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
|
220 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
|
221 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
|
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 } |
|
273a5e9aa633
Navigation 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 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
|
225 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
226 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
227 /* ----------------------------------------------------- */ |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
228 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
229 /* 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
|
230 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 } 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
|
235 |
|
273a5e9aa633
Navigation 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 staticforward 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
|
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 /* ---------------------------------------------------------------- */ |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
241 |
|
11590
648d97bd3ac6
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 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
|
243 "(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
|
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 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
246 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
247 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
|
248 { |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
249 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
|
250 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
|
251 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
252 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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 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
|
258 } |
|
648d97bd3ac6
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 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
|
260 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
|
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 |
|
648d97bd3ac6
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 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
|
264 "(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
|
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 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
267 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
268 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
|
269 { |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
270 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
|
271 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
|
272 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
273 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
|
274 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
|
275 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
|
276 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
|
277 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
|
278 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
|
279 } |
|
648d97bd3ac6
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 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
|
281 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
|
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 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
284 |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
285 static 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
|
286 {"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
|
287 {"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
|
288 |
|
273a5e9aa633
Navigation 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 {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
|
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 |
|
273a5e9aa633
Navigation 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 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
|
296 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
|
297 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
298 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
|
299 |
|
273a5e9aa633
Navigation 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 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
|
301 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
|
302 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
|
303 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
|
304 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
|
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 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
308 static void |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
309 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
|
310 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
311 NavDisposeReply(&self->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
|
312 PyMem_DEL(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
|
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 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
315 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
316 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
|
317 { |
|
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
|
318 FSSpec fss; |
|
3fe304050434
Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents:
12591
diff
changeset
|
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 ) |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
321 return Py_BuildValue("sssssss", "version", "validRecord", "replacing", |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
322 "isStationery", "translationNeeded", "selection", "fileTranslation"); |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
323 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
|
324 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
|
325 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
|
326 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
|
327 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
|
328 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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 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
|
338 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
339 if (err=AECountItems(&self->itself.selection, &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
|
340 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
|
341 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
|
342 } |
|
648d97bd3ac6
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 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
|
344 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
|
345 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
|
346 desc.dataHandle = NULL; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
347 if (err=AEGetNthDesc(&self->itself.selection, i+1, typeFSS, NULL, &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
|
348 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
|
349 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
|
350 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
|
351 } |
|
13608
a901c2c0166b
Test for TARGET_API_MAC_CARBON with #if in stead of #ifdef.
Jack Jansen <jack.jansen@cwi.nl>
parents:
13606
diff
changeset
|
352 #if TARGET_API_MAC_CARBON |
|
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
|
353 if (err=AEGetDescData(&desc, &fss, sizeof(FSSpec))) { |
|
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 #else |
|
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
|
359 memcpy((void *)&fss, (void *)*desc.dataHandle, sizeof(FSSpec)); |
|
3fe304050434
Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents:
12591
diff
changeset
|
360 #endif |
|
3fe304050434
Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Jack Jansen <jack.jansen@cwi.nl>
parents:
12591
diff
changeset
|
361 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
|
362 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
|
363 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
|
364 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
365 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
|
366 } |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
367 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
|
368 return ResObj_New((Handle)self->itself.fileTranslation); |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
369 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
370 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
371 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
|
372 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
373 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
374 static int |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
375 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
|
376 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
377 /* 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
|
378 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
379 /* 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
|
380 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
|
381 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
382 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
383 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
|
384 "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
|
385 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
386 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
387 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
|
388 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
|
389 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
|
390 "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
|
391 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
|
392 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
|
393 /* 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
|
394 (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
|
395 (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
|
396 (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
|
397 (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
|
398 (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
|
399 (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
|
400 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
|
401 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
|
402 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
|
403 (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
|
404 (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
|
405 (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
|
406 |
|
273a5e9aa633
Navigation 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 /* 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
|
408 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
|
409 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
|
410 }; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
411 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
412 /* 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
|
413 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
414 /* ----------------------------------------------------- */ |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
415 |
|
273a5e9aa633
Navigation 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 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
|
417 "(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
|
418 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
419 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
420 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
421 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
|
422 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
433 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
|
434 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
|
435 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
|
436 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
|
437 } 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 eventProc, previewProc, filterProc, typeList, (void *)dict); |
| 12591 | 443 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
|
444 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
|
445 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
|
446 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
|
447 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
448 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
|
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 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
|
452 "(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
|
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 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
456 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
|
457 { |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
458 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
|
459 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
|
460 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
|
461 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
467 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
|
468 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
|
469 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
|
470 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
|
471 } 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
|
472 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
|
473 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
|
474 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
|
475 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
|
476 eventProc, fileType, fileCreator, (void *)dict); |
| 12591 | 477 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
|
478 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
|
479 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
|
480 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
|
481 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
482 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
|
483 } |
|
273a5e9aa633
Navigation 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 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
|
486 "(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
|
487 |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
488 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
489 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
490 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
491 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
|
492 { |
|
11590
648d97bd3ac6
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 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
500 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
|
501 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
|
502 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
|
503 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
|
504 } 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
|
505 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
|
506 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
|
507 return NULL; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
508 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
|
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 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
|
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_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
|
517 "(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
|
518 ; |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
521 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
|
522 { |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
529 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
|
530 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
|
531 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
|
532 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
|
533 } 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 } |
|
648d97bd3ac6
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 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
|
543 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
544 |
|
273a5e9aa633
Navigation 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 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
|
546 "(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
|
547 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
548 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
550 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
|
551 { |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
552 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
558 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
|
559 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
|
560 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
|
561 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
|
562 } 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 } |
|
648d97bd3ac6
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 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
|
572 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
573 |
|
273a5e9aa633
Navigation 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 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
|
575 "(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
|
576 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
577 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
579 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
|
580 { |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
581 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
|
582 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
|
583 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
|
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 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
|
586 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
|
587 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
|
588 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
|
589 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
|
590 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
591 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
|
592 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
|
593 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
|
594 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
|
595 } 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 eventProc, previewProc, filterProc, typeList, (void *)dict); |
| 12591 | 601 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
|
602 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
|
603 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
|
604 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
|
605 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
606 return (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
|
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 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
|
610 "(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
|
611 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
612 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
613 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
614 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
|
615 { |
|
11590
648d97bd3ac6
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 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
|
617 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
|
618 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
|
619 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
|
620 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
|
621 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
|
622 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
|
623 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
624 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
|
625 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
|
626 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
|
627 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
|
628 } 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
|
629 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
|
630 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
|
631 return NULL; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
632 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
|
633 eventProc, filterProc, (void *)dict); |
| 12591 | 634 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
|
635 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
|
636 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
|
637 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
|
638 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
639 return (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
|
640 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
641 |
|
273a5e9aa633
Navigation 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 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
|
643 "(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
|
644 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
645 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
647 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
|
648 { |
|
11590
648d97bd3ac6
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 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
|
650 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
|
651 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
|
652 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
|
653 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
|
654 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
|
655 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
|
656 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
657 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
|
658 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
|
659 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
|
660 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
|
661 } 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
|
662 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
|
663 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
|
664 return NULL; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
665 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
|
666 eventProc, filterProc, (void *)dict); |
| 12591 | 667 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
|
668 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
|
669 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
|
670 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
|
671 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
672 return (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
|
673 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
674 |
|
273a5e9aa633
Navigation 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 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
|
676 "(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
|
677 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
678 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
680 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
|
681 { |
|
11590
648d97bd3ac6
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 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
|
683 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
|
684 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
|
685 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
|
686 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
|
687 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
|
688 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
|
689 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
690 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
|
691 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
|
692 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
|
693 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
|
694 } 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
|
695 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
|
696 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
|
697 return NULL; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
698 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
|
699 eventProc, filterProc, (void *)dict); |
| 12591 | 700 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
|
701 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
|
702 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
|
703 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
|
704 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
705 return (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
|
706 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
707 |
|
273a5e9aa633
Navigation 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 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
|
709 "(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
|
710 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
711 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
713 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
|
714 { |
|
11590
648d97bd3ac6
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 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 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
|
721 |
|
16057
e3259e4bec60
Treat an empty kwdict argument the same as a missing one.
Jack Jansen <jack.jansen@cwi.nl>
parents:
14563
diff
changeset
|
722 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
|
723 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
|
724 return NULL; |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
725 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
|
726 } 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
|
727 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
|
728 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
|
729 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
|
730 err = NavNewFolder(defaultLocation, &reply, &dialogOptions, eventProc, (void *)dict); |
| 12591 | 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 |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
739 #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
|
740 /* 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
|
741 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
|
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 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
744 |
|
273a5e9aa633
Navigation 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 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
746 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
747 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
|
748 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
749 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
750 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
|
751 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
|
752 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
|
753 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
|
754 } |
|
11590
648d97bd3ac6
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 #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
|
756 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
757 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
|
758 "()->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
|
759 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
760 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
761 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
762 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
|
763 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
764 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
|
765 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
|
766 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
|
767 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
|
768 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
|
769 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
770 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
771 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
|
772 "()->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
|
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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
776 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
|
777 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
778 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
|
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 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
|
781 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
|
782 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
|
783 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
|
784 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
785 /* 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
|
786 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
|
787 "()->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
|
788 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
789 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
790 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
791 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
|
792 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
793 |
|
273a5e9aa633
Navigation 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 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
|
795 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
|
796 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
|
797 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
|
798 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
|
799 } |
|
273a5e9aa633
Navigation 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 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
|
802 "()->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
|
803 ; |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
806 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
|
807 { |
|
273a5e9aa633
Navigation 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 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
815 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
816 static 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
|
817 "()->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
|
818 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
819 |
|
273a5e9aa633
Navigation 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 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
821 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
|
822 { |
|
273a5e9aa633
Navigation 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 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
|
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 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
|
828 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
|
829 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
830 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
831 static 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
|
832 "()->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
|
833 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
834 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
835 static PyObject * |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
836 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
|
837 { |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
838 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
|
839 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
|
840 |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
841 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
|
842 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
|
843 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
|
844 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
|
845 } |
|
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
846 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
|
847 "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
|
848 "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
|
849 "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
|
850 "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
|
851 "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
|
852 "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
|
853 "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
|
854 "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
|
855 "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
|
856 "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
|
857 "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
|
858 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
859 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
860 /* 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
|
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 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
|
863 {"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
|
864 {"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
|
865 {"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
|
866 {"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
|
867 {"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
|
868 {"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
|
869 {"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
|
870 {"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
|
871 {"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
|
872 {"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
|
873 #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
|
874 {"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
|
875 #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
|
876 {"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
|
877 {"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
|
878 {"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
|
879 {"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
|
880 {"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
|
881 {"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
|
882 {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
|
883 }; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
884 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
885 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
886 /* 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
|
887 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
888 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
|
889 "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
|
890 "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
|
891 "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
|
892 "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
|
893 "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
|
894 "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
|
895 ; |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
896 |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
897 void |
|
19709
0b0c84078f91
Added prototypes to silence gcc strict-prototype warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19648
diff
changeset
|
898 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
|
899 { |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
900 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
|
901 |
|
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
|
902 /* 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
|
903 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
|
904 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
|
905 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
|
906 } |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
907 /* 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
|
908 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
|
909 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
|
910 (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
|
911 |
|
273a5e9aa633
Navigation 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 /* 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
|
913 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
|
914 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
|
915 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
|
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 /* 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
|
918 |
|
11590
648d97bd3ac6
Finished (I think), but only very lightly tested. Should now have full interface: all
Jack Jansen <jack.jansen@cwi.nl>
parents:
11587
diff
changeset
|
919 /* 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
|
920 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
|
921 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
|
922 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
|
923 |
|
11581
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
924 } |
|
273a5e9aa633
Navigation Services module. Started from scratch, as Joe's module exported too little for my needs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
925 |
