2009-02-16 16:17:20 +00:00
|
|
|
/**
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Campbell Barton
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "bpy_ui.h"
|
2009-02-28 13:27:45 +00:00
|
|
|
#include "bpy_util.h"
|
2009-02-27 10:22:40 +00:00
|
|
|
#include "bpy_rna.h" /* for rna buttons */
|
2009-02-28 13:27:45 +00:00
|
|
|
#include "bpy_operator.h" /* for setting button operator properties */
|
2009-02-16 16:17:20 +00:00
|
|
|
#include "bpy_compat.h"
|
2009-04-01 12:43:07 +00:00
|
|
|
|
2009-02-28 13:27:45 +00:00
|
|
|
#include "WM_types.h" /* for WM_OP_INVOKE_DEFAULT & friends */
|
2009-02-16 16:17:20 +00:00
|
|
|
|
|
|
|
|
#include "BLI_dynstr.h"
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
#include "BKE_global.h" /* evil G.* */
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
2009-02-28 13:27:45 +00:00
|
|
|
#include "DNA_space_types.h" /* only for SpaceLink */
|
2009-02-16 16:17:20 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
|
2009-07-22 10:09:59 +00:00
|
|
|
/* Dummy Module, may want to include non RNA UI functions here, else it can be removed */
|
2009-02-16 16:17:20 +00:00
|
|
|
|
|
|
|
|
static struct PyMethodDef ui_methods[] = {
|
|
|
|
|
{NULL, NULL, 0, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
2009-02-28 15:28:18 +00:00
|
|
|
#if PY_VERSION_HEX >= 0x03000000
|
2009-02-26 05:50:19 +00:00
|
|
|
static struct PyModuleDef ui_module = {
|
|
|
|
|
PyModuleDef_HEAD_INIT,
|
2009-06-20 13:53:14 +00:00
|
|
|
"bpy.ui",
|
2009-02-26 05:50:19 +00:00
|
|
|
"",
|
|
|
|
|
-1,/* multiple "initialization" just copies the module dict. */
|
|
|
|
|
ui_methods,
|
|
|
|
|
NULL, NULL, NULL, NULL
|
|
|
|
|
};
|
2009-02-28 15:28:18 +00:00
|
|
|
#endif
|
2009-02-26 05:50:19 +00:00
|
|
|
|
|
|
|
|
PyObject *BPY_ui_module( void )
|
|
|
|
|
{
|
2009-03-07 09:46:33 +00:00
|
|
|
PyObject *submodule, *mod;
|
2009-02-27 10:22:40 +00:00
|
|
|
#if PY_VERSION_HEX >= 0x03000000
|
|
|
|
|
submodule= PyModule_Create(&ui_module);
|
2009-02-26 05:50:19 +00:00
|
|
|
#else /* Py2.x */
|
2009-05-27 15:41:44 +00:00
|
|
|
submodule= Py_InitModule3( "bpy.ui", ui_methods, "" );
|
2009-02-26 05:50:19 +00:00
|
|
|
#endif
|
2009-02-27 10:22:40 +00:00
|
|
|
|
2009-05-27 15:41:44 +00:00
|
|
|
/* INCREF since its its assumed that all these functions return the
|
|
|
|
|
* module with a new ref like PyDict_New, since they are passed to
|
|
|
|
|
* PyModule_AddObject which steals a ref */
|
|
|
|
|
Py_INCREF(submodule);
|
2009-02-28 13:27:45 +00:00
|
|
|
|
2009-02-27 10:22:40 +00:00
|
|
|
return submodule;
|
|
|
|
|
}
|