gstreamer-python 1.27.90__cp310-cp310-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. gstreamer_python/Lib/girepository-1.0/GdkPixbuf-2.0.typelib +0 -0
  2. gstreamer_python/Lib/girepository-1.0/HarfBuzz-0.0.typelib +0 -0
  3. gstreamer_python/Lib/girepository-1.0/Json-1.0.typelib +0 -0
  4. gstreamer_python/Lib/girepository-1.0/Pango-1.0.typelib +0 -0
  5. gstreamer_python/Lib/girepository-1.0/PangoCairo-1.0.typelib +0 -0
  6. gstreamer_python/Lib/girepository-1.0/Soup-3.0.typelib +0 -0
  7. gstreamer_python/Lib/gstreamer-1.0/gstpython.dll +0 -0
  8. gstreamer_python/Lib/site-packages/PyGObject-3.50.2.dist-info/METADATA +21 -0
  9. gstreamer_python/Lib/site-packages/cairo/__init__.py +25 -0
  10. gstreamer_python/Lib/site-packages/cairo/__init__.pyi +5889 -0
  11. gstreamer_python/Lib/site-packages/cairo/_cairo.cp310-win32.pyd +0 -0
  12. gstreamer_python/Lib/site-packages/cairo/include/py3cairo.h +266 -0
  13. gstreamer_python/Lib/site-packages/cairo/py.typed +0 -0
  14. gstreamer_python/Lib/site-packages/gi/__init__.py +197 -0
  15. gstreamer_python/Lib/site-packages/gi/_constants.py +47 -0
  16. gstreamer_python/Lib/site-packages/gi/_error.py +55 -0
  17. gstreamer_python/Lib/site-packages/gi/_gi.cp310-win32.pyd +0 -0
  18. gstreamer_python/Lib/site-packages/gi/_gi_cairo.cp310-win32.pyd +0 -0
  19. gstreamer_python/Lib/site-packages/gi/_gtktemplate.py +307 -0
  20. gstreamer_python/Lib/site-packages/gi/_option.py +379 -0
  21. gstreamer_python/Lib/site-packages/gi/_ossighelper.py +275 -0
  22. gstreamer_python/Lib/site-packages/gi/_propertyhelper.py +402 -0
  23. gstreamer_python/Lib/site-packages/gi/_signalhelper.py +249 -0
  24. gstreamer_python/Lib/site-packages/gi/docstring.py +205 -0
  25. gstreamer_python/Lib/site-packages/gi/events.py +674 -0
  26. gstreamer_python/Lib/site-packages/gi/importer.py +153 -0
  27. gstreamer_python/Lib/site-packages/gi/module.py +269 -0
  28. gstreamer_python/Lib/site-packages/gi/overrides/GES.py +94 -0
  29. gstreamer_python/Lib/site-packages/gi/overrides/GIMarshallingTests.py +72 -0
  30. gstreamer_python/Lib/site-packages/gi/overrides/GLib.py +882 -0
  31. gstreamer_python/Lib/site-packages/gi/overrides/GObject.py +692 -0
  32. gstreamer_python/Lib/site-packages/gi/overrides/Gdk.py +444 -0
  33. gstreamer_python/Lib/site-packages/gi/overrides/GdkPixbuf.py +53 -0
  34. gstreamer_python/Lib/site-packages/gi/overrides/Gio.py +655 -0
  35. gstreamer_python/Lib/site-packages/gi/overrides/Gst.py +1273 -0
  36. gstreamer_python/Lib/site-packages/gi/overrides/GstAnalytics.py +106 -0
  37. gstreamer_python/Lib/site-packages/gi/overrides/GstApp.py +50 -0
  38. gstreamer_python/Lib/site-packages/gi/overrides/GstAudio.py +18 -0
  39. gstreamer_python/Lib/site-packages/gi/overrides/GstPbutils.py +99 -0
  40. gstreamer_python/Lib/site-packages/gi/overrides/GstVideo.py +17 -0
  41. gstreamer_python/Lib/site-packages/gi/overrides/Gtk.py +1707 -0
  42. gstreamer_python/Lib/site-packages/gi/overrides/Pango.py +58 -0
  43. gstreamer_python/Lib/site-packages/gi/overrides/__init__.py +357 -0
  44. gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst.cp310-win32.pyd +0 -0
  45. gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst_analytics.cp310-win32.pyd +0 -0
  46. gstreamer_python/Lib/site-packages/gi/overrides/keysyms.py +53 -0
  47. gstreamer_python/Lib/site-packages/gi/pygtkcompat.py +26 -0
  48. gstreamer_python/Lib/site-packages/gi/repository/__init__.py +28 -0
  49. gstreamer_python/Lib/site-packages/gi/types.py +350 -0
  50. gstreamer_python/Lib/site-packages/pycairo-1.27.0.dist-info/METADATA +9 -0
  51. gstreamer_python/__init__.py +32 -0
  52. gstreamer_python-1.27.90.dist-info/METADATA +26 -0
  53. gstreamer_python-1.27.90.dist-info/RECORD +55 -0
  54. gstreamer_python-1.27.90.dist-info/WHEEL +5 -0
  55. gstreamer_python-1.27.90.dist-info/top_level.txt +1 -0
