Krita Source Code Documentation
Loading...
Searching...
No Matches
PykritaModule.cpp
Go to the documentation of this file.
1// This file is part of PyKrita, Krita' Python scripting plugin.
2//
3// SPDX-FileCopyrightText: 2006 Paul Giannaros <paul@giannaros.org>
4// SPDX-FileCopyrightText: 2012, 2013 Shaheed Haque <srhaque@theiet.org>
5// SPDX-FileCopyrightText: 2013 Alex Turbov <i.zaufi@gmail.com>
6// SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
7//
8// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
9//
10
11#include "PykritaModule.h"
12
13#include "kis_debug.h"
14
16 PyObject *error;
17};
18
19#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
20
23namespace PYKRITA
24{
25 PyObject* debug(PyObject* /*self*/, PyObject* args)
26 {
27 const char* text;
28
29 if (PyArg_ParseTuple(args, "s", &text))
30 dbgScript << text;
31 Py_INCREF(Py_None);
32 return Py_None;
33 }
34} // namespace PYKRITA
35
36namespace
37{
38 PyMethodDef pykritaMethods[] = {
39 {
40 "qDebug"
42 , METH_VARARGS
43 , "True KDE way to show debug info"
44 }
45 , { 0, 0, 0, 0 }
46 };
47} // anonymous namespace
48
49//BEGIN Python module registration
50static struct PyModuleDef moduledef = {
51 PyModuleDef_HEAD_INIT
52 , "pykrita"
53 , "The pykrita module"
54 , -1
55 , pykritaMethods
56 , 0
57 , 0
58 , 0
59 , 0
60};
61
62#define INITERROR return NULL
63
64PyMODINIT_FUNC PYKRITA_INIT()
65{
66 PyObject *pykritaModule = PyModule_Create(&moduledef);
67
68 if (pykritaModule == NULL)
70
71 PyModule_AddStringConstant(pykritaModule, "__file__", __FILE__);
72
73 return pykritaModule;
74}
75
76//END Python module registration
77
78// krita: space-indent on; indent-width 4;
79#undef PYKRITA_INIT
static struct PyModuleDef moduledef
#define INITERROR
PyMODINIT_FUNC PYKRITA_INIT()
#define dbgScript
Definition kis_debug.h:56
PyObject * debug(PyObject *, PyObject *args)
PyObject * error