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
15
struct
module_state
{
16
PyObject *
error
;
17
};
18
19
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
20
23
namespace
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
36
namespace
37
{
38
PyMethodDef pykritaMethods[] = {
39
{
40
"qDebug"
41
, &
PYKRITA::debug
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
50
static
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
64
PyMODINIT_FUNC
PYKRITA_INIT
()
65
{
66
PyObject *pykritaModule = PyModule_Create(&
moduledef
);
67
68
if
(pykritaModule == NULL)
69
INITERROR
;
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
moduledef
static struct PyModuleDef moduledef
Definition
PykritaModule.cpp:50
INITERROR
#define INITERROR
Definition
PykritaModule.cpp:62
PYKRITA_INIT
PyMODINIT_FUNC PYKRITA_INIT()
Definition
PykritaModule.cpp:64
PykritaModule.h
kis_debug.h
dbgScript
#define dbgScript
Definition
kis_debug.h:56
PYKRITA
Definition
PykritaModule.cpp:24
PYKRITA::debug
PyObject * debug(PyObject *, PyObject *args)
Definition
PykritaModule.cpp:25
module_state
Definition
PykritaModule.cpp:15
module_state::error
PyObject * error
Definition
PykritaModule.cpp:16
plugins
extensions
pykrita
plugin
PykritaModule.cpp
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52