@@ -0,0 +1,266 @@
1
+ /* -*- mode: C; c-basic-offset: 2 -*-
2
+ *
3
+ * Pycairo - Python bindings for cairo
4
+ *
5
+ * Copyright © 2003 James Henstridge
6
+ * Copyright © 2004-2011 Steven Chaplin
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it either under the terms of the GNU Lesser General Public
10
+ * License version 2.1 as published by the Free Software Foundation
11
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
12
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
13
+ * notice, a recipient may use your version of this file under either
14
+ * the MPL or the LGPL.
15
+ *
16
+ * You should have received a copy of the LGPL along with this library
17
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
18
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ * You should have received a copy of the MPL along with this library
20
+ * in the file COPYING-MPL-1.1
21
+ *
22
+ * The contents of this file are subject to the Mozilla Public License
23
+ * Version 1.1 (the "License"); you may not use this file except in
24
+ * compliance with the License. You may obtain a copy of the License at
25
+ * http://www.mozilla.org/MPL/
26
+ *
27
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
28
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
29
+ * the specific language governing rights and limitations.
30
+ */
31
+
32
+ #ifndef _PYCAIRO_H_
33
+ #define _PYCAIRO_H_
34
+
35
+ #include <Python.h>
36
+
37
+ #include <cairo.h>
38
+
39
+
40
+ typedef struct {
41
+ PyObject_HEAD
42
+ cairo_t *ctx;
43
+ PyObject *base; /* base object used to create context, or NULL */
44
+ } PycairoContext;
45
+
46
+ typedef struct {
47
+ PyObject_HEAD
48
+ cairo_font_face_t *font_face;
49
+ } PycairoFontFace;
50
+
51
+ #define PycairoToyFontFace PycairoFontFace
52
+
53
+ typedef struct {
54
+ PyObject_HEAD
55
+ cairo_font_options_t *font_options;
56
+ } PycairoFontOptions;
57
+
58
+ typedef struct {
59
+ PyObject_HEAD
60
+ cairo_matrix_t matrix;
61
+ } PycairoMatrix;
62
+
63
+ typedef struct {
64
+ PyObject_HEAD
65
+ cairo_path_t *path;
66
+ } PycairoPath;
67
+
68
+ typedef struct {
69
+ PyObject_HEAD
70
+ cairo_pattern_t *pattern;
71
+ PyObject *base; /* base object used to create pattern, or NULL */
72
+ } PycairoPattern;
73
+
74
+ typedef struct {
75
+ PyObject_HEAD
76
+ cairo_rectangle_int_t rectangle_int;
77
+ } PycairoRectangleInt;
78
+
79
+ typedef struct {
80
+ PyObject_HEAD
81
+ cairo_region_t *region;
82
+ } PycairoRegion;
83
+
84
+ #define PycairoSolidPattern PycairoPattern
85
+ #define PycairoSurfacePattern PycairoPattern
86
+ #define PycairoGradient PycairoPattern
87
+ #define PycairoLinearGradient PycairoPattern
88
+ #define PycairoRadialGradient PycairoPattern
89
+
90
+ typedef struct {
91
+ PyObject_HEAD
92
+ cairo_scaled_font_t *scaled_font;
93
+ } PycairoScaledFont;
94
+
95
+ typedef struct {
96
+ PyObject_HEAD
97
+ cairo_surface_t *surface;
98
+ PyObject *base; /* base object used to create surface, or NULL */
99
+ } PycairoSurface;
100
+
101
+ #define PycairoImageSurface PycairoSurface
102
+ #define PycairoPDFSurface PycairoSurface
103
+ #define PycairoPSSurface PycairoSurface
104
+ #define PycairoRecordingSurface PycairoSurface
105
+ #define PycairoSVGSurface PycairoSurface
106
+ #define PycairoWin32Surface PycairoSurface
107
+ #define PycairoWin32PrintingSurface PycairoSurface
108
+ #define PycairoXCBSurface PycairoSurface
109
+ #define PycairoXlibSurface PycairoSurface
110
+
111
+ /* get C object out of the Python wrapper */
112
+ #define PycairoContext_GET(obj) (((PycairoContext *)(obj))->ctx)
113
+
114
+ /* Define structure for C API. */
115
+ typedef struct {
116
+ /* (type object, constructor) pairs */
117
+ PyTypeObject *Context_Type;
118
+ PyObject *(*Context_FromContext)(cairo_t *ctx, PyTypeObject *type,
119
+ PyObject *base);
120
+ PyTypeObject *FontFace_Type;
121
+ PyTypeObject *ToyFontFace_Type;
122
+ PyObject *(*FontFace_FromFontFace)(cairo_font_face_t *font_face);
123
+ PyTypeObject *FontOptions_Type;
124
+ PyObject *(*FontOptions_FromFontOptions)(
125
+ cairo_font_options_t *font_options);
126
+ PyTypeObject *Matrix_Type;
127
+ PyObject *(*Matrix_FromMatrix)(const cairo_matrix_t *matrix);
128
+ PyTypeObject *Path_Type;
129
+ PyObject *(*Path_FromPath)(cairo_path_t *path);
130
+
131
+ PyTypeObject *Pattern_Type;
132
+ PyTypeObject *SolidPattern_Type;
133
+ PyTypeObject *SurfacePattern_Type;
134
+ PyTypeObject *Gradient_Type;
135
+ PyTypeObject *LinearGradient_Type;
136
+ PyTypeObject *RadialGradient_Type;
137
+ PyObject *(*Pattern_FromPattern)(cairo_pattern_t *pattern, PyObject *base);
138
+
139
+ PyTypeObject *ScaledFont_Type;
140
+ PyObject *(*ScaledFont_FromScaledFont)(cairo_scaled_font_t *scaled_font);
141
+
142
+ PyTypeObject *Surface_Type;
143
+ PyTypeObject *ImageSurface_Type;
144
+ PyTypeObject *PDFSurface_Type;
145
+ PyTypeObject *PSSurface_Type;
146
+ PyTypeObject *SVGSurface_Type;
147
+ PyTypeObject *Win32Surface_Type;
148
+ PyTypeObject *Win32PrintingSurface_Type;
149
+ PyTypeObject *XCBSurface_Type;
150
+ PyTypeObject *XlibSurface_Type;
151
+ PyObject *(*Surface_FromSurface)(cairo_surface_t *surface, PyObject *base);
152
+
153
+ /* misc functions */
154
+ int (*Check_Status)(cairo_status_t status);
155
+
156
+ PyTypeObject *RectangleInt_Type;
157
+ PyObject *(*RectangleInt_FromRectangleInt)(
158
+ const cairo_rectangle_int_t *rectangle_int);
159
+
160
+ PyTypeObject *Region_Type;
161
+ PyObject *(*Region_FromRegion)(cairo_region_t *region);
162
+
163
+ PyTypeObject *RecordingSurface_Type;
164
+ } Pycairo_CAPI_t;
165
+
166
+
167
+ #ifndef _INSIDE_PYCAIRO_
168
+
169
+ /* Macros for accessing the C API */
170
+ #define PycairoContext_Type *(Pycairo_CAPI->Context_Type)
171
+ #define PycairoContext_FromContext (Pycairo_CAPI->Context_FromContext)
172
+ #define PycairoFontFace_Type *(Pycairo_CAPI->FontFace_Type)
173
+ #define PycairoToyFontFace_Type *(Pycairo_CAPI->ToyFontFace_Type)
174
+ #define PycairoFontFace_FromFontFace (Pycairo_CAPI->FontFace_FromFontFace)
175
+ #define PycairoFontOptions_Type *(Pycairo_CAPI->FontOptions_Type)
176
+ #define PycairoFontOptions_FromFontOptions \
177
+ (Pycairo_CAPI->FontOptions_FromFontOptions)
178
+ #define PycairoMatrix_Type *(Pycairo_CAPI->Matrix_Type)
179
+ #define PycairoMatrix_FromMatrix (Pycairo_CAPI->Matrix_FromMatrix)
180
+ #define PycairoPath_Type *(Pycairo_CAPI->Path_Type)
181
+ #define PycairoPath_FromPath (Pycairo_CAPI->Path_FromPath)
182
+
183
+ #define PycairoPattern_Type *(Pycairo_CAPI->Pattern_Type)
184
+ #define PycairoSolidPattern_Type *(Pycairo_CAPI->SolidPattern_Type)
185
+ #define PycairoSurfacePattern_Type *(Pycairo_CAPI->SurfacePattern_Type)
186
+ #define PycairoGradient_Type *(Pycairo_CAPI->Gradient_Type)
187
+ #define PycairoLinearGradient_Type *(Pycairo_CAPI->LinearGradient_Type)
188
+ #define PycairoRadialGradient_Type *(Pycairo_CAPI->RadialGradient_Type)
189
+ #define PycairoPattern_FromPattern (Pycairo_CAPI->Pattern_FromPattern)
190
+
191
+ #define PycairoRectangleInt_Type *(Pycairo_CAPI->RectangleInt_Type)
192
+ #define PycairoRectangleInt_FromRectangleInt \
193
+ (Pycairo_CAPI->RectangleInt_FromRectangleInt)
194
+
195
+ #define PycairoRegion_Type *(Pycairo_CAPI->Region_Type)
196
+ #define PycairoRegion_FromRegion (Pycairo_CAPI->Region_FromRegion)
197
+
198
+ #define PycairoScaledFont_Type *(Pycairo_CAPI->ScaledFont_Type)
199
+ #define PycairoScaledFont_FromScaledFont \
200
+ (Pycairo_CAPI->ScaledFont_FromScaledFont)
201
+
202
+ #define PycairoSurface_Type *(Pycairo_CAPI->Surface_Type)
203
+ #define PycairoImageSurface_Type *(Pycairo_CAPI->ImageSurface_Type)
204
+
205
+ #ifdef CAIRO_HAS_PDF_SURFACE
206
+ #define PycairoPDFSurface_Type *(Pycairo_CAPI->PDFSurface_Type)
207
+ #endif
208
+
209
+ #ifdef CAIRO_HAS_PS_SURFACE
210
+ #define PycairoPSSurface_Type *(Pycairo_CAPI->PSSurface_Type)
211
+ #endif
212
+
213
+ #ifdef CAIRO_HAS_RECORDING_SURFACE
214
+ #define PycairoRecordingSurface_Type \
215
+ *(Pycairo_CAPI->RecordingSurface_Type)
216
+ #endif
217
+
218
+ #ifdef CAIRO_HAS_SVG_SURFACE
219
+ #define PycairoSVGSurface_Type *(Pycairo_CAPI->SVGSurface_Type)
220
+ #endif
221
+
222
+ #ifdef CAIRO_HAS_WIN32_SURFACE
223
+ #define PycairoWin32Surface_Type *(Pycairo_CAPI->Win32Surface_Type)
224
+ #define PycairoWin32PrintingSurface_Type \
225
+ *(Pycairo_CAPI->Win32PrintingSurface_Type)
226
+ #endif
227
+
228
+ #ifdef CAIRO_HAS_XCB_SURFACE
229
+ #define PycairoXCBSurface_Type *(Pycairo_CAPI->XCBSurface_Type)
230
+ #endif
231
+
232
+ #ifdef CAIRO_HAS_XLIB_SURFACE
233
+ #define PycairoXlibSurface_Type *(Pycairo_CAPI->XlibSurface_Type)
234
+ #endif
235
+
236
+ #define PycairoSurface_FromSurface (Pycairo_CAPI->Surface_FromSurface)
237
+
238
+ #define Pycairo_Check_Status (Pycairo_CAPI->Check_Status)
239
+
240
+ #ifdef PYCAIRO_NO_IMPORT
241
+
242
+ extern Pycairo_CAPI_t *Pycairo_CAPI;
243
+
244
+ #else
245
+
246
+ /* To access the Pycairo C API, the client module should call 'import_cairo()'
247
+ * from the init<module> function, and check the return value, < 0 means the
248
+ * import failed.
249
+ */
250
+ Pycairo_CAPI_t *Pycairo_CAPI;
251
+
252
+ /* Return -1 on error, 0 on success.
253
+ * PyCapsule_Import will set an exception if there's an error.
254
+ */
255
+ static inline int
256
+ import_cairo(void)
257
+ {
258
+ Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import("cairo.CAPI", 0);
259
+ return (Pycairo_CAPI != 0) ? 0 : -1;
260
+ }
261
+
262
+ #endif
263
+
264
+ #endif /* ifndef _INSIDE_PYCAIRO_ */
265
+
266
+ #endif /* ifndef _PYCAIRO_H_ */
File without changes
@@ -0,0 +1,197 @@
1
+ # -*- Mode: Python; py-indent-offset: 4 -*-
2
+ # vim: tabstop=4 shiftwidth=4 expandtab
3
+ #
4
+ # Copyright (C) 2005-2009 Johan Dahlin <johan@gnome.org>
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
19
+ # USA
20
+
21
+ # support overrides in different directories than our gi module
22
+ from pkgutil import extend_path
23
+ __path__ = extend_path(__path__, __name__)
24
+
25
+ import sys
26
+ import os
27
+ import importlib
28
+ import types
29
+
30
+ _static_binding_error = ('When using gi.repository you must not import static '
31
+ 'modules like "gobject". Please change all occurrences '
32
+ 'of "import gobject" to "from gi.repository import GObject". '
33
+ 'See: https://bugzilla.gnome.org/show_bug.cgi?id=709183')
34
+
35
+ # we can't have pygobject 2 loaded at the same time we load the internal _gobject
36
+ if 'gobject' in sys.modules:
37
+ raise ImportError(_static_binding_error)
38
+
39
+ if sys.platform.startswith('win'):
40
+ bindirs = []
41
+ if 'PYGI_DLL_DIRS' in os.environ:
42
+ bindirs = os.environ['PYGI_DLL_DIRS'].split(os.pathsep)
43
+ else:
44
+ # Find prefix assuming directory layout is Lib/site-packages/gi (msvc)
45
+ prefix = os.path.abspath(os.path.join(
46
+ os.path.dirname(__file__),
47
+ os.path.pardir,
48
+ os.path.pardir,
49
+ os.path.pardir
50
+ ))
51
+ bindir = os.path.join(prefix, 'bin')
52
+ if not os.path.isdir(bindir):
53
+ # Find prefix assuming layout is lib/pythonx.y/site-packages/gi (mingw)
54
+ prefix = os.path.dirname(prefix)
55
+ bindir = os.path.join(prefix, 'bin')
56
+ if not os.path.isdir(bindir):
57
+ raise ImportError('Could not deduce DLL directories, please set PYGI_DLL_DIRS')
58
+ bindirs = [bindir]
59
+ for bindir in bindirs:
60
+ os.add_dll_directory(bindir)
61
+
62
+ from . import _gi
63
+ from ._gi import _API # noqa: F401
64
+ from ._gi import Repository
65
+ from ._gi import PyGIDeprecationWarning # noqa: F401
66
+ from ._gi import PyGIWarning # noqa: F401
67
+
68
+ _versions = {}
69
+ _overridesdir = os.path.join(os.path.dirname(__file__), 'overrides')
70
+
71
+ # Needed for compatibility with "pygobject.h"/pygobject_init()
72
+ _gobject = types.ModuleType("gi._gobject")
73
+ sys.modules[_gobject.__name__] = _gobject
74
+ _gobject._PyGObject_API = _gi._PyGObject_API
75
+ _gobject.pygobject_version = _gi.pygobject_version
76
+
77
+ version_info = _gi.pygobject_version[:]
78
+ __version__ = "{0}.{1}.{2}".format(*version_info)
79
+
80
+ _gi.register_foreign()
81
+
82
+
83
+ class _DummyStaticModule(types.ModuleType):
84
+ __path__ = None
85
+
86
+ def __getattr__(self, name):
87
+ raise AttributeError(_static_binding_error)
88
+
89
+
90
+ sys.modules['glib'] = _DummyStaticModule('glib', _static_binding_error)
91
+ sys.modules['gobject'] = _DummyStaticModule('gobject', _static_binding_error)
92
+ sys.modules['gio'] = _DummyStaticModule('gio', _static_binding_error)
93
+ sys.modules['gtk'] = _DummyStaticModule('gtk', _static_binding_error)
94
+ sys.modules['gtk.gdk'] = _DummyStaticModule('gtk.gdk', _static_binding_error)
95
+
96
+
97
+ def check_version(version):
98
+ if isinstance(version, str):
99
+ version_list = tuple(map(int, version.split(".")))
100
+ else:
101
+ version_list = version
102
+
103
+ if version_list > version_info:
104
+ raise ValueError((
105
+ "pygobject's version %s required, and available version "
106
+ "%s is not recent enough") % (version, __version__)
107
+ )
108
+
109
+
110
+ def require_version(namespace, version):
111
+ """ Ensures the correct versions are loaded when importing `gi` modules.
112
+
113
+ :param namespace: The name of module to require.
114
+ :type namespace: str
115
+ :param version: The version of module to require.
116
+ :type version: str
117
+ :raises ValueError: If module/version is already loaded, already required, or unavailable.
118
+
119
+ :Example:
120
+
121
+ .. code-block:: python
122
+
123
+ import gi
124
+ gi.require_version('Gtk', '3.0')
125
+
126
+ """
127
+ repository = Repository.get_default()
128
+
129
+ if not isinstance(version, str):
130
+ raise ValueError('Namespace version needs to be a string.')
131
+
132
+ if namespace in repository.get_loaded_namespaces():
133
+ loaded_version = repository.get_version(namespace)
134
+ if loaded_version != version:
135
+ raise ValueError('Namespace %s is already loaded with version %s' %
136
+ (namespace, loaded_version))
137
+
138
+ if namespace in _versions and _versions[namespace] != version:
139
+ raise ValueError('Namespace %s already requires version %s' %
140
+ (namespace, _versions[namespace]))
141
+
142
+ available_versions = repository.enumerate_versions(namespace)
143
+ if not available_versions:
144
+ raise ValueError('Namespace %s not available' % namespace)
145
+
146
+ if version not in available_versions:
147
+ raise ValueError('Namespace %s not available for version %s' %
148
+ (namespace, version))
149
+
150
+ _versions[namespace] = version
151
+
152
+
153
+ def require_versions(requires):
154
+ """ Utility function for consolidating multiple `gi.require_version()` calls.
155
+
156
+ :param requires: The names and versions of modules to require.
157
+ :type requires: dict
158
+
159
+ :Example:
160
+
161
+ .. code-block:: python
162
+
163
+ import gi
164
+ gi.require_versions({'Gtk': '3.0', 'GLib': '2.0', 'Gio': '2.0'})
165
+ """
166
+ for module_name, module_version in requires.items():
167
+ require_version(module_name, module_version)
168
+
169
+
170
+ def get_required_version(namespace):
171
+ return _versions.get(namespace, None)
172
+
173
+
174
+ def require_foreign(namespace, symbol=None):
175
+ """Ensure the given foreign marshaling module is available and loaded.
176
+
177
+ :param str namespace:
178
+ Introspection namespace of the foreign module (e.g. "cairo")
179
+ :param symbol:
180
+ Optional symbol typename to ensure a converter exists.
181
+ :type symbol: str or None
182
+ :raises: ImportError
183
+
184
+ :Example:
185
+
186
+ .. code-block:: python
187
+
188
+ import gi
189
+ import cairo
190
+ gi.require_foreign('cairo')
191
+
192
+ """
193
+ try:
194
+ _gi.require_foreign(namespace, symbol)
195
+ except Exception as e:
196
+ raise ImportError(str(e))
197
+ importlib.import_module('gi.repository', namespace)
@@ -0,0 +1,47 @@
1
+ # -*- Mode: Python; py-indent-offset: 4 -*-
2
+ # pygobject - Python bindings for the GObject library
3
+ # Copyright (C) 2006-2007 Johan Dahlin
4
+ #
5
+ # gi/_constants.py: GObject type constants
6
+ #
7
+ # This library is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # This library is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with this library; if not, see <http://www.gnu.org/licenses/>.
19
+
20
+ from . import _gi
21
+
22
+ TYPE_INVALID = _gi.TYPE_INVALID
23
+ TYPE_NONE = _gi.GType.from_name('void')
24
+ TYPE_INTERFACE = _gi.GType.from_name('GInterface')
25
+ TYPE_CHAR = _gi.GType.from_name('gchar')
26
+ TYPE_UCHAR = _gi.GType.from_name('guchar')
27
+ TYPE_BOOLEAN = _gi.GType.from_name('gboolean')
28
+ TYPE_INT = _gi.GType.from_name('gint')
29
+ TYPE_UINT = _gi.GType.from_name('guint')
30
+ TYPE_LONG = _gi.GType.from_name('glong')
31
+ TYPE_ULONG = _gi.GType.from_name('gulong')
32
+ TYPE_INT64 = _gi.GType.from_name('gint64')
33
+ TYPE_UINT64 = _gi.GType.from_name('guint64')
34
+ TYPE_ENUM = _gi.GType.from_name('GEnum')
35
+ TYPE_FLAGS = _gi.GType.from_name('GFlags')
36
+ TYPE_FLOAT = _gi.GType.from_name('gfloat')
37
+ TYPE_DOUBLE = _gi.GType.from_name('gdouble')
38
+ TYPE_STRING = _gi.GType.from_name('gchararray')
39
+ TYPE_POINTER = _gi.GType.from_name('gpointer')
40
+ TYPE_BOXED = _gi.GType.from_name('GBoxed')
41
+ TYPE_PARAM = _gi.GType.from_name('GParam')
42
+ TYPE_OBJECT = _gi.GType.from_name('GObject')
43
+ TYPE_PYOBJECT = _gi.GType.from_name('PyObject')
44
+ TYPE_GTYPE = _gi.GType.from_name('GType')
45
+ TYPE_STRV = _gi.GType.from_name('GStrv')
46
+ TYPE_VARIANT = _gi.GType.from_name('GVariant')
47
+ TYPE_UNICHAR = TYPE_UINT
@@ -0,0 +1,55 @@
1
+ # -*- Mode: Python; py-indent-offset: 4 -*-
2
+ # vim: tabstop=4 shiftwidth=4 expandtab
3
+ #
4
+ # Copyright (C) 2014 Simon Feltman <sfeltman@gnome.org>
5
+ #
6
+ # _error.py: GError Python implementation
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21
+ # USA
22
+
23
+
24
+ # NOTE: This file should not have any dependencies on introspection libs
25
+ # like gi.repository.GLib because it would cause a circular dependency.
26
+ # Developers wanting to use the GError class in their applications should
27
+ # use gi.repository.GLib.GError
28
+
29
+
30
+ class GError(RuntimeError):
31
+ def __init__(self, message='unknown error', domain='pygi-error', code=0):
32
+ super(GError, self).__init__(message)
33
+ self.message = message
34
+ self.domain = domain
35
+ self.code = code
36
+
37
+ def __str__(self):
38
+ return "%s: %s (%d)" % (self.domain, self.message, self.code)
39
+
40
+ def __repr__(self):
41
+ return "%s.%s('%s', '%s', %d)" % (
42
+ GError.__module__.rsplit(".", 1)[-1], GError.__name__,
43
+ self.message, self.domain, self.code)
44
+
45
+ def copy(self):
46
+ return GError(self.message, self.domain, self.code)
47
+
48
+ def matches(self, domain, code):
49
+ """Placeholder that will be monkey patched in GLib overrides."""
50
+ raise NotImplementedError
51
+
52
+ @staticmethod
53
+ def new_literal(domain, message, code):
54
+ """Placeholder that will be monkey patched in GLib overrides."""
55
+ raise NotImplementedError