gstreamer-python 1.27.90__cp39-cp39-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.cp39-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.cp39-win32.pyd +0 -0
  18. gstreamer_python/Lib/site-packages/gi/_gi_cairo.cp39-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.cp39-win32.pyd +0 -0
  45. gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst_analytics.cp39-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,249 @@
1
+ # -*- Mode: Python; py-indent-offset: 4 -*-
2
+ # pygobject - Python bindings for the GObject library
3
+ # Copyright (C) 2012 Simon Feltman
4
+ #
5
+ # gi/_signalhelper.py: GObject signal binding decorator object
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
+
23
+ class Signal(str):
24
+ """Object which gives a nice API for creating and binding signals.
25
+
26
+ :param name:
27
+ Name of signal or callable closure when used as a decorator.
28
+ :type name: str or callable
29
+ :param callable func:
30
+ Callable closure method.
31
+ :param GObject.SignalFlags flags:
32
+ Flags specifying when to run closure.
33
+ :param type return_type:
34
+ Return type of the Signal.
35
+ :param list arg_types:
36
+ List of argument types specifying the signals function signature
37
+ :param str doc:
38
+ Documentation of signal object.
39
+ :param callable accumulator:
40
+ Accumulator method with the signature:
41
+ func(ihint, return_accu, handler_return, accu_data) -> boolean
42
+ :param object accu_data:
43
+ User data passed to the accumulator.
44
+
45
+ :Example:
46
+
47
+ .. code-block:: python
48
+
49
+ class Spam(GObject.Object):
50
+ velocity = 0
51
+
52
+ @GObject.Signal
53
+ def pushed(self):
54
+ self.velocity += 1
55
+
56
+ @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST)
57
+ def pulled(self):
58
+ self.velocity -= 1
59
+
60
+ stomped = GObject.Signal('stomped', arg_types=(int,))
61
+
62
+ @GObject.Signal
63
+ def annotated_signal(self, a:int, b:str):
64
+ "Python3 annotation support for parameter types.
65
+
66
+ def on_pushed(obj):
67
+ print(obj)
68
+
69
+ spam = Spam()
70
+ spam.pushed.connect(on_pushed)
71
+ spam.pushed.emit()
72
+ """
73
+ class BoundSignal(str):
74
+ """
75
+ Temporary binding object which can be used for connecting signals
76
+ without specifying the signal name string to connect.
77
+ """
78
+ def __new__(cls, name, *args, **kargs):
79
+ return str.__new__(cls, name)
80
+
81
+ def __init__(self, signal, gobj):
82
+ str.__init__(self)
83
+ self.signal = signal
84
+ self.gobj = gobj
85
+
86
+ def __repr__(self):
87
+ return 'BoundSignal("%s")' % self
88
+
89
+ def __call__(self, *args, **kargs):
90
+ """Call the signals closure."""
91
+ return self.signal.func(self.gobj, *args, **kargs)
92
+
93
+ def connect(self, callback, *args, **kargs):
94
+ """Same as GObject.Object.connect except there is no need to specify
95
+ the signal name."""
96
+ return self.gobj.connect(self, callback, *args, **kargs)
97
+
98
+ def connect_detailed(self, callback, detail, *args, **kargs):
99
+ """Same as GObject.Object.connect except there is no need to specify
100
+ the signal name. In addition concats "::<detail>" to the signal name
101
+ when connecting; for use with notifications like "notify" when a property
102
+ changes.
103
+ """
104
+ return self.gobj.connect(self + '::' + detail, callback, *args, **kargs)
105
+
106
+ def disconnect(self, handler_id):
107
+ """Same as GObject.Object.disconnect."""
108
+ self.gobj.disconnect(handler_id)
109
+
110
+ def emit(self, *args, **kargs):
111
+ """Same as GObject.Object.emit except there is no need to specify
112
+ the signal name."""
113
+ return self.gobj.emit(str(self), *args, **kargs)
114
+
115
+ def __new__(cls, name='', *args, **kargs):
116
+ if callable(name):
117
+ name = name.__name__
118
+ return str.__new__(cls, name)
119
+
120
+ def __init__(self, name='', func=None, flags=_gi.SIGNAL_RUN_FIRST,
121
+ return_type=None, arg_types=None, doc='', accumulator=None, accu_data=None):
122
+ if func is None and callable(name):
123
+ func = name
124
+
125
+ if func and not doc:
126
+ doc = func.__doc__
127
+
128
+ str.__init__(self)
129
+
130
+ if func and not (return_type or arg_types):
131
+ return_type, arg_types = get_signal_annotations(func)
132
+ if arg_types is None:
133
+ arg_types = tuple()
134
+
135
+ self.func = func
136
+ self.flags = flags
137
+ self.return_type = return_type
138
+ self.arg_types = arg_types
139
+ self.__doc__ = doc
140
+ self.accumulator = accumulator
141
+ self.accu_data = accu_data
142
+
143
+ def __get__(self, instance, owner=None):
144
+ """Returns a BoundSignal when accessed on an object instance."""
145
+ if instance is None:
146
+ return self
147
+ return self.BoundSignal(self, instance)
148
+
149
+ def __call__(self, obj, *args, **kargs):
150
+ """Allows for instantiated Signals to be used as a decorator or calling
151
+ of the underlying signal method."""
152
+
153
+ # If obj is a GObject, than we call this signal as a closure otherwise
154
+ # it is used as a re-application of a decorator.
155
+ if isinstance(obj, _gi.GObject):
156
+ self.func(obj, *args, **kargs)
157
+ else:
158
+ # If self is already an allocated name, use it otherwise create a new named
159
+ # signal using the closure name as the name.
160
+ if str(self):
161
+ name = str(self)
162
+ else:
163
+ name = obj.__name__
164
+ # Return a new value of this type since it is based on an immutable string.
165
+ return type(self)(name=name, func=obj, flags=self.flags,
166
+ return_type=self.return_type, arg_types=self.arg_types,
167
+ doc=self.__doc__, accumulator=self.accumulator, accu_data=self.accu_data)
168
+
169
+ def copy(self, newName=None):
170
+ """Returns a renamed copy of the Signal."""
171
+
172
+ return type(self)(name=newName, func=self.func, flags=self.flags,
173
+ return_type=self.return_type, arg_types=self.arg_types,
174
+ doc=self.__doc__, accumulator=self.accumulator, accu_data=self.accu_data)
175
+
176
+ def get_signal_args(self):
177
+ """Returns a tuple of: (flags, return_type, arg_types, accumulator, accu_data)"""
178
+ return (self.flags, self.return_type, self.arg_types, self.accumulator, self.accu_data)
179
+
180
+
181
+ class SignalOverride(Signal):
182
+ """Specialized sub-class of Signal which can be used as a decorator for overriding
183
+ existing signals on GObjects.
184
+
185
+ :Example:
186
+
187
+ .. code-block:: python
188
+
189
+ class MyWidget(Gtk.Widget):
190
+ @GObject.SignalOverride
191
+ def configure_event(self):
192
+ pass
193
+ """
194
+ def get_signal_args(self):
195
+ """Returns the string 'override'."""
196
+ return 'override'
197
+
198
+
199
+ def get_signal_annotations(func):
200
+ """Attempt pulling python 3 function annotations off of 'func' for
201
+ use as a signals type information. Returns an ordered nested tuple
202
+ of (return_type, (arg_type1, arg_type2, ...)). If the given function
203
+ does not have annotations then (None, tuple()) is returned.
204
+ """
205
+ arg_types = tuple()
206
+ return_type = None
207
+
208
+ if hasattr(func, '__annotations__'):
209
+ # import inspect only when needed because it takes ~10 msec to load
210
+ import inspect
211
+ spec = inspect.getfullargspec(func)
212
+ arg_types = tuple(spec.annotations[arg] for arg in spec.args
213
+ if arg in spec.annotations)
214
+ if 'return' in spec.annotations:
215
+ return_type = spec.annotations['return']
216
+
217
+ return return_type, arg_types
218
+
219
+
220
+ def install_signals(cls):
221
+ """Adds Signal instances on a GObject derived class into the '__gsignals__'
222
+ dictionary to be picked up and registered as real GObject signals.
223
+ """
224
+ gsignals = cls.__dict__.get('__gsignals__', {})
225
+ newsignals = {}
226
+ for name, signal in cls.__dict__.items():
227
+ if isinstance(signal, Signal):
228
+ signalName = str(signal)
229
+ # Fixup a signal which is unnamed by using the class variable name.
230
+ # Since Signal is based on string which immutable,
231
+ # we must copy and replace the class variable.
232
+ if not signalName:
233
+ signalName = name
234
+ signal = signal.copy(name)
235
+ setattr(cls, name, signal)
236
+ if signalName in gsignals:
237
+ raise ValueError('Signal "%s" has already been registered.' % name)
238
+ newsignals[signalName] = signal
239
+ gsignals[signalName] = signal.get_signal_args()
240
+
241
+ cls.__gsignals__ = gsignals
242
+
243
+ # Setup signal closures by adding the specially named
244
+ # method to the class in the form of "do_<signal_name>".
245
+ for name, signal in newsignals.items():
246
+ if signal.func is not None:
247
+ funcName = 'do_' + name.replace('-', '_')
248
+ if not hasattr(cls, funcName):
249
+ setattr(cls, funcName, signal.func)
@@ -0,0 +1,205 @@
1
+ # -*- Mode: Python; py-indent-offset: 4 -*-
2
+ # vim: tabstop=4 shiftwidth=4 expandtab
3
+ #
4
+ # Copyright (C) 2013 Simon Feltman <sfeltman@gnome.org>
5
+ #
6
+ # docstring.py: documentation string generator for gi.
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
+ from ._gi import \
24
+ VFuncInfo, \
25
+ FunctionInfo, \
26
+ CallableInfo, \
27
+ ObjectInfo, \
28
+ StructInfo, \
29
+ Direction, \
30
+ TypeTag
31
+
32
+
33
+ #: Module storage for currently registered doc string generator function.
34
+ _generate_doc_string_func = None
35
+
36
+
37
+ def set_doc_string_generator(func):
38
+ """Set doc string generator function
39
+
40
+ :param callable func:
41
+ Callable which takes a GIInfoStruct and returns documentation for it.
42
+ """
43
+ global _generate_doc_string_func
44
+ _generate_doc_string_func = func
45
+
46
+
47
+ def get_doc_string_generator():
48
+ """Returns the currently registered doc string generator."""
49
+ return _generate_doc_string_func
50
+
51
+
52
+ def generate_doc_string(info):
53
+ """Generate a doc string given a GIInfoStruct.
54
+
55
+ :param gi.types.BaseInfo info:
56
+ GI info instance to generate documentation for.
57
+ :returns:
58
+ Generated documentation as a string.
59
+ :rtype: str
60
+
61
+ This passes the info struct to the currently registered doc string
62
+ generator and returns the result.
63
+ """
64
+ return _generate_doc_string_func(info)
65
+
66
+
67
+ _type_tag_to_py_type = {TypeTag.BOOLEAN: bool,
68
+ TypeTag.INT8: int,
69
+ TypeTag.UINT8: int,
70
+ TypeTag.INT16: int,
71
+ TypeTag.UINT16: int,
72
+ TypeTag.INT32: int,
73
+ TypeTag.UINT32: int,
74
+ TypeTag.INT64: int,
75
+ TypeTag.UINT64: int,
76
+ TypeTag.FLOAT: float,
77
+ TypeTag.DOUBLE: float,
78
+ TypeTag.GLIST: list,
79
+ TypeTag.GSLIST: list,
80
+ TypeTag.ARRAY: list,
81
+ TypeTag.GHASH: dict,
82
+ TypeTag.UTF8: str,
83
+ TypeTag.FILENAME: str,
84
+ TypeTag.UNICHAR: str,
85
+ TypeTag.INTERFACE: None,
86
+ TypeTag.GTYPE: None,
87
+ TypeTag.ERROR: None,
88
+ TypeTag.VOID: None,
89
+ }
90
+
91
+
92
+ def _get_pytype_hint(gi_type):
93
+ type_tag = gi_type.get_tag()
94
+ py_type = _type_tag_to_py_type.get(type_tag, None)
95
+
96
+ if py_type and hasattr(py_type, '__name__'):
97
+ return py_type.__name__
98
+ elif type_tag == TypeTag.INTERFACE:
99
+ iface = gi_type.get_interface()
100
+
101
+ info_name = iface.get_name()
102
+ if not info_name:
103
+ return gi_type.get_tag_as_string()
104
+
105
+ return '%s.%s' % (iface.get_namespace(), info_name)
106
+
107
+ return gi_type.get_tag_as_string()
108
+
109
+
110
+ def _generate_callable_info_doc(info):
111
+ in_args_strs = []
112
+ if isinstance(info, VFuncInfo):
113
+ in_args_strs = ['self']
114
+ elif isinstance(info, FunctionInfo):
115
+ if info.is_method():
116
+ in_args_strs = ['self']
117
+
118
+ args = info.get_arguments()
119
+ hint_blacklist = ('void',)
120
+
121
+ # Build lists of indices prior to adding the docs because it is possible
122
+ # the index retrieved comes before input arguments being used.
123
+ ignore_indices = {info.get_return_type().get_array_length()}
124
+ user_data_indices = set()
125
+ for arg in args:
126
+ ignore_indices.add(arg.get_destroy())
127
+ ignore_indices.add(arg.get_type().get_array_length())
128
+ user_data_indices.add(arg.get_closure())
129
+
130
+ # Build input argument strings
131
+ for i, arg in enumerate(args):
132
+ if arg.get_direction() == Direction.OUT:
133
+ continue # skip exclusively output args
134
+ if i in ignore_indices:
135
+ continue
136
+ argstr = arg.get_name()
137
+ hint = _get_pytype_hint(arg.get_type())
138
+ if hint not in hint_blacklist:
139
+ argstr += ':' + hint
140
+ if arg.may_be_null() or i in user_data_indices:
141
+ # allow-none or user_data from a closure
142
+ argstr += '=None'
143
+ elif arg.is_optional():
144
+ argstr += '=<optional>'
145
+ in_args_strs.append(argstr)
146
+ in_args_str = ', '.join(in_args_strs)
147
+
148
+ # Build return + output argument strings
149
+ out_args_strs = []
150
+ return_hint = _get_pytype_hint(info.get_return_type())
151
+ if not info.skip_return() and return_hint and return_hint not in hint_blacklist:
152
+ argstr = return_hint
153
+ if info.may_return_null():
154
+ argstr += ' or None'
155
+ out_args_strs.append(argstr)
156
+
157
+ for i, arg in enumerate(args):
158
+ if arg.get_direction() == Direction.IN:
159
+ continue # skip exclusively input args
160
+ if i in ignore_indices:
161
+ continue
162
+ argstr = arg.get_name()
163
+ hint = _get_pytype_hint(arg.get_type())
164
+ if hint not in hint_blacklist:
165
+ argstr += ':' + hint
166
+ out_args_strs.append(argstr)
167
+
168
+ if out_args_strs:
169
+ return '%s(%s) -> %s' % (info.__name__, in_args_str, ', '.join(out_args_strs))
170
+ else:
171
+ return '%s(%s)' % (info.__name__, in_args_str)
172
+
173
+
174
+ def _generate_class_info_doc(info):
175
+ header = '\n:Constructors:\n\n::\n\n' # start with \n to avoid auto indent of other lines
176
+ doc = ''
177
+
178
+ if isinstance(info, StructInfo):
179
+ # Don't show default constructor for disguised (0 length) structs
180
+ if info.get_size() > 0:
181
+ doc += ' ' + info.get_name() + '()\n'
182
+ else:
183
+ doc += ' ' + info.get_name() + '(**properties)\n'
184
+
185
+ for method_info in info.get_methods():
186
+ if method_info.is_constructor():
187
+ doc += ' ' + _generate_callable_info_doc(method_info) + '\n'
188
+
189
+ if doc:
190
+ return header + doc
191
+ else:
192
+ return ''
193
+
194
+
195
+ def _generate_doc_dispatch(info):
196
+ if isinstance(info, (ObjectInfo, StructInfo)):
197
+ return _generate_class_info_doc(info)
198
+
199
+ elif isinstance(info, CallableInfo):
200
+ return _generate_callable_info_doc(info)
201
+
202
+ return ''
203
+
204
+
205
+ set_doc_string_generator(_generate_doc_dispatch)