Changeset 391 for python/trunk/Mac/Modules/help
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Mac/Modules/help/_Helpmodule.c
r2 r391 11 11 /* Macro to test whether a weak-loaded CFM function exists */ 12 12 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ 13 14 15 13 PyErr_SetString(PyExc_NotImplementedError, \ 14 "Not available in this shared library/OS version"); \ 15 return NULL; \ 16 16 }} while(0) 17 17 … … 23 23 static PyObject *Help_HMGetHelpMenu(PyObject *_self, PyObject *_args) 24 24 { 25 26 27 28 29 30 31 32 33 34 35 36 37 25 PyObject *_res = NULL; 26 OSStatus _err; 27 MenuRef outHelpMenu; 28 MenuItemIndex outFirstCustomItemIndex; 29 if (!PyArg_ParseTuple(_args, "")) 30 return NULL; 31 _err = HMGetHelpMenu(&outHelpMenu, 32 &outFirstCustomItemIndex); 33 if (_err != noErr) return PyMac_Error(_err); 34 _res = Py_BuildValue("O&H", 35 MenuObj_New, outHelpMenu, 36 outFirstCustomItemIndex); 37 return _res; 38 38 } 39 39 40 40 static PyObject *Help_HMAreHelpTagsDisplayed(PyObject *_self, PyObject *_args) 41 41 { 42 43 44 45 46 47 48 49 42 PyObject *_res = NULL; 43 Boolean _rv; 44 if (!PyArg_ParseTuple(_args, "")) 45 return NULL; 46 _rv = HMAreHelpTagsDisplayed(); 47 _res = Py_BuildValue("b", 48 _rv); 49 return _res; 50 50 } 51 51 52 52 static PyObject *Help_HMSetHelpTagsDisplayed(PyObject *_self, PyObject *_args) 53 53 { 54 55 56 57 58 59 60 61 62 63 64 54 PyObject *_res = NULL; 55 OSStatus _err; 56 Boolean inDisplayTags; 57 if (!PyArg_ParseTuple(_args, "b", 58 &inDisplayTags)) 59 return NULL; 60 _err = HMSetHelpTagsDisplayed(inDisplayTags); 61 if (_err != noErr) return PyMac_Error(_err); 62 Py_INCREF(Py_None); 63 _res = Py_None; 64 return _res; 65 65 } 66 66 67 67 static PyObject *Help_HMSetTagDelay(PyObject *_self, PyObject *_args) 68 68 { 69 70 71 72 73 74 75 76 77 78 79 69 PyObject *_res = NULL; 70 OSStatus _err; 71 Duration inDelay; 72 if (!PyArg_ParseTuple(_args, "l", 73 &inDelay)) 74 return NULL; 75 _err = HMSetTagDelay(inDelay); 76 if (_err != noErr) return PyMac_Error(_err); 77 Py_INCREF(Py_None); 78 _res = Py_None; 79 return _res; 80 80 } 81 81 82 82 static PyObject *Help_HMGetTagDelay(PyObject *_self, PyObject *_args) 83 83 { 84 85 86 87 88 89 90 91 92 93 84 PyObject *_res = NULL; 85 OSStatus _err; 86 Duration outDelay; 87 if (!PyArg_ParseTuple(_args, "")) 88 return NULL; 89 _err = HMGetTagDelay(&outDelay); 90 if (_err != noErr) return PyMac_Error(_err); 91 _res = Py_BuildValue("l", 92 outDelay); 93 return _res; 94 94 } 95 95 96 96 static PyObject *Help_HMSetMenuHelpFromBalloonRsrc(PyObject *_self, PyObject *_args) 97 97 { 98 99 100 101 102 103 104 105 106 107 108 109 110 111 98 PyObject *_res = NULL; 99 OSStatus _err; 100 MenuRef inMenu; 101 SInt16 inHmnuRsrcID; 102 if (!PyArg_ParseTuple(_args, "O&h", 103 MenuObj_Convert, &inMenu, 104 &inHmnuRsrcID)) 105 return NULL; 106 _err = HMSetMenuHelpFromBalloonRsrc(inMenu, 107 inHmnuRsrcID); 108 if (_err != noErr) return PyMac_Error(_err); 109 Py_INCREF(Py_None); 110 _res = Py_None; 111 return _res; 112 112 } 113 113 114 114 static PyObject *Help_HMSetDialogHelpFromBalloonRsrc(PyObject *_self, PyObject *_args) 115 115 { 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 116 PyObject *_res = NULL; 117 OSStatus _err; 118 DialogPtr inDialog; 119 SInt16 inHdlgRsrcID; 120 SInt16 inItemStart; 121 if (!PyArg_ParseTuple(_args, "O&hh", 122 DlgObj_Convert, &inDialog, 123 &inHdlgRsrcID, 124 &inItemStart)) 125 return NULL; 126 _err = HMSetDialogHelpFromBalloonRsrc(inDialog, 127 inHdlgRsrcID, 128 inItemStart); 129 if (_err != noErr) return PyMac_Error(_err); 130 Py_INCREF(Py_None); 131 _res = Py_None; 132 return _res; 133 133 } 134 134 135 135 static PyObject *Help_HMHideTag(PyObject *_self, PyObject *_args) 136 136 { 137 138 139 140 141 142 143 144 145 137 PyObject *_res = NULL; 138 OSStatus _err; 139 if (!PyArg_ParseTuple(_args, "")) 140 return NULL; 141 _err = HMHideTag(); 142 if (_err != noErr) return PyMac_Error(_err); 143 Py_INCREF(Py_None); 144 _res = Py_None; 145 return _res; 146 146 } 147 147 … … 150 150 static PyMethodDef Help_methods[] = { 151 151 #ifndef __LP64__ 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 152 {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1, 153 PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")}, 154 {"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1, 155 PyDoc_STR("() -> (Boolean _rv)")}, 156 {"HMSetHelpTagsDisplayed", (PyCFunction)Help_HMSetHelpTagsDisplayed, 1, 157 PyDoc_STR("(Boolean inDisplayTags) -> None")}, 158 {"HMSetTagDelay", (PyCFunction)Help_HMSetTagDelay, 1, 159 PyDoc_STR("(Duration inDelay) -> None")}, 160 {"HMGetTagDelay", (PyCFunction)Help_HMGetTagDelay, 1, 161 PyDoc_STR("() -> (Duration outDelay)")}, 162 {"HMSetMenuHelpFromBalloonRsrc", (PyCFunction)Help_HMSetMenuHelpFromBalloonRsrc, 1, 163 PyDoc_STR("(MenuRef inMenu, SInt16 inHmnuRsrcID) -> None")}, 164 {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction)Help_HMSetDialogHelpFromBalloonRsrc, 1, 165 PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")}, 166 {"HMHideTag", (PyCFunction)Help_HMHideTag, 1, 167 PyDoc_STR("() -> None")}, 168 168 #endif /* __LP64__ */ 169 169 {NULL, NULL, 0} 170 170 }; 171 171 … … 175 175 void init_Help(void) 176 176 { 177 177 PyObject *m; 178 178 #ifndef __LP64__ 179 179 PyObject *d; 180 180 #endif /* __LP64__ */ 181 181 … … 183 183 184 184 185 185 m = Py_InitModule("_Help", Help_methods); 186 186 #ifndef __LP64__ 187 188 189 190 191 187 d = PyModule_GetDict(m); 188 Help_Error = PyMac_GetOSErrException(); 189 if (Help_Error == NULL || 190 PyDict_SetItemString(d, "Error", Help_Error) != 0) 191 return; 192 192 #endif /* __LP64__ */ 193 193 }
Note:
See TracChangeset
for help on using the changeset viewer.