void pytag_add_constants(PyObject *module, const gchar *strip_prefix) { pyg_enum_add(module, "TagDemuxResult", strip_prefix, GST_TYPE_TAG_DEMUX_RESULT); pyg_enum_add(module, "TagImageType", strip_prefix, GST_TYPE_TAG_IMAGE_TYPE); if (PyErr_Occurred()) PyErr_Print(); }
void gimpthumb_add_constants(PyObject *module, const gchar *strip_prefix) { #ifdef VERSION PyModule_AddStringConstant(module, "__version__", VERSION); #endif pyg_enum_add(module, "ThumbFileType", strip_prefix, GIMP_TYPE_THUMB_FILE_TYPE); pyg_enum_add(module, "ThumbSize", strip_prefix, GIMP_TYPE_THUMB_SIZE); pyg_enum_add(module, "ThumbState", strip_prefix, GIMP_TYPE_THUMB_STATE); if (PyErr_Occurred()) PyErr_Print(); }
PyObject* pyg_enum_from_gtype (GType gtype, int value) { PyObject *pyclass, *values, *retval, *intvalue; g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL); /* Get a wrapper class by: * 1. check for one attached to the gtype * 2. lookup one in a typelib * 3. creating a new one */ pyclass = (PyObject*)g_type_get_qdata(gtype, pygenum_class_key); // if (!pyclass) // pyclass = pygi_type_import_by_g_type(gtype); if (!pyclass) pyclass = pyg_enum_add(NULL, g_type_name(gtype), NULL, gtype); if (!pyclass) return PYGLIB_PyLong_FromLong(value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__enum_values__"); intvalue = PYGLIB_PyLong_FromLong(value); retval = PyDict_GetItem(values, intvalue); if (retval) { Py_INCREF(retval); } else { PyErr_Clear(); retval = pyg_enum_val_new(pyclass, gtype, intvalue); } Py_DECREF(intvalue); return retval; }
void pyvideo_add_constants(PyObject *module, const gchar *strip_prefix) { pyg_enum_add(module, "VideoFormat", strip_prefix, GST_TYPE_VIDEO_FORMAT); if (PyErr_Occurred()) PyErr_Print(); }
static PyObject * _wrap_pyg_enum_add (PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "g_type", NULL }; PyObject *py_g_type; GType g_type; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:enum_add", kwlist, &PyGTypeWrapper_Type, &py_g_type)) { return NULL; } g_type = pyg_type_from_object(py_g_type); if (g_type == G_TYPE_INVALID) { return NULL; } return pyg_enum_add(NULL, g_type_name(g_type), NULL, g_type); }
void gtk_scintilla_add_constants(PyObject *module, const gchar *strip_prefix) { #ifdef VERSION PyModule_AddStringConstant(module, "__version__", VERSION); #endif pyg_enum_add(module, "ScintillaUpdateFlag", strip_prefix, GTK_TYPE_SCINTILLA_UPDATE_FLAG); pyg_enum_add(module, "ScintillaSearchFlag", strip_prefix, GTK_TYPE_SCINTILLA_SEARCH_FLAG); pyg_enum_add(module, "ScintillaWhiteSpace", strip_prefix, GTK_TYPE_SCINTILLA_WHITE_SPACE); pyg_enum_add(module, "ScintillaEndOfLine", strip_prefix, GTK_TYPE_SCINTILLA_END_OF_LINE); pyg_enum_add(module, "ScintillaMarkerSymbol", strip_prefix, GTK_TYPE_SCINTILLA_MARKER_SYMBOL); pyg_enum_add(module, "ScintillaMarkerOutline", strip_prefix, GTK_TYPE_SCINTILLA_MARKER_OUTLINE); pyg_enum_add(module, "ScintillaMarginType", strip_prefix, GTK_TYPE_SCINTILLA_MARGIN_TYPE); pyg_enum_add(module, "ScintillaStylesCommon", strip_prefix, GTK_TYPE_SCINTILLA_STYLES_COMMON); pyg_enum_add(module, "ScintillaCharacterSet", strip_prefix, GTK_TYPE_SCINTILLA_CHARACTER_SET); pyg_enum_add(module, "ScintillaCase", strip_prefix, GTK_TYPE_SCINTILLA_CASE); pyg_enum_add(module, "ScintillaIndicatorStyle", strip_prefix, GTK_TYPE_SCINTILLA_INDICATOR_STYLE); pyg_enum_add(module, "ScintillaIndentView", strip_prefix, GTK_TYPE_SCINTILLA_INDENT_VIEW); pyg_enum_add(module, "ScintillaPrintOption", strip_prefix, GTK_TYPE_SCINTILLA_PRINT_OPTION); pyg_enum_add(module, "ScintillaFindOption", strip_prefix, GTK_TYPE_SCINTILLA_FIND_OPTION); pyg_enum_add(module, "ScintillaFoldLevel", strip_prefix, GTK_TYPE_SCINTILLA_FOLD_LEVEL); pyg_enum_add(module, "ScintillaFoldFlag", strip_prefix, GTK_TYPE_SCINTILLA_FOLD_FLAG); pyg_enum_add(module, "ScintillaWrap", strip_prefix, GTK_TYPE_SCINTILLA_WRAP); pyg_enum_add(module, "ScintillaWrapVisualFlag", strip_prefix, GTK_TYPE_SCINTILLA_WRAP_VISUAL_FLAG); pyg_enum_add(module, "ScintillaWrapVisualLocation", strip_prefix, GTK_TYPE_SCINTILLA_WRAP_VISUAL_LOCATION); pyg_enum_add(module, "ScintillaWrapIndentMode", strip_prefix, GTK_TYPE_SCINTILLA_WRAP_INDENT_MODE); pyg_enum_add(module, "ScintillaLineCache", strip_prefix, GTK_TYPE_SCINTILLA_LINE_CACHE); pyg_enum_add(module, "ScintillaFontQuality", strip_prefix, GTK_TYPE_SCINTILLA_FONT_QUALITY); pyg_enum_add(module, "ScintillaMultiPaste", strip_prefix, GTK_TYPE_SCINTILLA_MULTI_PASTE); pyg_enum_add(module, "ScintillaEdgeVisualStyle", strip_prefix, GTK_TYPE_SCINTILLA_EDGE_VISUAL_STYLE); pyg_enum_add(module, "ScintillaStatus", strip_prefix, GTK_TYPE_SCINTILLA_STATUS); pyg_enum_add(module, "ScintillaCursorShape", strip_prefix, GTK_TYPE_SCINTILLA_CURSOR_SHAPE); pyg_enum_add(module, "ScintillaCaretPolicy", strip_prefix, GTK_TYPE_SCINTILLA_CARET_POLICY); pyg_enum_add(module, "ScintillaSelectionMode", strip_prefix, GTK_TYPE_SCINTILLA_SELECTION_MODE); pyg_enum_add(module, "ScintillaCaretSticky", strip_prefix, GTK_TYPE_SCINTILLA_CARET_STICKY); pyg_enum_add(module, "ScintillaCaretStyle", strip_prefix, GTK_TYPE_SCINTILLA_CARET_STYLE); pyg_enum_add(module, "ScintillaAnnotationVisible", strip_prefix, GTK_TYPE_SCINTILLA_ANNOTATION_VISIBLE); pyg_enum_add(module, "ScintillaVirtualSpace", strip_prefix, GTK_TYPE_SCINTILLA_VIRTUAL_SPACE); pyg_enum_add(module, "ScintillaModificationFlags", strip_prefix, GTK_TYPE_SCINTILLA_MODIFICATION_FLAGS); pyg_enum_add(module, "ScintillaKeys", strip_prefix, GTK_TYPE_SCINTILLA_KEYS); pyg_enum_add(module, "ScintillaKeyMod", strip_prefix, GTK_TYPE_SCINTILLA_KEY_MOD); pyg_enum_add(module, "ScintillaLexers", strip_prefix, GTK_TYPE_SCINTILLA_LEXERS); pyg_enum_add(module, "ScintillaMessages", strip_prefix, GTK_TYPE_SCINTILLA_MESSAGES); if (PyErr_Occurred()) PyErr_Print(); }