Commit da210690 authored by Simon Feltman's avatar Simon Feltman
Browse files

Move gobject static functions and constants to gi

Replace the following functions with gi and overrides:
type_children, type_interfaces, signal_list_ids, signal_list_names,
signal_lookup, signal_name, type_parent. Assign SIGNAL_* and
PARAM_* from gi SignalFlags and ParamFlags respectively.
Move module level assignments of a number of static functions to
the GObject.py overrides file.

https://bugzilla.gnome.org/show_bug.cgi?id=687487
parent f4acd6a9
......@@ -31,14 +31,6 @@ linkend="function-gobject--type-is-a">gobject.type_is_a</link></methodname>
<methodparam><parameter>parent_type</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--type-children">gobject.type_children</link></methodname>
<methodparam><parameter>type</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--type-interfaces">gobject.type_interfaces</link></methodname>
<methodparam><parameter>type</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--type-register">gobject.type_register</link></methodname>
<methodparam><parameter>class</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
......@@ -51,23 +43,6 @@ linkend="function-gobject--signal-new">gobject.signal_new</link></methodname>
<methodparam><parameter>param_types</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--signal-list-names">gobject.signal_list_names</link></methodname>
<methodparam><parameter role="keyword">type</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--signal-list-ids">gobject.signal_list_ids</link></methodname>
<methodparam><parameter role="keyword">type</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--signal-lookup">gobject.signal_lookup</link></methodname>
<methodparam><parameter role="keyword">name</parameter></methodparam>
<methodparam><parameter role="keyword">type</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--signal-name">gobject.signal_name</link></methodname>
<methodparam><parameter role="keyword">signal_id</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gobject--signal-query1">gobject.signal_query</link></methodname>
<methodparam><parameter role="keyword">name</parameter></methodparam>
<methodparam><parameter role="keyword">type</parameter></methodparam>
......
......@@ -27,78 +27,18 @@ import sys
if 'gobject' in sys.modules:
raise ImportError('When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".')
from .. import _glib
from . import _gobject
from . import constants
from . import propertyhelper
from . import signalhelper
GBoxed = _gobject.GBoxed
GEnum = _gobject.GEnum
GFlags = _gobject.GFlags
GInterface = _gobject.GInterface
GObject = _gobject.GObject
GObjectWeakRef = _gobject.GObjectWeakRef
GParamSpec = _gobject.GParamSpec
GPointer = _gobject.GPointer
GType = _gobject.GType
PARAM_CONSTRUCT = _gobject.PARAM_CONSTRUCT
PARAM_CONSTRUCT_ONLY = _gobject.PARAM_CONSTRUCT_ONLY
PARAM_LAX_VALIDATION = _gobject.PARAM_LAX_VALIDATION
PARAM_READABLE = _gobject.PARAM_READABLE
PARAM_READWRITE = _gobject.PARAM_READWRITE
PARAM_WRITABLE = _gobject.PARAM_WRITABLE
SIGNAL_ACTION = _gobject.SIGNAL_ACTION
SIGNAL_DETAILED = _gobject.SIGNAL_DETAILED
SIGNAL_NO_HOOKS = _gobject.SIGNAL_NO_HOOKS
SIGNAL_NO_RECURSE = _gobject.SIGNAL_NO_RECURSE
SIGNAL_RUN_CLEANUP = _gobject.SIGNAL_RUN_CLEANUP
SIGNAL_RUN_FIRST = _gobject.SIGNAL_RUN_FIRST
SIGNAL_RUN_LAST = _gobject.SIGNAL_RUN_LAST
TYPE_GSTRING = _gobject.TYPE_GSTRING
TYPE_INVALID = _gobject.TYPE_INVALID
Warning = _gobject.Warning
_PyGObject_API = _gobject._PyGObject_API
add_emission_hook = _gobject.add_emission_hook
features = _gobject.features
list_properties = _gobject.list_properties
new = _gobject.new
pygobject_version = _gobject.pygobject_version
remove_emission_hook = _gobject.remove_emission_hook
signal_accumulator_true_handled = _gobject.signal_accumulator_true_handled
signal_list_ids = _gobject.signal_list_ids
signal_list_names = _gobject.signal_list_names
signal_lookup = _gobject.signal_lookup
signal_name = _gobject.signal_name
signal_new = _gobject.signal_new
signal_query = _gobject.signal_query
threads_init = _gobject.threads_init
type_children = _gobject.type_children
type_from_name = _gobject.type_from_name
type_interfaces = _gobject.type_interfaces
type_is_a = _gobject.type_is_a
type_name = _gobject.type_name
type_parent = _gobject.type_parent
type_register = _gobject.type_register
spawn_async = _glib.spawn_async
Pid = _glib.Pid
GError = _glib.GError
OptionGroup = _glib.OptionGroup
OptionContext = _glib.OptionContext
OPTION_FLAG_HIDDEN = _glib.OPTION_FLAG_HIDDEN
OPTION_FLAG_IN_MAIN = _glib.OPTION_FLAG_IN_MAIN
OPTION_FLAG_REVERSE = _glib.OPTION_FLAG_REVERSE
OPTION_FLAG_NO_ARG = _glib.OPTION_FLAG_NO_ARG
OPTION_FLAG_FILENAME = _glib.OPTION_FLAG_FILENAME
OPTION_FLAG_OPTIONAL_ARG = _glib.OPTION_FLAG_OPTIONAL_ARG
OPTION_FLAG_NOALIAS = _glib.OPTION_FLAG_NOALIAS
OPTION_ERROR_UNKNOWN_OPTION = _glib.OPTION_ERROR_UNKNOWN_OPTION
OPTION_ERROR_BAD_VALUE = _glib.OPTION_ERROR_BAD_VALUE
OPTION_ERROR_FAILED = _glib.OPTION_ERROR_FAILED
OPTION_REMAINING = _glib.OPTION_REMAINING
OPTION_ERROR = _glib.OPTION_ERROR
TYPE_NONE = constants.TYPE_NONE
TYPE_INTERFACE = constants.TYPE_INTERFACE
......@@ -143,13 +83,6 @@ G_MAXSSIZE = constants.G_MAXSSIZE
G_MINOFFSET = constants.G_MINOFFSET
G_MAXOFFSET = constants.G_MAXOFFSET
Property = propertyhelper.Property
Signal = signalhelper.Signal
SignalOverride = signalhelper.SignalOverride
from .._glib import option
sys.modules['gi._gobject.option'] = option
class GObjectMeta(type):
"Metaclass for automatically registering GObject classes"
......@@ -169,9 +102,6 @@ class GObjectMeta(type):
if cls.__module__.startswith('gi.overrides.'):
return
type_register(cls, namespace.get('__gtype_name__'))
_gobject.type_register(cls, namespace.get('__gtype_name__'))
_gobject._install_metaclass(GObjectMeta)
# Deprecated naming still available for backwards compatibility.
property = Property
......@@ -140,28 +140,6 @@ pyg_type_from_name (PyObject *self, PyObject *args)
return NULL;
}
static PyObject *
pyg_type_parent (PyObject *self, PyObject *args)
{
PyObject *gtype;
GType type, parent;
#if 0
if (PyErr_Warn(PyExc_DeprecationWarning,
"gobject.type_parent is deprecated; "
"use GType.parent instead"))
return NULL;
#endif
if (!PyArg_ParseTuple(args, "O:gobject.type_parent", &gtype))
return NULL;
if ((type = pyg_type_from_object(gtype)) == 0)
return NULL;
parent = g_type_parent(type);
if (parent != 0)
return pyg_type_wrapper_new(parent);
PyErr_SetString(PyExc_RuntimeError, "no parent for type");
return NULL;
}
static PyObject *
pyg_type_is_a (PyObject *self, PyObject *args)
{
......@@ -182,68 +160,6 @@ pyg_type_is_a (PyObject *self, PyObject *args)
return PyBool_FromLong(g_type_is_a(type, parent));
}
static PyObject *
pyg_type_children (PyObject *self, PyObject *args)
{
PyObject *gtype, *list;
GType type, *children;
guint n_children, i;
#if 0
if (PyErr_Warn(PyExc_DeprecationWarning,
"gobject.type_children is deprecated; "
"use GType.children instead"))
return NULL;
#endif
if (!PyArg_ParseTuple(args, "O:gobject.type_children", &gtype))
return NULL;
if ((type = pyg_type_from_object(gtype)) == 0)
return NULL;
children = g_type_children(type, &n_children);
if (children) {
list = PyList_New(0);
for (i = 0; i < n_children; i++) {
PyObject *o;
PyList_Append(list, o=pyg_type_wrapper_new(children[i]));
Py_DECREF(o);
}
g_free(children);
return list;
}
PyErr_SetString(PyExc_RuntimeError, "invalid type, or no children");
return NULL;
}
static PyObject *
pyg_type_interfaces (PyObject *self, PyObject *args)
{
PyObject *gtype, *list;
GType type, *interfaces;
guint n_interfaces, i;
#if 0
if (PyErr_Warn(PyExc_DeprecationWarning,
"gobject.type_interfaces is deprecated; "
"use GType.interfaces instead"))
return NULL;
#endif
if (!PyArg_ParseTuple(args, "O:gobject.type_interfaces", &gtype))
return NULL;
if ((type = pyg_type_from_object(gtype)) == 0)
return NULL;
interfaces = g_type_interfaces(type, &n_interfaces);
if (interfaces) {
list = PyList_New(0);
for (i = 0; i < n_interfaces; i++) {
PyObject *o;
PyList_Append(list, o=pyg_type_wrapper_new(interfaces[i]));
Py_DECREF(o);
}
g_free(interfaces);
return list;
}
PyErr_SetString(PyExc_RuntimeError, "invalid type, or no interfaces");
return NULL;
}
static void
pyg_object_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
......@@ -1397,171 +1313,6 @@ pyg_signal_new(PyObject *self, PyObject *args)
return NULL;
}
static PyObject *
pyg_signal_list_names (PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "type", NULL };
PyObject *py_itype, *list;
GObjectClass *class = NULL;
GType itype;
guint n;
guint *ids;
guint i;
gpointer iface = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:gobject.signal_list_names",
kwlist, &py_itype))
return NULL;
if ((itype = pyg_type_from_object(py_itype)) == 0)
return NULL;
if (G_TYPE_IS_INSTANTIATABLE(itype)) {
class = g_type_class_ref(itype);
if (!class) {
PyErr_SetString(PyExc_RuntimeError,
"could not get a reference to type class");
return NULL;
}
} else if (!G_TYPE_IS_INTERFACE(itype)) {
PyErr_SetString(PyExc_TypeError,
"type must be instantiable or an interface");
return NULL;
} else {
iface = g_type_default_interface_ref(itype);
}
ids = g_signal_list_ids(itype, &n);
list = PyTuple_New((gint)n);
if (list != NULL) {
for (i = 0; i < n; i++)
PyTuple_SetItem(list, i,
PYGLIB_PyUnicode_FromString(g_signal_name(ids[i])));
}
g_free(ids);
if (class)
g_type_class_unref(class);
else
g_type_default_interface_unref(iface);
return list;
}
static PyObject *
pyg_signal_list_ids (PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "type", NULL };
PyObject *py_itype, *list;
GObjectClass *class = NULL;
GType itype;
guint n;
guint *ids;
guint i;
gpointer iface = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:gobject.signal_list_ids",
kwlist, &py_itype))
return NULL;
if ((itype = pyg_type_from_object(py_itype)) == 0)
return NULL;
if (G_TYPE_IS_INSTANTIATABLE(itype)) {
class = g_type_class_ref(itype);
if (!class) {
PyErr_SetString(PyExc_RuntimeError,
"could not get a reference to type class");
return NULL;
}
} else if (!G_TYPE_IS_INTERFACE(itype)) {
PyErr_SetString(PyExc_TypeError,
"type must be instantiable or an interface");
return NULL;
} else {
iface = g_type_default_interface_ref(itype);
}
ids = g_signal_list_ids(itype, &n);
list = PyTuple_New((gint)n);
if (list == NULL) {
g_free(ids);
g_type_class_unref(class);
return NULL;
}
for (i = 0; i < n; i++)
PyTuple_SetItem(list, i, PYGLIB_PyLong_FromLong(ids[i]));
g_free(ids);
if (class)
g_type_class_unref(class);
else
g_type_default_interface_unref(iface);
return list;
}
static PyObject *
pyg_signal_lookup (PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "name", "type", NULL };
PyObject *py_itype;
GObjectClass *class = NULL;
GType itype;
gchar *signal_name;
guint id;
gpointer iface = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:gobject.signal_lookup",
kwlist, &signal_name, &py_itype))
return NULL;
if ((itype = pyg_type_from_object(py_itype)) == 0)
return NULL;
if (G_TYPE_IS_INSTANTIATABLE(itype)) {
class = g_type_class_ref(itype);
if (!class) {
PyErr_SetString(PyExc_RuntimeError,
"could not get a reference to type class");
return NULL;
}
} else if (!G_TYPE_IS_INTERFACE(itype)) {
PyErr_SetString(PyExc_TypeError,
"type must be instantiable or an interface");
return NULL;
} else {
iface = g_type_default_interface_ref(itype);
}
id = g_signal_lookup(signal_name, itype);
if (class)
g_type_class_unref(class);
else
g_type_default_interface_unref(iface);
return PYGLIB_PyLong_FromLong(id);
}
static PyObject *
pyg_signal_name (PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "signal_id", NULL };
const gchar *signal_name;
guint id;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:gobject.signal_name",
kwlist, &id))
return NULL;
signal_name = g_signal_name(id);
if (signal_name)
return PYGLIB_PyUnicode_FromString(signal_name);
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
pyg_signal_query (PyObject *self, PyObject *args, PyObject *kwargs)
{
......@@ -1987,20 +1738,9 @@ pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass)
static PyMethodDef _gobject_functions[] = {
{ "type_name", pyg_type_name, METH_VARARGS },
{ "type_from_name", pyg_type_from_name, METH_VARARGS },
{ "type_parent", pyg_type_parent, METH_VARARGS },
{ "type_is_a", pyg_type_is_a, METH_VARARGS },
{ "type_children", pyg_type_children, METH_VARARGS },
{ "type_interfaces", pyg_type_interfaces, METH_VARARGS },
{ "type_register", _wrap_pyg_type_register, METH_VARARGS },
{ "signal_new", pyg_signal_new, METH_VARARGS },
{ "signal_list_names",
(PyCFunction)pyg_signal_list_names, METH_VARARGS|METH_KEYWORDS },
{ "signal_list_ids",
(PyCFunction)pyg_signal_list_ids, METH_VARARGS|METH_KEYWORDS },
{ "signal_lookup",
(PyCFunction)pyg_signal_lookup, METH_VARARGS|METH_KEYWORDS },
{ "signal_name",
(PyCFunction)pyg_signal_name, METH_VARARGS|METH_KEYWORDS },
{ "signal_query",
(PyCFunction)pyg_signal_query, METH_VARARGS|METH_KEYWORDS },
{ "list_properties",
......@@ -2441,18 +2181,6 @@ pygobject_register_constants(PyObject *m)
PyModule_AddObject(m, "G_MAXOFFSET", PyLong_FromLongLong(G_MAXOFFSET));
PyModule_AddIntConstant(m, "SIGNAL_RUN_FIRST", G_SIGNAL_RUN_FIRST);
PyModule_AddIntConstant(m, "SIGNAL_RUN_LAST", G_SIGNAL_RUN_LAST);
PyModule_AddIntConstant(m, "SIGNAL_RUN_CLEANUP", G_SIGNAL_RUN_CLEANUP);
PyModule_AddIntConstant(m, "SIGNAL_NO_RECURSE", G_SIGNAL_NO_RECURSE);
PyModule_AddIntConstant(m, "SIGNAL_DETAILED", G_SIGNAL_DETAILED);
PyModule_AddIntConstant(m, "SIGNAL_ACTION", G_SIGNAL_ACTION);
PyModule_AddIntConstant(m, "SIGNAL_NO_HOOKS", G_SIGNAL_NO_HOOKS);
PyModule_AddIntConstant(m, "PARAM_READABLE", G_PARAM_READABLE);
PyModule_AddIntConstant(m, "PARAM_WRITABLE", G_PARAM_WRITABLE);
PyModule_AddIntConstant(m, "PARAM_CONSTRUCT", G_PARAM_CONSTRUCT);
PyModule_AddIntConstant(m, "PARAM_CONSTRUCT_ONLY", G_PARAM_CONSTRUCT_ONLY);
PyModule_AddIntConstant(m, "PARAM_LAX_VALIDATION", G_PARAM_LAX_VALIDATION);
PyModule_AddIntConstant(m, "PARAM_READWRITE", G_PARAM_READWRITE);
/* The rest of the types are set in __init__.py */
......
......@@ -19,11 +19,25 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
import sys
from collections import namedtuple
import gi.overrides
import gi.module
from gi.repository import GLib
from gi._gobject import _gobject
from gi._gobject import propertyhelper
from gi._gobject import signalhelper
GObjectModule = gi.module.get_introspection_module('GObject')
__all__ = []
from gi._glib import option
sys.modules['gi._gobject.option'] = option
# API aliases for backwards compatibility
for name in ['markup_escape_text', 'get_application_name',
'set_application_name', 'get_prgname', 'set_prgname',
......@@ -33,7 +47,8 @@ for name in ['markup_escape_text', 'get_application_name',
'MainLoop', 'MainContext', 'main_context_default',
'source_remove', 'Source', 'Idle', 'Timeout', 'PollFD',
'idle_add', 'timeout_add', 'timeout_add_seconds',
'io_add_watch', 'child_watch_add', 'get_current_time']:
'io_add_watch', 'child_watch_add', 'get_current_time',
'spawn_async']:
globals()[name] = gi.overrides.deprecated(getattr(GLib, name), 'GLib.' + name)
__all__.append(name)
......@@ -50,7 +65,11 @@ for name in ['PRIORITY_DEFAULT', 'PRIORITY_DEFAULT_IDLE', 'PRIORITY_HIGH',
'SPAWN_SEARCH_PATH', 'SPAWN_STDOUT_TO_DEV_NULL',
'SPAWN_STDERR_TO_DEV_NULL', 'SPAWN_CHILD_INHERITS_STDIN',
'SPAWN_FILE_AND_ARGV_ZERO',
'glib_version']:
'OPTION_FLAG_HIDDEN', 'OPTION_FLAG_IN_MAIN', 'OPTION_FLAG_REVERSE',
'OPTION_FLAG_NO_ARG', 'OPTION_FLAG_FILENAME', 'OPTION_FLAG_OPTIONAL_ARG',
'OPTION_FLAG_NOALIAS', 'OPTION_ERROR_UNKNOWN_OPTION',
'OPTION_ERROR_BAD_VALUE', 'OPTION_ERROR_FAILED', 'OPTION_REMAINING',
'OPTION_ERROR', 'glib_version']:
globals()[name] = getattr(GLib, name)
__all__.append(name)
......@@ -70,3 +89,188 @@ G_MAXUINT64 = GLib.MAXUINT64
__all__ += ['G_MININT8', 'G_MAXINT8', 'G_MAXUINT8', 'G_MININT16',
'G_MAXINT16', 'G_MAXUINT16', 'G_MININT32', 'G_MAXINT32',
'G_MAXUINT32', 'G_MININT64', 'G_MAXINT64', 'G_MAXUINT64']
TYPE_INVALID = GObjectModule.type_from_name('invalid')
TYPE_NONE = GObjectModule.type_from_name('void')
TYPE_INTERFACE = GObjectModule.type_from_name('GInterface')
TYPE_CHAR = GObjectModule.type_from_name('gchar')
TYPE_UCHAR = GObjectModule.type_from_name('guchar')
TYPE_BOOLEAN = GObjectModule.type_from_name('gboolean')
TYPE_INT = GObjectModule.type_from_name('gint')
TYPE_UINT = GObjectModule.type_from_name('guint')
TYPE_LONG = GObjectModule.type_from_name('glong')
TYPE_ULONG = GObjectModule.type_from_name('gulong')
TYPE_INT64 = GObjectModule.type_from_name('gint64')
TYPE_UINT64 = GObjectModule.type_from_name('guint64')
TYPE_ENUM = GObjectModule.type_from_name('GEnum')
TYPE_FLAGS = GObjectModule.type_from_name('GFlags')
TYPE_FLOAT = GObjectModule.type_from_name('gfloat')
TYPE_DOUBLE = GObjectModule.type_from_name('gdouble')
TYPE_STRING = GObjectModule.type_from_name('gchararray')
TYPE_POINTER = GObjectModule.type_from_name('gpointer')
TYPE_BOXED = GObjectModule.type_from_name('GBoxed')
TYPE_PARAM = GObjectModule.type_from_name('GParam')
TYPE_OBJECT = GObjectModule.type_from_name('GObject')
TYPE_PYOBJECT = GObjectModule.type_from_name('PyObject')
TYPE_GTYPE = GObjectModule.type_from_name('GType')
TYPE_STRV = GObjectModule.type_from_name('GStrv')
TYPE_VARIANT = GObjectModule.type_from_name('GVariant')
TYPE_GSTRING = GObjectModule.type_from_name('GString')
TYPE_UNICHAR = TYPE_UINT
__all__ += ['TYPE_INVALID', 'TYPE_NONE', 'TYPE_INTERFACE', 'TYPE_CHAR',
'TYPE_UCHAR', 'TYPE_BOOLEAN', 'TYPE_INT', 'TYPE_UINT', 'TYPE_LONG',
'TYPE_ULONG', 'TYPE_INT64', 'TYPE_UINT64', 'TYPE_ENUM', 'TYPE_FLAGS',
'TYPE_FLOAT', 'TYPE_DOUBLE', 'TYPE_STRING', 'TYPE_POINTER',
'TYPE_BOXED', 'TYPE_PARAM', 'TYPE_OBJECT', 'TYPE_PYOBJECT',
'TYPE_GTYPE', 'TYPE_STRV', 'TYPE_VARIANT', 'TYPE_GSTRING', 'TYPE_UNICHAR']
# Deprecated, use GLib directly
Pid = GLib.Pid
GError = GLib.GError
OptionGroup = GLib.OptionGroup
OptionContext = GLib.OptionContext
__all__ += ['Pid', 'GError', 'OptionGroup', 'OptionContext']
# Deprecated, use: GObject.ParamFlags.* directly
PARAM_CONSTRUCT = GObjectModule.ParamFlags.CONSTRUCT
PARAM_CONSTRUCT_ONLY = GObjectModule.ParamFlags.CONSTRUCT_ONLY
PARAM_LAX_VALIDATION = GObjectModule.ParamFlags.LAX_VALIDATION
PARAM_READABLE = GObjectModule.ParamFlags.READABLE
PARAM_WRITABLE = GObjectModule.ParamFlags.WRITABLE
# PARAM_READWRITE should come from the gi module but cannot due to:
# https://bugzilla.gnome.org/show_bug.cgi?id=687615
PARAM_READWRITE = PARAM_READABLE | PARAM_WRITABLE
__all__ += ['PARAM_CONSTRUCT', 'PARAM_CONSTRUCT_ONLY', 'PARAM_LAX_VALIDATION',
'PARAM_READABLE', 'PARAM_WRITABLE', 'PARAM_READWRITE']
# Deprecated, use: GObject.SignalFlags.* directly
SIGNAL_ACTION = GObjectModule.SignalFlags.ACTION
SIGNAL_DETAILED = GObjectModule.SignalFlags.DETAILED
SIGNAL_NO_HOOKS = GObjectModule.SignalFlags.NO_HOOKS
SIGNAL_NO_RECURSE = GObjectModule.SignalFlags.NO_RECURSE
SIGNAL_RUN_CLEANUP = GObjectModule.SignalFlags.RUN_CLEANUP
SIGNAL_RUN_FIRST = GObjectModule.SignalFlags.RUN_FIRST
SIGNAL_RUN_LAST = GObjectModule.SignalFlags.RUN_LAST
__all__ += ['SIGNAL_ACTION', 'SIGNAL_DETAILED', 'SIGNAL_NO_HOOKS',
'SIGNAL_NO_RECURSE', 'SIGNAL_RUN_CLEANUP', 'SIGNAL_RUN_FIRST',
'SIGNAL_RUN_LAST']
# Static types
GBoxed = _gobject.GBoxed
GEnum = _gobject.GEnum
GFlags = _gobject.GFlags
GInterface = _gobject.GInterface
GObject = _gobject.GObject
GObjectWeakRef = _gobject.GObjectWeakRef
GParamSpec = _gobject.GParamSpec
GPointer = _gobject.GPointer
GType = _gobject.GType
Warning = _gobject.Warning
__all__ += ['GBoxed', 'GEnum', 'GFlags', 'GInterface', 'GObject',
'GObjectWeakRef', 'GParamSpec', 'GPointer', 'GType',
'Warning']
add_emission_hook = _gobject.add_emission_hook
features = _gobject.features
list_properties = _gobject.list_properties
new = _gobject.new
pygobject_version = _gobject.pygobject_version
remove_emission_hook = _gobject.remove_emission_hook
signal_accumulator_true_handled = _gobject.signal_accumulator_true_handled
signal_new = _gobject.signal_new
threads_init = _gobject.threads_init
type_register = _gobject.type_register
__all__ += ['add_emission_hook', 'features', 'list_properties',
'new', 'pygobject_version', 'remove_emission_hook',
'signal_accumulator_true_handled',
'signal_new', 'threads_init', 'type_register']
def type_from_name(name):
type_ = GObjectModule.type_from_name(name)
if type_ == TYPE_INVALID:
raise RuntimeError('unknown type name: %s' % name)
return type_