cutienator 0.0.1.dev0__py3-none-any.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.
- cutienator/__init__.py +44 -0
- cutienator/_cpp_addr.py +84 -0
- cutienator/_cpp_box.py +23 -0
- cutienator/_cute_load_hook.py +159 -0
- cutienator/_cute_mixin.py +166 -0
- cutienator/_cute_overload.py +285 -0
- cutienator/_cute_space.py +727 -0
- cutienator/_header_descriptor.py +4 -0
- cutienator/_meta_cute.py +444 -0
- cutienator/_q_binding_storage.py +101 -0
- cutienator/_q_event.py +185 -0
- cutienator/_q_meta_object.py +118 -0
- cutienator/_q_object.py +582 -0
- cutienator/_q_thread.py +106 -0
- cutienator/_q_widget.py +80 -0
- cutienator/_ugly.py +296 -0
- cutienator/_wait.py +303 -0
- cutienator/_waiting_overload.py +261 -0
- cutienator/example/__init__.py +21 -0
- cutienator/example/__main__.py +67 -0
- cutienator/example/_calls.py +107 -0
- cutienator/occult/__init__.py +27 -0
- cutienator/occult/__main__.py +50 -0
- cutienator/occult/_base_meta_ugly.py +29 -0
- cutienator/occult/_build.py +561 -0
- cutienator/occult/_cognito_warning.py +35 -0
- cutienator/occult/_declaration.py +572 -0
- cutienator/occult/_header.py +710 -0
- cutienator/occult/_ritual.py +19 -0
- cutienator/occult/_rituals.py +594 -0
- cutienator/occult/_shared_object.py +292 -0
- cutienator/occult/_symbol.py +162 -0
- cutienator/occult/rituals/q_event.cpp +70 -0
- cutienator/occult/rituals/q_meta_object.cpp +173 -0
- cutienator/occult/rituals/q_object.cpp +178 -0
- cutienator/trial/__init__.py +25 -0
- cutienator/trial/__main__.py +59 -0
- cutienator/trial/_judge.py +589 -0
- cutienator/trial/_q_object_trials.py +38 -0
- cutienator/trial/_trial.py +495 -0
- cutienator/trial/_verdict.py +332 -0
- cutienator-0.0.1.dev0.dist-info/METADATA +33 -0
- cutienator-0.0.1.dev0.dist-info/RECORD +46 -0
- cutienator-0.0.1.dev0.dist-info/WHEEL +5 -0
- cutienator-0.0.1.dev0.dist-info/licenses/LICENSE +201 -0
- cutienator-0.0.1.dev0.dist-info/top_level.txt +1 -0
cutienator/_q_object.py
ADDED
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QObject binding of the Qt C++
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from worktoy.core.sentinels import THIS
|
|
11
|
+
from worktoy.dispatch import overload
|
|
12
|
+
|
|
13
|
+
from ._cute_mixin import CuteMixin
|
|
14
|
+
from ._meta_cute import MetaCute
|
|
15
|
+
from ._q_binding_storage import QBindingStorage
|
|
16
|
+
from ._q_event import QEvent
|
|
17
|
+
from ._q_meta_object import QMetaObject
|
|
18
|
+
from ._ugly import Ugly
|
|
19
|
+
from ._wait import WAIT
|
|
20
|
+
from .occult import Rituals
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
23
|
+
from typing import Optional
|
|
24
|
+
|
|
25
|
+
# The class of None, for a signature that takes None in the place of an
|
|
26
|
+
# object or of text.
|
|
27
|
+
NoneType = type(None)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class QObject(CuteMixin, metaclass=MetaCute):
|
|
31
|
+
"""
|
|
32
|
+
The cute side of Qt's QObject: a plain Python object standing in front
|
|
33
|
+
of one C++ QObject.
|
|
34
|
+
|
|
35
|
+
mother = QObject()
|
|
36
|
+
child = QObject(mother)
|
|
37
|
+
child.parent() is mother # True
|
|
38
|
+
child.metaObject().className() # 'QObject'
|
|
39
|
+
child.thread() # the QThread Python runs in
|
|
40
|
+
|
|
41
|
+
This is the first class written out in full from its ritual file: one
|
|
42
|
+
function here for each ritual in 'occult/rituals/q_object.cpp', with
|
|
43
|
+
the few exceptions listed below. It is written by hand, in the shape a
|
|
44
|
+
program is meant to write the others in.
|
|
45
|
+
|
|
46
|
+
What exists
|
|
47
|
+
-----------
|
|
48
|
+
|
|
49
|
+
Every function of Qt's QObject that has a ritual, 22 names in all:
|
|
50
|
+
'parent', 'setParent', 'thread', 'metaObject', 'bindingStorage',
|
|
51
|
+
'inherits', 'isWidgetType', 'isWindowType', 'isQuickItemType',
|
|
52
|
+
'isQmlExposed', 'signalsBlocked', 'blockSignals', 'event',
|
|
53
|
+
'eventFilter', 'installEventFilter', 'removeEventFilter', 'startTimer',
|
|
54
|
+
'killTimer', 'disconnect', 'dumpObjectTree', 'dumpObjectInfo' and
|
|
55
|
+
'deleteLater'. Creation takes a parent, None, or nothing.
|
|
56
|
+
|
|
57
|
+
What has a ritual and is left out, and why
|
|
58
|
+
------------------------------------------
|
|
59
|
+
|
|
60
|
+
- Qt's '~QObject()'. Python has no name for deleting an object, and a
|
|
61
|
+
cute object whose C++ object is gone has no meaning yet.
|
|
62
|
+
- Qt's 'killTimer(Qt::TimerId id)'. No enum is reflected yet, so it
|
|
63
|
+
would take an 'int', as 'killTimer(int id)' does, and one name
|
|
64
|
+
cannot have two functions for one signature.
|
|
65
|
+
- Qt's 'bindingStorage() const'. It differs from 'bindingStorage()'
|
|
66
|
+
only in what C++ may do with the answer, which Python cannot say.
|
|
67
|
+
- Qt's 'disconnect(sender, signal, receiver, member)'. It is a static
|
|
68
|
+
function, and the other two of that name are not. worktoy lets one
|
|
69
|
+
name be one kind of method.
|
|
70
|
+
|
|
71
|
+
What has no ritual yet
|
|
72
|
+
----------------------
|
|
73
|
+
|
|
74
|
+
52 of the 80 functions Qt declares, among them 'objectName',
|
|
75
|
+
'setObjectName', 'connect', 'children', 'property', 'setProperty',
|
|
76
|
+
'findChild' and 'moveToThread'. Most take or give a type that no
|
|
77
|
+
ritual can pass yet, as Qt's QString.
|
|
78
|
+
|
|
79
|
+
What to expect
|
|
80
|
+
--------------
|
|
81
|
+
|
|
82
|
+
- The C++ QObject is created at the first use, not by 'QObject()'.
|
|
83
|
+
- A function giving an object back gives the very cute object that
|
|
84
|
+
stands for it when there is one, as 'parent' after 'setParent'. For
|
|
85
|
+
an object C++ made itself, as the thread, it gives a new cute object
|
|
86
|
+
made around it.
|
|
87
|
+
- Where Qt takes an object or text and reads nothing as 'none given',
|
|
88
|
+
None is taken. Where Qt fills in an argument left out, that is not
|
|
89
|
+
done yet: every argument is given.
|
|
90
|
+
- An enum of Qt is taken and given as its number.
|
|
91
|
+
- A wrong argument is refused in Python, with 'DispatchException',
|
|
92
|
+
and never reaches C++.
|
|
93
|
+
- Nothing deletes the C++ QObject yet, and nothing notices when C++
|
|
94
|
+
deletes it, which a parent does to its children when it goes.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
98
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
99
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
100
|
+
|
|
101
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
102
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
103
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
104
|
+
|
|
105
|
+
# Class Variables
|
|
106
|
+
# Qt's QThread is built on QObject, so its cute class is made after
|
|
107
|
+
# this one. 'thread' gives one back all the same; see 'WAIT'.
|
|
108
|
+
QThread = WAIT['QThread']
|
|
109
|
+
|
|
110
|
+
# Fallback Variables
|
|
111
|
+
|
|
112
|
+
# Private Variables
|
|
113
|
+
# The parent given to the constructor, kept until the C++ object is
|
|
114
|
+
# created.
|
|
115
|
+
__given_parent__: Optional[QObject] = None
|
|
116
|
+
|
|
117
|
+
# Public Variables
|
|
118
|
+
|
|
119
|
+
# Virtual Variables
|
|
120
|
+
|
|
121
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
122
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
123
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
124
|
+
|
|
125
|
+
def _createUglySide(self, ) -> None:
|
|
126
|
+
"""
|
|
127
|
+
Creates the C++ QObject and the Ugly standing for it.
|
|
128
|
+
|
|
129
|
+
'CuteMixin' calls this at the first read of 'uglySide'. The C++
|
|
130
|
+
QObject is created with the parent given to 'QObject(...)', which is
|
|
131
|
+
created first when it is not yet.
|
|
132
|
+
"""
|
|
133
|
+
# QObject::QObject(QObject *parent)
|
|
134
|
+
parent = self._addressOf(self.__given_parent__)
|
|
135
|
+
ugly = Ugly()
|
|
136
|
+
ugly.setAddress(Rituals.call('ritual_ZN7QObjectC1EPS_', parent))
|
|
137
|
+
ugly.setCuteSide(self)
|
|
138
|
+
self.__ugly_side__ = ugly
|
|
139
|
+
self.__given_parent__ = None
|
|
140
|
+
|
|
141
|
+
def metaObject(self) -> QMetaObject:
|
|
142
|
+
"""
|
|
143
|
+
Calls Qt's 'const QMetaObject *QObject::metaObject() const'.
|
|
144
|
+
|
|
145
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#metaObject
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
|
|
150
|
+
QMetaObject
|
|
151
|
+
The cute object standing for what Qt gave back.
|
|
152
|
+
"""
|
|
153
|
+
# const QMetaObject *QObject::metaObject() const
|
|
154
|
+
address = self.uglySide.call('ritual_ZNK7QObject10metaObjectEv')
|
|
155
|
+
return QMetaObject._cuteAt(address)
|
|
156
|
+
|
|
157
|
+
def isWidgetType(self) -> bool:
|
|
158
|
+
"""
|
|
159
|
+
Calls Qt's 'bool QObject::isWidgetType() const'.
|
|
160
|
+
|
|
161
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#isWidgetType
|
|
162
|
+
"""
|
|
163
|
+
# bool QObject::isWidgetType() const
|
|
164
|
+
return self.uglySide.call('ritual_ZNK7QObject12isWidgetTypeEv')
|
|
165
|
+
|
|
166
|
+
def isWindowType(self) -> bool:
|
|
167
|
+
"""
|
|
168
|
+
Calls Qt's 'bool QObject::isWindowType() const'.
|
|
169
|
+
|
|
170
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#isWindowType
|
|
171
|
+
"""
|
|
172
|
+
# bool QObject::isWindowType() const
|
|
173
|
+
return self.uglySide.call('ritual_ZNK7QObject12isWindowTypeEv')
|
|
174
|
+
|
|
175
|
+
def isQuickItemType(self) -> bool:
|
|
176
|
+
"""
|
|
177
|
+
Calls Qt's 'bool QObject::isQuickItemType() const'.
|
|
178
|
+
|
|
179
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#isQuickItemType
|
|
180
|
+
"""
|
|
181
|
+
# bool QObject::isQuickItemType() const
|
|
182
|
+
return self.uglySide.call('ritual_ZNK7QObject15isQuickItemTypeEv')
|
|
183
|
+
|
|
184
|
+
def isQmlExposed(self) -> bool:
|
|
185
|
+
"""
|
|
186
|
+
Calls Qt's 'bool QObject::isQmlExposed() const'.
|
|
187
|
+
|
|
188
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#isQmlExposed
|
|
189
|
+
"""
|
|
190
|
+
# bool QObject::isQmlExposed() const
|
|
191
|
+
return self.uglySide.call('ritual_ZNK7QObject12isQmlExposedEv')
|
|
192
|
+
|
|
193
|
+
def signalsBlocked(self) -> bool:
|
|
194
|
+
"""
|
|
195
|
+
Calls Qt's 'bool QObject::signalsBlocked() const'.
|
|
196
|
+
|
|
197
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#signalsBlocked
|
|
198
|
+
"""
|
|
199
|
+
# bool QObject::signalsBlocked() const
|
|
200
|
+
return self.uglySide.call('ritual_ZNK7QObject14signalsBlockedEv')
|
|
201
|
+
|
|
202
|
+
def thread(self) -> QThread:
|
|
203
|
+
"""
|
|
204
|
+
Calls Qt's 'QThread *QObject::thread() const'.
|
|
205
|
+
|
|
206
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#thread
|
|
207
|
+
|
|
208
|
+
Returns
|
|
209
|
+
-------
|
|
210
|
+
|
|
211
|
+
QThread
|
|
212
|
+
The cute object standing for what Qt gave back. For an object
|
|
213
|
+
made in the thread Python runs in, that thread is one C++ made
|
|
214
|
+
itself, so a new cute QThread is made around it.
|
|
215
|
+
|
|
216
|
+
Raises
|
|
217
|
+
------
|
|
218
|
+
|
|
219
|
+
MissingVariable
|
|
220
|
+
The cute class 'QThread' is not made yet: its file was never
|
|
221
|
+
imported.
|
|
222
|
+
"""
|
|
223
|
+
# QThread *QObject::thread() const
|
|
224
|
+
address = self.uglySide.call('ritual_ZNK7QObject6threadEv')
|
|
225
|
+
return self.QThread._cuteAt(address)
|
|
226
|
+
|
|
227
|
+
def bindingStorage(self) -> QBindingStorage:
|
|
228
|
+
"""
|
|
229
|
+
Calls Qt's 'QBindingStorage *QObject::bindingStorage()'.
|
|
230
|
+
|
|
231
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#bindingStorage
|
|
232
|
+
|
|
233
|
+
Returns
|
|
234
|
+
-------
|
|
235
|
+
|
|
236
|
+
QBindingStorage
|
|
237
|
+
The cute object standing for what Qt gave back.
|
|
238
|
+
"""
|
|
239
|
+
# QBindingStorage *QObject::bindingStorage()
|
|
240
|
+
address = self.uglySide.call('ritual_ZN7QObject14bindingStorageEv')
|
|
241
|
+
return QBindingStorage._cuteAt(address)
|
|
242
|
+
|
|
243
|
+
def parent(self) -> Optional[QObject]:
|
|
244
|
+
"""
|
|
245
|
+
Calls Qt's 'QObject *QObject::parent() const'.
|
|
246
|
+
|
|
247
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#parent
|
|
248
|
+
|
|
249
|
+
Returns
|
|
250
|
+
-------
|
|
251
|
+
|
|
252
|
+
Optional[QObject]
|
|
253
|
+
The cute object standing for what Qt gave back: the very object
|
|
254
|
+
that was given as the parent, when it still exists. None when Qt
|
|
255
|
+
gave back no object.
|
|
256
|
+
"""
|
|
257
|
+
# QObject *QObject::parent() const
|
|
258
|
+
address = self.uglySide.call('ritual_ZNK7QObject6parentEv')
|
|
259
|
+
return QObject._cuteAt(address)
|
|
260
|
+
|
|
261
|
+
@overload(str)
|
|
262
|
+
def inherits(self, classname: str) -> bool:
|
|
263
|
+
"""
|
|
264
|
+
Calls Qt's 'bool QObject::inherits(const char *classname) const'.
|
|
265
|
+
|
|
266
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#inherits
|
|
267
|
+
|
|
268
|
+
Parameters
|
|
269
|
+
----------
|
|
270
|
+
|
|
271
|
+
classname : str
|
|
272
|
+
Passed on as the bytes of the text.
|
|
273
|
+
"""
|
|
274
|
+
# bool QObject::inherits(const char *classname) const
|
|
275
|
+
return self.uglySide.call(
|
|
276
|
+
'ritual_ZNK7QObject8inheritsEPKc', self._bytesOf(classname),
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
280
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
281
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
282
|
+
|
|
283
|
+
@overload(bool)
|
|
284
|
+
def blockSignals(self, b: bool) -> bool:
|
|
285
|
+
"""
|
|
286
|
+
Calls Qt's 'bool QObject::blockSignals(bool b)'.
|
|
287
|
+
|
|
288
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#blockSignals
|
|
289
|
+
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
|
|
293
|
+
b : bool
|
|
294
|
+
Passed on as it is.
|
|
295
|
+
"""
|
|
296
|
+
# bool QObject::blockSignals(bool b)
|
|
297
|
+
return self.uglySide.call('ritual_ZN7QObject12blockSignalsEb', b)
|
|
298
|
+
|
|
299
|
+
@overload(THIS)
|
|
300
|
+
@overload(NoneType)
|
|
301
|
+
def setParent(self, parent: Optional[QObject]) -> None:
|
|
302
|
+
"""
|
|
303
|
+
Calls Qt's 'void QObject::setParent(QObject *parent)'.
|
|
304
|
+
|
|
305
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#setParent
|
|
306
|
+
|
|
307
|
+
Parameters
|
|
308
|
+
----------
|
|
309
|
+
|
|
310
|
+
parent : Optional[QObject]
|
|
311
|
+
Passed on as the address of its C++ object. None is passed on as
|
|
312
|
+
no object.
|
|
313
|
+
"""
|
|
314
|
+
# void QObject::setParent(QObject *parent)
|
|
315
|
+
self.uglySide.call(
|
|
316
|
+
'ritual_ZN7QObject9setParentEPS_', self._addressOf(parent),
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
320
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
321
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
322
|
+
|
|
323
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
324
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
325
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
326
|
+
|
|
327
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
328
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
329
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
330
|
+
|
|
331
|
+
@overload()
|
|
332
|
+
@overload(THIS)
|
|
333
|
+
@overload(NoneType)
|
|
334
|
+
def __init__(self, parent: Optional[QObject] = None) -> None:
|
|
335
|
+
"""
|
|
336
|
+
Notes the parent for Qt's 'QObject::QObject(QObject *parent)', which
|
|
337
|
+
is called at the first use.
|
|
338
|
+
|
|
339
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#QObject
|
|
340
|
+
|
|
341
|
+
Parameters
|
|
342
|
+
----------
|
|
343
|
+
|
|
344
|
+
parent : Optional[QObject]
|
|
345
|
+
Passed on as the address of its C++ object. None, or nothing at
|
|
346
|
+
all, is passed on as no object.
|
|
347
|
+
"""
|
|
348
|
+
self.__given_parent__ = parent
|
|
349
|
+
|
|
350
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
351
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
352
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
353
|
+
|
|
354
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
355
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
356
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
357
|
+
|
|
358
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
359
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
360
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
361
|
+
|
|
362
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
363
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
364
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
365
|
+
|
|
366
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
367
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
368
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
369
|
+
|
|
370
|
+
@overload(QEvent)
|
|
371
|
+
def event(self, event: QEvent) -> bool:
|
|
372
|
+
"""
|
|
373
|
+
Calls Qt's 'bool QObject::event(QEvent *event)'.
|
|
374
|
+
|
|
375
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#event
|
|
376
|
+
|
|
377
|
+
Parameters
|
|
378
|
+
----------
|
|
379
|
+
|
|
380
|
+
event : QEvent
|
|
381
|
+
Passed on as the address of its C++ object.
|
|
382
|
+
"""
|
|
383
|
+
# bool QObject::event(QEvent *event)
|
|
384
|
+
return self.uglySide.call(
|
|
385
|
+
'ritual_ZN7QObject5eventEP6QEvent', self._addressOf(event),
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
@overload(THIS, QEvent)
|
|
389
|
+
def eventFilter(self, watched: QObject, event: QEvent) -> bool:
|
|
390
|
+
"""
|
|
391
|
+
Calls Qt's 'bool QObject::eventFilter(QObject *watched, QEvent
|
|
392
|
+
*event)'.
|
|
393
|
+
|
|
394
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#eventFilter
|
|
395
|
+
|
|
396
|
+
Parameters
|
|
397
|
+
----------
|
|
398
|
+
|
|
399
|
+
watched : QObject
|
|
400
|
+
Passed on as the address of its C++ object.
|
|
401
|
+
|
|
402
|
+
event : QEvent
|
|
403
|
+
Passed on as the address of its C++ object.
|
|
404
|
+
"""
|
|
405
|
+
# bool QObject::eventFilter(QObject *watched, QEvent *event)
|
|
406
|
+
return self.uglySide.call(
|
|
407
|
+
'ritual_ZN7QObject11eventFilterEPS_P6QEvent',
|
|
408
|
+
self._addressOf(watched), self._addressOf(event),
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
@overload(int, int)
|
|
412
|
+
def startTimer(self, interval: int, timerType: int) -> int:
|
|
413
|
+
"""
|
|
414
|
+
Calls Qt's 'int QObject::startTimer(int interval, Qt::TimerType
|
|
415
|
+
timerType)'.
|
|
416
|
+
|
|
417
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#startTimer
|
|
418
|
+
|
|
419
|
+
Parameters
|
|
420
|
+
----------
|
|
421
|
+
|
|
422
|
+
interval : int
|
|
423
|
+
Passed on as it is.
|
|
424
|
+
|
|
425
|
+
timerType : int
|
|
426
|
+
The number of a 'Qt::TimerType', as 1 for 'Qt::CoarseTimer'.
|
|
427
|
+
Passed on as it is. Qt fills this in when it is left out; here it
|
|
428
|
+
has to be given.
|
|
429
|
+
"""
|
|
430
|
+
# int QObject::startTimer(int interval, Qt::TimerType timerType)
|
|
431
|
+
return self.uglySide.call(
|
|
432
|
+
'ritual_ZN7QObject10startTimerEiN2Qt9TimerTypeE',
|
|
433
|
+
interval, timerType,
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
@overload(int)
|
|
437
|
+
def killTimer(self, id: int) -> None:
|
|
438
|
+
"""
|
|
439
|
+
Calls Qt's 'void QObject::killTimer(int id)'.
|
|
440
|
+
|
|
441
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#killTimer
|
|
442
|
+
|
|
443
|
+
Parameters
|
|
444
|
+
----------
|
|
445
|
+
|
|
446
|
+
id : int
|
|
447
|
+
Passed on as it is.
|
|
448
|
+
"""
|
|
449
|
+
# void QObject::killTimer(int id)
|
|
450
|
+
self.uglySide.call('ritual_ZN7QObject9killTimerEi', id)
|
|
451
|
+
|
|
452
|
+
@overload(THIS)
|
|
453
|
+
def installEventFilter(self, filterObj: QObject) -> None:
|
|
454
|
+
"""
|
|
455
|
+
Calls Qt's 'void QObject::installEventFilter(QObject *filterObj)'.
|
|
456
|
+
|
|
457
|
+
Qt's own words:
|
|
458
|
+
https://doc.qt.io/qt-6/qobject.html#installEventFilter
|
|
459
|
+
|
|
460
|
+
Parameters
|
|
461
|
+
----------
|
|
462
|
+
|
|
463
|
+
filterObj : QObject
|
|
464
|
+
Passed on as the address of its C++ object.
|
|
465
|
+
"""
|
|
466
|
+
# void QObject::installEventFilter(QObject *filterObj)
|
|
467
|
+
self.uglySide.call(
|
|
468
|
+
'ritual_ZN7QObject18installEventFilterEPS_',
|
|
469
|
+
self._addressOf(filterObj),
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
@overload(THIS)
|
|
473
|
+
def removeEventFilter(self, obj: QObject) -> None:
|
|
474
|
+
"""
|
|
475
|
+
Calls Qt's 'void QObject::removeEventFilter(QObject *obj)'.
|
|
476
|
+
|
|
477
|
+
Qt's own words:
|
|
478
|
+
https://doc.qt.io/qt-6/qobject.html#removeEventFilter
|
|
479
|
+
|
|
480
|
+
Parameters
|
|
481
|
+
----------
|
|
482
|
+
|
|
483
|
+
obj : QObject
|
|
484
|
+
Passed on as the address of its C++ object.
|
|
485
|
+
"""
|
|
486
|
+
# void QObject::removeEventFilter(QObject *obj)
|
|
487
|
+
self.uglySide.call(
|
|
488
|
+
'ritual_ZN7QObject17removeEventFilterEPS_', self._addressOf(obj),
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
@overload(str, THIS, str)
|
|
492
|
+
@overload(str, THIS, NoneType)
|
|
493
|
+
@overload(str, NoneType, str)
|
|
494
|
+
@overload(str, NoneType, NoneType)
|
|
495
|
+
@overload(NoneType, THIS, str)
|
|
496
|
+
@overload(NoneType, THIS, NoneType)
|
|
497
|
+
@overload(NoneType, NoneType, str)
|
|
498
|
+
@overload(NoneType, NoneType, NoneType)
|
|
499
|
+
def disconnect(
|
|
500
|
+
self,
|
|
501
|
+
signal: Optional[str],
|
|
502
|
+
receiver: Optional[QObject],
|
|
503
|
+
member: Optional[str],
|
|
504
|
+
) -> bool:
|
|
505
|
+
"""
|
|
506
|
+
Calls Qt's 'bool QObject::disconnect(const char *signal, const
|
|
507
|
+
QObject *receiver, const char *member) const'.
|
|
508
|
+
|
|
509
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#disconnect-2
|
|
510
|
+
|
|
511
|
+
Parameters
|
|
512
|
+
----------
|
|
513
|
+
|
|
514
|
+
signal : Optional[str]
|
|
515
|
+
Passed on as the bytes of the text. None is passed on as no text.
|
|
516
|
+
|
|
517
|
+
receiver : Optional[QObject]
|
|
518
|
+
Passed on as the address of its C++ object. None is passed on as
|
|
519
|
+
no object.
|
|
520
|
+
|
|
521
|
+
member : Optional[str]
|
|
522
|
+
Passed on as the bytes of the text. None is passed on as no text.
|
|
523
|
+
"""
|
|
524
|
+
# bool QObject::disconnect(const char *signal,
|
|
525
|
+
# const QObject *receiver, const char *member) const
|
|
526
|
+
return self.uglySide.call(
|
|
527
|
+
'ritual_ZNK7QObject10disconnectEPKcPKS_S1_',
|
|
528
|
+
self._bytesOf(signal), self._addressOf(receiver),
|
|
529
|
+
self._bytesOf(member),
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
@overload(THIS, str)
|
|
533
|
+
@overload(THIS, NoneType)
|
|
534
|
+
def disconnect(self, receiver: QObject, member: Optional[str]) -> bool:
|
|
535
|
+
"""
|
|
536
|
+
Calls Qt's 'bool QObject::disconnect(const QObject *receiver, const
|
|
537
|
+
char *member) const'.
|
|
538
|
+
|
|
539
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#disconnect-3
|
|
540
|
+
|
|
541
|
+
Parameters
|
|
542
|
+
----------
|
|
543
|
+
|
|
544
|
+
receiver : QObject
|
|
545
|
+
Passed on as the address of its C++ object.
|
|
546
|
+
|
|
547
|
+
member : Optional[str]
|
|
548
|
+
Passed on as the bytes of the text. None is passed on as no text.
|
|
549
|
+
"""
|
|
550
|
+
# bool QObject::disconnect(const QObject *receiver,
|
|
551
|
+
# const char *member) const
|
|
552
|
+
return self.uglySide.call(
|
|
553
|
+
'ritual_ZNK7QObject10disconnectEPKS_PKc',
|
|
554
|
+
self._addressOf(receiver), self._bytesOf(member),
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
def dumpObjectTree(self) -> None:
|
|
558
|
+
"""
|
|
559
|
+
Calls Qt's 'void QObject::dumpObjectTree() const'.
|
|
560
|
+
|
|
561
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#dumpObjectTree
|
|
562
|
+
"""
|
|
563
|
+
# void QObject::dumpObjectTree() const
|
|
564
|
+
self.uglySide.call('ritual_ZNK7QObject14dumpObjectTreeEv')
|
|
565
|
+
|
|
566
|
+
def dumpObjectInfo(self) -> None:
|
|
567
|
+
"""
|
|
568
|
+
Calls Qt's 'void QObject::dumpObjectInfo() const'.
|
|
569
|
+
|
|
570
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#dumpObjectInfo
|
|
571
|
+
"""
|
|
572
|
+
# void QObject::dumpObjectInfo() const
|
|
573
|
+
self.uglySide.call('ritual_ZNK7QObject14dumpObjectInfoEv')
|
|
574
|
+
|
|
575
|
+
def deleteLater(self) -> None:
|
|
576
|
+
"""
|
|
577
|
+
Calls Qt's 'void QObject::deleteLater()'.
|
|
578
|
+
|
|
579
|
+
Qt's own words: https://doc.qt.io/qt-6/qobject.html#deleteLater
|
|
580
|
+
"""
|
|
581
|
+
# void QObject::deleteLater()
|
|
582
|
+
self.uglySide.call('ritual_ZN7QObject11deleteLaterEv')
|
cutienator/_q_thread.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QThread binding of the Qt C++, so far in name only.
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from ._q_object import QObject
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class QThread(QObject):
|
|
12
|
+
"""
|
|
13
|
+
The cute side of Qt's QThread, so far in name only. It exists
|
|
14
|
+
because 'QObject.thread()' gives one back, and a cute function can
|
|
15
|
+
only give back an object of a cute class.
|
|
16
|
+
|
|
17
|
+
thread = QObject().thread() # the QThread Python runs in
|
|
18
|
+
thread.parent() # all of QObject works on it
|
|
19
|
+
|
|
20
|
+
What exists so far
|
|
21
|
+
------------------
|
|
22
|
+
|
|
23
|
+
- Everything 'QObject' has, since Qt's QThread is built on QObject.
|
|
24
|
+
- Nothing of its own: no function of Qt's QThread is reflected yet,
|
|
25
|
+
and none can be made from Python.
|
|
26
|
+
|
|
27
|
+
What to expect
|
|
28
|
+
--------------
|
|
29
|
+
|
|
30
|
+
'QObject' is made before this class and waits for it, with the line
|
|
31
|
+
'QThread = WAIT['QThread']' in its body. Making this class is what
|
|
32
|
+
settles that: from here on 'QObject.QThread' is this class.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
36
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
37
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
38
|
+
|
|
39
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
40
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
41
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
42
|
+
|
|
43
|
+
# Class Variables
|
|
44
|
+
|
|
45
|
+
# Fallback Variables
|
|
46
|
+
|
|
47
|
+
# Private Variables
|
|
48
|
+
|
|
49
|
+
# Public Variables
|
|
50
|
+
|
|
51
|
+
# Virtual Variables
|
|
52
|
+
|
|
53
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
54
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
55
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
56
|
+
|
|
57
|
+
def _createUglySide(self, ) -> None:
|
|
58
|
+
"""
|
|
59
|
+
Refuses: no ritual makes a C++ QThread yet, so 'QThread()' has
|
|
60
|
+
nothing to stand for. One is given by 'QObject.thread()'.
|
|
61
|
+
|
|
62
|
+
Raises
|
|
63
|
+
------
|
|
64
|
+
|
|
65
|
+
TypeError
|
|
66
|
+
Always.
|
|
67
|
+
"""
|
|
68
|
+
infoSpec = """A 'QThread' cannot be made from Python yet: there is
|
|
69
|
+
no ritual for its constructor. One is given by 'QObject.thread()'."""
|
|
70
|
+
raise TypeError(' '.join(infoSpec.split()))
|
|
71
|
+
|
|
72
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
73
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
74
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
75
|
+
|
|
76
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
77
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
78
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
79
|
+
|
|
80
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
81
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
82
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
83
|
+
|
|
84
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
85
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
86
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
87
|
+
|
|
88
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
89
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
90
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
91
|
+
|
|
92
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
93
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
94
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
95
|
+
|
|
96
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
97
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
98
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
99
|
+
|
|
100
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
101
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
102
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
103
|
+
|
|
104
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
105
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
106
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|