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.
- gstreamer_python/Lib/girepository-1.0/GdkPixbuf-2.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/HarfBuzz-0.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/Json-1.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/Pango-1.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/PangoCairo-1.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/Soup-3.0.typelib +0 -0
- gstreamer_python/Lib/gstreamer-1.0/gstpython.dll +0 -0
- gstreamer_python/Lib/site-packages/PyGObject-3.50.2.dist-info/METADATA +21 -0
- gstreamer_python/Lib/site-packages/cairo/__init__.py +25 -0
- gstreamer_python/Lib/site-packages/cairo/__init__.pyi +5889 -0
- gstreamer_python/Lib/site-packages/cairo/_cairo.cp39-win32.pyd +0 -0
- gstreamer_python/Lib/site-packages/cairo/include/py3cairo.h +266 -0
- gstreamer_python/Lib/site-packages/cairo/py.typed +0 -0
- gstreamer_python/Lib/site-packages/gi/__init__.py +197 -0
- gstreamer_python/Lib/site-packages/gi/_constants.py +47 -0
- gstreamer_python/Lib/site-packages/gi/_error.py +55 -0
- gstreamer_python/Lib/site-packages/gi/_gi.cp39-win32.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/_gi_cairo.cp39-win32.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/_gtktemplate.py +307 -0
- gstreamer_python/Lib/site-packages/gi/_option.py +379 -0
- gstreamer_python/Lib/site-packages/gi/_ossighelper.py +275 -0
- gstreamer_python/Lib/site-packages/gi/_propertyhelper.py +402 -0
- gstreamer_python/Lib/site-packages/gi/_signalhelper.py +249 -0
- gstreamer_python/Lib/site-packages/gi/docstring.py +205 -0
- gstreamer_python/Lib/site-packages/gi/events.py +674 -0
- gstreamer_python/Lib/site-packages/gi/importer.py +153 -0
- gstreamer_python/Lib/site-packages/gi/module.py +269 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GES.py +94 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GIMarshallingTests.py +72 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GLib.py +882 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GObject.py +692 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gdk.py +444 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GdkPixbuf.py +53 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gio.py +655 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gst.py +1273 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstAnalytics.py +106 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstApp.py +50 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstAudio.py +18 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstPbutils.py +99 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstVideo.py +17 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gtk.py +1707 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Pango.py +58 -0
- gstreamer_python/Lib/site-packages/gi/overrides/__init__.py +357 -0
- gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst.cp39-win32.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst_analytics.cp39-win32.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/overrides/keysyms.py +53 -0
- gstreamer_python/Lib/site-packages/gi/pygtkcompat.py +26 -0
- gstreamer_python/Lib/site-packages/gi/repository/__init__.py +28 -0
- gstreamer_python/Lib/site-packages/gi/types.py +350 -0
- gstreamer_python/Lib/site-packages/pycairo-1.27.0.dist-info/METADATA +9 -0
- gstreamer_python/__init__.py +32 -0
- gstreamer_python-1.27.90.dist-info/METADATA +26 -0
- gstreamer_python-1.27.90.dist-info/RECORD +55 -0
- gstreamer_python-1.27.90.dist-info/WHEEL +5 -0
- gstreamer_python-1.27.90.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
# -*- Mode: Python; py-indent-offset: 4 -*-
|
|
2
|
+
# vim: tabstop=4 shiftwidth=4 expandtab
|
|
3
|
+
#
|
|
4
|
+
# Copyright (C) 2009 Johan Dahlin <johan@gnome.org>
|
|
5
|
+
# 2010 Simon van der Linden <svdlinden@src.gnome.org>
|
|
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, write to the Free Software
|
|
19
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
20
|
+
# USA
|
|
21
|
+
|
|
22
|
+
import sys
|
|
23
|
+
import warnings
|
|
24
|
+
|
|
25
|
+
from ..overrides import override, strip_boolean_result
|
|
26
|
+
from ..module import get_introspection_module
|
|
27
|
+
from gi import PyGIDeprecationWarning, require_version
|
|
28
|
+
|
|
29
|
+
Gdk = get_introspection_module('Gdk')
|
|
30
|
+
GDK3 = Gdk._version == '3.0'
|
|
31
|
+
GDK4 = Gdk._version == '4.0'
|
|
32
|
+
|
|
33
|
+
__all__ = []
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# https://bugzilla.gnome.org/show_bug.cgi?id=673396
|
|
37
|
+
try:
|
|
38
|
+
require_version("GdkX11", Gdk._version)
|
|
39
|
+
from gi.repository import GdkX11
|
|
40
|
+
GdkX11 # pyflakes
|
|
41
|
+
except (ValueError, ImportError):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
if GDK3:
|
|
45
|
+
# Gdk.Color was deprecated since 3.14 and dropped in Gtk-4.0
|
|
46
|
+
class Color(Gdk.Color):
|
|
47
|
+
MAX_VALUE = 65535
|
|
48
|
+
|
|
49
|
+
def __init__(self, red, green, blue):
|
|
50
|
+
Gdk.Color.__init__(self)
|
|
51
|
+
self.red = red
|
|
52
|
+
self.green = green
|
|
53
|
+
self.blue = blue
|
|
54
|
+
|
|
55
|
+
def __eq__(self, other):
|
|
56
|
+
if not isinstance(other, Gdk.Color):
|
|
57
|
+
return False
|
|
58
|
+
return self.equal(other)
|
|
59
|
+
|
|
60
|
+
# This is required (even when __eq__ is defined) in order
|
|
61
|
+
# for != operator to work as expected
|
|
62
|
+
def __ne__(self, other):
|
|
63
|
+
return not self == other
|
|
64
|
+
|
|
65
|
+
def __repr__(self):
|
|
66
|
+
return 'Gdk.Color(red=%d, green=%d, blue=%d)' % (self.red, self.green, self.blue)
|
|
67
|
+
|
|
68
|
+
red_float = property(fget=lambda self: self.red / float(self.MAX_VALUE),
|
|
69
|
+
fset=lambda self, v: setattr(self, 'red', int(v * self.MAX_VALUE)))
|
|
70
|
+
|
|
71
|
+
green_float = property(fget=lambda self: self.green / float(self.MAX_VALUE),
|
|
72
|
+
fset=lambda self, v: setattr(self, 'green', int(v * self.MAX_VALUE)))
|
|
73
|
+
|
|
74
|
+
blue_float = property(fget=lambda self: self.blue / float(self.MAX_VALUE),
|
|
75
|
+
fset=lambda self, v: setattr(self, 'blue', int(v * self.MAX_VALUE)))
|
|
76
|
+
|
|
77
|
+
def to_floats(self):
|
|
78
|
+
"""Return (red_float, green_float, blue_float) triple."""
|
|
79
|
+
|
|
80
|
+
return (self.red_float, self.green_float, self.blue_float)
|
|
81
|
+
|
|
82
|
+
@staticmethod
|
|
83
|
+
def from_floats(red, green, blue):
|
|
84
|
+
"""Return a new Color object from red/green/blue values from 0.0 to 1.0."""
|
|
85
|
+
|
|
86
|
+
return Color(int(red * Color.MAX_VALUE),
|
|
87
|
+
int(green * Color.MAX_VALUE),
|
|
88
|
+
int(blue * Color.MAX_VALUE))
|
|
89
|
+
|
|
90
|
+
Color = override(Color)
|
|
91
|
+
__all__.append('Color')
|
|
92
|
+
|
|
93
|
+
if GDK3:
|
|
94
|
+
# Introduced since Gtk-3.0
|
|
95
|
+
class RGBA(Gdk.RGBA):
|
|
96
|
+
def __init__(self, red=1.0, green=1.0, blue=1.0, alpha=1.0):
|
|
97
|
+
Gdk.RGBA.__init__(self)
|
|
98
|
+
self.red = red
|
|
99
|
+
self.green = green
|
|
100
|
+
self.blue = blue
|
|
101
|
+
self.alpha = alpha
|
|
102
|
+
|
|
103
|
+
def __eq__(self, other):
|
|
104
|
+
if not isinstance(other, Gdk.RGBA):
|
|
105
|
+
return False
|
|
106
|
+
return self.equal(other)
|
|
107
|
+
|
|
108
|
+
# This is required (even when __eq__ is defined) in order
|
|
109
|
+
# for != operator to work as expected
|
|
110
|
+
def __ne__(self, other):
|
|
111
|
+
return not self == other
|
|
112
|
+
|
|
113
|
+
def __repr__(self):
|
|
114
|
+
return 'Gdk.RGBA(red=%f, green=%f, blue=%f, alpha=%f)' % (self.red, self.green, self.blue, self.alpha)
|
|
115
|
+
|
|
116
|
+
def __iter__(self):
|
|
117
|
+
"""Iterator which allows easy conversion to tuple and list types."""
|
|
118
|
+
|
|
119
|
+
yield self.red
|
|
120
|
+
yield self.green
|
|
121
|
+
yield self.blue
|
|
122
|
+
yield self.alpha
|
|
123
|
+
|
|
124
|
+
def to_color(self):
|
|
125
|
+
"""Converts this RGBA into a Color instance which excludes alpha."""
|
|
126
|
+
|
|
127
|
+
return Color(int(self.red * Color.MAX_VALUE),
|
|
128
|
+
int(self.green * Color.MAX_VALUE),
|
|
129
|
+
int(self.blue * Color.MAX_VALUE))
|
|
130
|
+
|
|
131
|
+
@classmethod
|
|
132
|
+
def from_color(cls, color):
|
|
133
|
+
"""Returns a new RGBA instance given a Color instance."""
|
|
134
|
+
|
|
135
|
+
return cls(color.red_float, color.green_float, color.blue_float)
|
|
136
|
+
|
|
137
|
+
RGBA = override(RGBA)
|
|
138
|
+
__all__.append('RGBA')
|
|
139
|
+
|
|
140
|
+
if GDK3:
|
|
141
|
+
# Newer GTK/gobject-introspection (3.17.x) include GdkRectangle in the
|
|
142
|
+
# typelib. See https://bugzilla.gnome.org/show_bug.cgi?id=748832 and
|
|
143
|
+
# https://bugzilla.gnome.org/show_bug.cgi?id=748833
|
|
144
|
+
if not hasattr(Gdk, 'Rectangle'):
|
|
145
|
+
from gi.repository import cairo as _cairo
|
|
146
|
+
Rectangle = _cairo.RectangleInt
|
|
147
|
+
|
|
148
|
+
__all__.append('Rectangle')
|
|
149
|
+
else:
|
|
150
|
+
# https://bugzilla.gnome.org/show_bug.cgi?id=756364
|
|
151
|
+
# These methods used to be functions, keep aliases for backwards compat
|
|
152
|
+
rectangle_intersect = Gdk.Rectangle.intersect
|
|
153
|
+
rectangle_union = Gdk.Rectangle.union
|
|
154
|
+
|
|
155
|
+
__all__.append('rectangle_intersect')
|
|
156
|
+
__all__.append('rectangle_union')
|
|
157
|
+
|
|
158
|
+
if GDK3:
|
|
159
|
+
class Window(Gdk.Window):
|
|
160
|
+
def __new__(cls, parent, attributes, attributes_mask):
|
|
161
|
+
# Gdk.Window had to be made abstract,
|
|
162
|
+
# this override allows using the standard constructor
|
|
163
|
+
return Gdk.Window.new(parent, attributes, attributes_mask)
|
|
164
|
+
|
|
165
|
+
def __init__(self, parent, attributes, attributes_mask):
|
|
166
|
+
pass
|
|
167
|
+
|
|
168
|
+
def cairo_create(self):
|
|
169
|
+
return Gdk.cairo_create(self)
|
|
170
|
+
|
|
171
|
+
Window = override(Window)
|
|
172
|
+
__all__.append('Window')
|
|
173
|
+
|
|
174
|
+
if GDK3:
|
|
175
|
+
Gdk.EventType._2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS")
|
|
176
|
+
Gdk.EventType._3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS")
|
|
177
|
+
|
|
178
|
+
class Event(Gdk.Event):
|
|
179
|
+
_UNION_MEMBERS = {
|
|
180
|
+
Gdk.EventType.DELETE: 'any',
|
|
181
|
+
Gdk.EventType.DESTROY: 'any',
|
|
182
|
+
Gdk.EventType.MOTION_NOTIFY: 'motion',
|
|
183
|
+
Gdk.EventType.BUTTON_PRESS: 'button',
|
|
184
|
+
Gdk.EventType.BUTTON_RELEASE: 'button',
|
|
185
|
+
Gdk.EventType.KEY_PRESS: 'key',
|
|
186
|
+
Gdk.EventType.KEY_RELEASE: 'key',
|
|
187
|
+
Gdk.EventType.ENTER_NOTIFY: 'crossing',
|
|
188
|
+
Gdk.EventType.LEAVE_NOTIFY: 'crossing',
|
|
189
|
+
Gdk.EventType.FOCUS_CHANGE: 'focus_change',
|
|
190
|
+
Gdk.EventType.CONFIGURE: 'configure',
|
|
191
|
+
Gdk.EventType.PROXIMITY_IN: 'proximity',
|
|
192
|
+
Gdk.EventType.PROXIMITY_OUT: 'proximity',
|
|
193
|
+
Gdk.EventType.DRAG_ENTER: 'dnd',
|
|
194
|
+
Gdk.EventType.DRAG_LEAVE: 'dnd',
|
|
195
|
+
Gdk.EventType.DRAG_MOTION: 'dnd',
|
|
196
|
+
Gdk.EventType.DROP_START: 'dnd',
|
|
197
|
+
Gdk.EventType._2BUTTON_PRESS: 'button',
|
|
198
|
+
Gdk.EventType._3BUTTON_PRESS: 'button',
|
|
199
|
+
Gdk.EventType.PROPERTY_NOTIFY: 'property',
|
|
200
|
+
Gdk.EventType.SELECTION_CLEAR: 'selection',
|
|
201
|
+
Gdk.EventType.SELECTION_REQUEST: 'selection',
|
|
202
|
+
Gdk.EventType.SELECTION_NOTIFY: 'selection',
|
|
203
|
+
Gdk.EventType.DRAG_STATUS: 'dnd',
|
|
204
|
+
Gdk.EventType.DROP_FINISHED: 'dnd',
|
|
205
|
+
Gdk.EventType.CLIENT_EVENT: 'client',
|
|
206
|
+
Gdk.EventType.VISIBILITY_NOTIFY: 'visibility',
|
|
207
|
+
Gdk.EventType.SCROLL: 'scroll',
|
|
208
|
+
Gdk.EventType.EXPOSE: 'expose',
|
|
209
|
+
Gdk.EventType.MAP: 'any',
|
|
210
|
+
Gdk.EventType.UNMAP: 'any',
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if hasattr(Gdk.EventType, 'TOUCH_BEGIN'):
|
|
214
|
+
_UNION_MEMBERS.update(
|
|
215
|
+
{
|
|
216
|
+
Gdk.EventType.TOUCH_BEGIN: 'touch',
|
|
217
|
+
Gdk.EventType.TOUCH_UPDATE: 'touch',
|
|
218
|
+
Gdk.EventType.TOUCH_END: 'touch',
|
|
219
|
+
Gdk.EventType.TOUCH_CANCEL: 'touch',
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
def __getattr__(self, name):
|
|
223
|
+
real_event = getattr(self, '_UNION_MEMBERS').get(self.type)
|
|
224
|
+
if real_event:
|
|
225
|
+
return getattr(getattr(self, real_event), name)
|
|
226
|
+
else:
|
|
227
|
+
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
|
|
228
|
+
|
|
229
|
+
def __setattr__(self, name, value):
|
|
230
|
+
real_event = getattr(self, '_UNION_MEMBERS').get(self.type)
|
|
231
|
+
if real_event:
|
|
232
|
+
setattr(getattr(self, real_event), name, value)
|
|
233
|
+
else:
|
|
234
|
+
Gdk.Event.__setattr__(self, name, value)
|
|
235
|
+
|
|
236
|
+
def __repr__(self):
|
|
237
|
+
base_repr = Gdk.Event.__repr__(self).strip("><")
|
|
238
|
+
return "<%s type=%r>" % (base_repr, self.type)
|
|
239
|
+
|
|
240
|
+
Event = override(Event)
|
|
241
|
+
__all__.append('Event')
|
|
242
|
+
|
|
243
|
+
# manually bind GdkEvent members to GdkEvent
|
|
244
|
+
|
|
245
|
+
modname = globals()['__name__']
|
|
246
|
+
module = sys.modules[modname]
|
|
247
|
+
|
|
248
|
+
# right now we can't get the type_info from the
|
|
249
|
+
# field info so manually list the class names
|
|
250
|
+
event_member_classes = ['EventAny',
|
|
251
|
+
'EventExpose',
|
|
252
|
+
'EventMotion',
|
|
253
|
+
'EventButton',
|
|
254
|
+
'EventScroll',
|
|
255
|
+
'EventKey',
|
|
256
|
+
'EventCrossing',
|
|
257
|
+
'EventFocus',
|
|
258
|
+
'EventConfigure',
|
|
259
|
+
'EventProximity',
|
|
260
|
+
'EventDND',
|
|
261
|
+
'EventSetting',
|
|
262
|
+
'EventGrabBroken',
|
|
263
|
+
'EventVisibility',
|
|
264
|
+
'EventProperty',
|
|
265
|
+
'EventSelection',
|
|
266
|
+
'EventOwnerChange',
|
|
267
|
+
'EventWindowState',
|
|
268
|
+
'EventVisibility']
|
|
269
|
+
|
|
270
|
+
if hasattr(Gdk, 'EventTouch'):
|
|
271
|
+
event_member_classes.append('EventTouch')
|
|
272
|
+
|
|
273
|
+
# whitelist all methods that have a success return we want to mask
|
|
274
|
+
gsuccess_mask_funcs = ['get_state',
|
|
275
|
+
'get_axis',
|
|
276
|
+
'get_coords',
|
|
277
|
+
'get_root_coords']
|
|
278
|
+
|
|
279
|
+
for event_class in event_member_classes:
|
|
280
|
+
override_class = type(event_class, (getattr(Gdk, event_class),), {})
|
|
281
|
+
# add the event methods
|
|
282
|
+
for method_info in Gdk.Event.__info__.get_methods():
|
|
283
|
+
name = method_info.get_name()
|
|
284
|
+
event_method = getattr(Gdk.Event, name)
|
|
285
|
+
|
|
286
|
+
# use the _gsuccess_mask decorator if this method is whitelisted
|
|
287
|
+
if name in gsuccess_mask_funcs:
|
|
288
|
+
event_method = strip_boolean_result(event_method)
|
|
289
|
+
setattr(override_class, name, event_method)
|
|
290
|
+
|
|
291
|
+
setattr(module, event_class, override_class)
|
|
292
|
+
__all__.append(event_class)
|
|
293
|
+
|
|
294
|
+
# end GdkEvent overrides
|
|
295
|
+
|
|
296
|
+
class DragContext(Gdk.DragContext):
|
|
297
|
+
def finish(self, success, del_, time):
|
|
298
|
+
Gtk = get_introspection_module('Gtk')
|
|
299
|
+
Gtk.drag_finish(self, success, del_, time)
|
|
300
|
+
|
|
301
|
+
DragContext = override(DragContext)
|
|
302
|
+
__all__.append('DragContext')
|
|
303
|
+
|
|
304
|
+
class Cursor(Gdk.Cursor):
|
|
305
|
+
|
|
306
|
+
def __new__(cls, *args, **kwds):
|
|
307
|
+
arg_len = len(args)
|
|
308
|
+
kwd_len = len(kwds)
|
|
309
|
+
total_len = arg_len + kwd_len
|
|
310
|
+
|
|
311
|
+
if total_len == 1:
|
|
312
|
+
# Since g_object_newv (super.__new__) does not seem valid for
|
|
313
|
+
# direct use with GdkCursor, we must assume usage of at least
|
|
314
|
+
# one of the C constructors to be valid.
|
|
315
|
+
return cls.new(*args, **kwds)
|
|
316
|
+
|
|
317
|
+
elif total_len == 2:
|
|
318
|
+
warnings.warn('Calling "Gdk.Cursor(display, cursor_type)" has been deprecated. '
|
|
319
|
+
'Please use Gdk.Cursor.new_for_display(display, cursor_type). '
|
|
320
|
+
'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations',
|
|
321
|
+
PyGIDeprecationWarning)
|
|
322
|
+
return cls.new_for_display(*args, **kwds)
|
|
323
|
+
|
|
324
|
+
elif total_len == 4:
|
|
325
|
+
warnings.warn('Calling "Gdk.Cursor(display, pixbuf, x, y)" has been deprecated. '
|
|
326
|
+
'Please use Gdk.Cursor.new_from_pixbuf(display, pixbuf, x, y). '
|
|
327
|
+
'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations',
|
|
328
|
+
PyGIDeprecationWarning)
|
|
329
|
+
return cls.new_from_pixbuf(*args, **kwds)
|
|
330
|
+
|
|
331
|
+
else:
|
|
332
|
+
raise ValueError("Wrong number of parameters")
|
|
333
|
+
|
|
334
|
+
Cursor = override(Cursor)
|
|
335
|
+
__all__.append('Cursor')
|
|
336
|
+
|
|
337
|
+
# Gdk.Color was deprecated since 3.14 and dropped in Gtk-4.0
|
|
338
|
+
color_parse = strip_boolean_result(Gdk.color_parse)
|
|
339
|
+
__all__.append('color_parse')
|
|
340
|
+
|
|
341
|
+
# Note, we cannot override the entire class as Gdk.Atom has no gtype, so just
|
|
342
|
+
# hack some individual methods
|
|
343
|
+
def _gdk_atom_str(atom):
|
|
344
|
+
n = atom.name()
|
|
345
|
+
if n:
|
|
346
|
+
return n
|
|
347
|
+
# fall back to atom index
|
|
348
|
+
return 'Gdk.Atom<%i>' % hash(atom)
|
|
349
|
+
|
|
350
|
+
def _gdk_atom_repr(atom):
|
|
351
|
+
n = atom.name()
|
|
352
|
+
if n:
|
|
353
|
+
return 'Gdk.Atom.intern("%s", False)' % n
|
|
354
|
+
# fall back to atom index
|
|
355
|
+
return '<Gdk.Atom(%i)>' % hash(atom)
|
|
356
|
+
|
|
357
|
+
Gdk.Atom.__str__ = _gdk_atom_str
|
|
358
|
+
Gdk.Atom.__repr__ = _gdk_atom_repr
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
if GDK4:
|
|
362
|
+
from gi.repository import Gio
|
|
363
|
+
|
|
364
|
+
class FileList(Gdk.FileList):
|
|
365
|
+
|
|
366
|
+
if hasattr(Gdk.FileList, "new_from_list"):
|
|
367
|
+
def __new__(cls, files):
|
|
368
|
+
files_list = []
|
|
369
|
+
if isinstance(files, (tuple, list)):
|
|
370
|
+
for f in files:
|
|
371
|
+
if isinstance(f, Gio.File):
|
|
372
|
+
files_list.append(f)
|
|
373
|
+
else:
|
|
374
|
+
raise TypeError('Constructor requires a list or tuple of Gio.File instances')
|
|
375
|
+
else:
|
|
376
|
+
raise TypeError('Constructor requires a list or tuple of Gio.File instances')
|
|
377
|
+
return Gdk.FileList.new_from_list(files)
|
|
378
|
+
|
|
379
|
+
def __iter__(self):
|
|
380
|
+
return iter(self.get_files())
|
|
381
|
+
|
|
382
|
+
def __len__(self):
|
|
383
|
+
return len(self.get_files())
|
|
384
|
+
|
|
385
|
+
def __getitem__(self, index):
|
|
386
|
+
return self.get_files()[index]
|
|
387
|
+
|
|
388
|
+
FileList = override(FileList)
|
|
389
|
+
__all__.append('FileList')
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
# constants
|
|
393
|
+
if GDK3:
|
|
394
|
+
SELECTION_PRIMARY = Gdk.atom_intern('PRIMARY', True)
|
|
395
|
+
__all__.append('SELECTION_PRIMARY')
|
|
396
|
+
|
|
397
|
+
SELECTION_SECONDARY = Gdk.atom_intern('SECONDARY', True)
|
|
398
|
+
__all__.append('SELECTION_SECONDARY')
|
|
399
|
+
|
|
400
|
+
SELECTION_CLIPBOARD = Gdk.atom_intern('CLIPBOARD', True)
|
|
401
|
+
__all__.append('SELECTION_CLIPBOARD')
|
|
402
|
+
|
|
403
|
+
TARGET_BITMAP = Gdk.atom_intern('BITMAP', True)
|
|
404
|
+
__all__.append('TARGET_BITMAP')
|
|
405
|
+
|
|
406
|
+
TARGET_COLORMAP = Gdk.atom_intern('COLORMAP', True)
|
|
407
|
+
__all__.append('TARGET_COLORMAP')
|
|
408
|
+
|
|
409
|
+
TARGET_DRAWABLE = Gdk.atom_intern('DRAWABLE', True)
|
|
410
|
+
__all__.append('TARGET_DRAWABLE')
|
|
411
|
+
|
|
412
|
+
TARGET_PIXMAP = Gdk.atom_intern('PIXMAP', True)
|
|
413
|
+
__all__.append('TARGET_PIXMAP')
|
|
414
|
+
|
|
415
|
+
TARGET_STRING = Gdk.atom_intern('STRING', True)
|
|
416
|
+
__all__.append('TARGET_STRING')
|
|
417
|
+
|
|
418
|
+
SELECTION_TYPE_ATOM = Gdk.atom_intern('ATOM', True)
|
|
419
|
+
__all__.append('SELECTION_TYPE_ATOM')
|
|
420
|
+
|
|
421
|
+
SELECTION_TYPE_BITMAP = Gdk.atom_intern('BITMAP', True)
|
|
422
|
+
__all__.append('SELECTION_TYPE_BITMAP')
|
|
423
|
+
|
|
424
|
+
SELECTION_TYPE_COLORMAP = Gdk.atom_intern('COLORMAP', True)
|
|
425
|
+
__all__.append('SELECTION_TYPE_COLORMAP')
|
|
426
|
+
|
|
427
|
+
SELECTION_TYPE_DRAWABLE = Gdk.atom_intern('DRAWABLE', True)
|
|
428
|
+
__all__.append('SELECTION_TYPE_DRAWABLE')
|
|
429
|
+
|
|
430
|
+
SELECTION_TYPE_INTEGER = Gdk.atom_intern('INTEGER', True)
|
|
431
|
+
__all__.append('SELECTION_TYPE_INTEGER')
|
|
432
|
+
|
|
433
|
+
SELECTION_TYPE_PIXMAP = Gdk.atom_intern('PIXMAP', True)
|
|
434
|
+
__all__.append('SELECTION_TYPE_PIXMAP')
|
|
435
|
+
|
|
436
|
+
SELECTION_TYPE_WINDOW = Gdk.atom_intern('WINDOW', True)
|
|
437
|
+
__all__.append('SELECTION_TYPE_WINDOW')
|
|
438
|
+
|
|
439
|
+
SELECTION_TYPE_STRING = Gdk.atom_intern('STRING', True)
|
|
440
|
+
__all__.append('SELECTION_TYPE_STRING')
|
|
441
|
+
|
|
442
|
+
if GDK3:
|
|
443
|
+
import sys
|
|
444
|
+
initialized, argv = Gdk.init_check(sys.argv)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Copyright 2018 Christoph Reiter <reiter.christoph@gmail.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
16
|
+
# USA
|
|
17
|
+
|
|
18
|
+
import warnings
|
|
19
|
+
|
|
20
|
+
from gi import PyGIDeprecationWarning
|
|
21
|
+
from gi.repository import GLib
|
|
22
|
+
|
|
23
|
+
from ..overrides import override
|
|
24
|
+
from ..module import get_introspection_module
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
GdkPixbuf = get_introspection_module('GdkPixbuf')
|
|
28
|
+
__all__ = []
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@override
|
|
32
|
+
class Pixbuf(GdkPixbuf.Pixbuf):
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def new_from_data(
|
|
36
|
+
cls, data, colorspace, has_alpha, bits_per_sample,
|
|
37
|
+
width, height, rowstride,
|
|
38
|
+
destroy_fn=None, *destroy_fn_data):
|
|
39
|
+
|
|
40
|
+
if destroy_fn is not None:
|
|
41
|
+
w = PyGIDeprecationWarning("destroy_fn argument deprecated")
|
|
42
|
+
warnings.warn(w)
|
|
43
|
+
if destroy_fn_data:
|
|
44
|
+
w = PyGIDeprecationWarning("destroy_fn_data argument deprecated")
|
|
45
|
+
warnings.warn(w)
|
|
46
|
+
|
|
47
|
+
data = GLib.Bytes.new(data)
|
|
48
|
+
return cls.new_from_bytes(
|
|
49
|
+
data, colorspace, has_alpha, bits_per_sample,
|
|
50
|
+
width, height, rowstride)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
__all__.append('Pixbuf')
|