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/__init__.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The 'cutienator' provides Python bindings to the occult world of C++.
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
__version__ = '0.0.1-dev0'
|
|
9
|
+
|
|
10
|
+
from ._cpp_addr import CppAddr
|
|
11
|
+
from ._cpp_box import CppBox
|
|
12
|
+
from ._wait import WAIT
|
|
13
|
+
from ._waiting_overload import WaitingOverload
|
|
14
|
+
from ._cute_overload import CuteOverload
|
|
15
|
+
from ._cute_load_hook import CuteLoadHook
|
|
16
|
+
from ._cute_space import CuteSpace
|
|
17
|
+
from ._meta_cute import MetaCute
|
|
18
|
+
from ._cute_mixin import CuteMixin
|
|
19
|
+
from ._ugly import Ugly
|
|
20
|
+
from ._q_meta_object import QMetaObject
|
|
21
|
+
from ._q_binding_storage import QBindingStorage
|
|
22
|
+
from ._q_event import QEvent
|
|
23
|
+
from ._q_object import QObject
|
|
24
|
+
from ._q_thread import QThread
|
|
25
|
+
from ._q_widget import QWidget
|
|
26
|
+
|
|
27
|
+
__all__ = (
|
|
28
|
+
'CppAddr',
|
|
29
|
+
'CppBox',
|
|
30
|
+
'WAIT',
|
|
31
|
+
'WaitingOverload',
|
|
32
|
+
'CuteOverload',
|
|
33
|
+
'CuteLoadHook',
|
|
34
|
+
'CuteSpace',
|
|
35
|
+
'MetaCute',
|
|
36
|
+
'CuteMixin',
|
|
37
|
+
'Ugly',
|
|
38
|
+
'QMetaObject',
|
|
39
|
+
'QBindingStorage',
|
|
40
|
+
'QEvent',
|
|
41
|
+
'QObject',
|
|
42
|
+
'QThread',
|
|
43
|
+
'QWidget',
|
|
44
|
+
)
|
cutienator/_cpp_addr.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CppAddr implements the descriptor protocol and finds the memory address of
|
|
3
|
+
the bound C++ object.
|
|
4
|
+
"""
|
|
5
|
+
# Apache-2.0 license
|
|
6
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import TYPE_CHECKING, Generic, TypeVar
|
|
10
|
+
|
|
11
|
+
from worktoy.desc import BaseDescriptor
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
T = TypeVar('T')
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CppAddr(BaseDescriptor, Generic[T]):
|
|
20
|
+
"""
|
|
21
|
+
CppAddr implements the descriptor protocol and finds the memory address of
|
|
22
|
+
the bound C++ object.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
26
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
27
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
28
|
+
|
|
29
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
30
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
31
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
32
|
+
|
|
33
|
+
# Class Variables
|
|
34
|
+
|
|
35
|
+
# Fallback Variables
|
|
36
|
+
|
|
37
|
+
# Private Variables
|
|
38
|
+
|
|
39
|
+
# Public Variables
|
|
40
|
+
|
|
41
|
+
# Virtual Variables
|
|
42
|
+
|
|
43
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
44
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
45
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
46
|
+
|
|
47
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
48
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
49
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
50
|
+
|
|
51
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
52
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
53
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
54
|
+
|
|
55
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
56
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
57
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
58
|
+
|
|
59
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
60
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
61
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
62
|
+
|
|
63
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
64
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
65
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
66
|
+
|
|
67
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
68
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
69
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
70
|
+
|
|
71
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
72
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
73
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
74
|
+
|
|
75
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
76
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
77
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
78
|
+
|
|
79
|
+
def __instance_get__(self, *args) -> int:
|
|
80
|
+
raise NotImplementedError
|
|
81
|
+
|
|
82
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
83
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
84
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
cutienator/_cpp_box.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CppBox implements the descriptor protocol to lazily create the occult C++
|
|
3
|
+
object.
|
|
4
|
+
"""
|
|
5
|
+
# Apache-2.0 license
|
|
6
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import TYPE_CHECKING, Generic, TypeVar
|
|
10
|
+
|
|
11
|
+
from worktoy.desc import AttriBox
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
T = TypeVar('T')
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CppBox(AttriBox):
|
|
20
|
+
"""
|
|
21
|
+
CppBox implements the descriptor protocol to lazily create the occult C++
|
|
22
|
+
object.
|
|
23
|
+
"""
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CuteLoadHook builds the overloaded method of a name again, after its
|
|
3
|
+
class is made.
|
|
4
|
+
"""
|
|
5
|
+
# Apache-2.0 license
|
|
6
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import TYPE_CHECKING
|
|
10
|
+
|
|
11
|
+
from worktoy.mcls.space_hooks import LoadSpaceHook
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
|
|
16
|
+
from worktoy.dispatch import Dispatcher
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CuteLoadHook(LoadSpaceHook):
|
|
20
|
+
"""
|
|
21
|
+
Builds, for a class that exists already, the one object that stands at
|
|
22
|
+
an overloaded name and picks the function for each call. worktoy
|
|
23
|
+
calls that object a dispatcher. See 'WAIT' for the whole story; this
|
|
24
|
+
is the last part of step 6.
|
|
25
|
+
|
|
26
|
+
You never call it. 'MetaCute' does, when a late class is made:
|
|
27
|
+
|
|
28
|
+
space = QObject.getNamespace() # the 'CuteSpace' of QObject
|
|
29
|
+
dispatcher = space.cuteLoadHook.buildAgain('moveToThread')
|
|
30
|
+
|
|
31
|
+
Why it exists
|
|
32
|
+
-------------
|
|
33
|
+
|
|
34
|
+
worktoy builds the dispatcher of each overloaded name once, as the
|
|
35
|
+
class is made, from the signatures on record in the namespace of the
|
|
36
|
+
class and in the namespaces of the classes it is built on. A waiting
|
|
37
|
+
signature is not on record then. When its late class is made,
|
|
38
|
+
'CuteSpace' puts it on record, and the dispatcher has to be built
|
|
39
|
+
once more from the full record, for the waiting class and for every
|
|
40
|
+
class built on it so far, since each class has a dispatcher of its
|
|
41
|
+
own.
|
|
42
|
+
|
|
43
|
+
The building itself is worktoy's, in 'LoadSpaceHook'. This class is
|
|
44
|
+
based on it only to reach that work from a class of our own.
|
|
45
|
+
|
|
46
|
+
What to expect
|
|
47
|
+
--------------
|
|
48
|
+
|
|
49
|
+
- It takes no part while a class body runs or is made into a class.
|
|
50
|
+
The hook 'loadSpaceHook' that 'CuteSpace' inherits from worktoy
|
|
51
|
+
does all of that, unchanged. The three phases this class would
|
|
52
|
+
otherwise run a second time do nothing here.
|
|
53
|
+
- 'buildAgain' reads the record as it is at that moment. It gives a
|
|
54
|
+
new dispatcher every time and puts it nowhere. 'MetaCute' places
|
|
55
|
+
it on the class.
|
|
56
|
+
- A dispatcher built again is the same as one built the first time
|
|
57
|
+
from the same record: signatures in the order they were written,
|
|
58
|
+
those of the class itself before those of the classes it is built
|
|
59
|
+
on.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
63
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
64
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
65
|
+
|
|
66
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
67
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
68
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
69
|
+
|
|
70
|
+
# Class Variables
|
|
71
|
+
|
|
72
|
+
# Fallback Variables
|
|
73
|
+
|
|
74
|
+
# Private Variables
|
|
75
|
+
|
|
76
|
+
# Public Variables
|
|
77
|
+
|
|
78
|
+
# Virtual Variables
|
|
79
|
+
|
|
80
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
81
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
82
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
83
|
+
|
|
84
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
85
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
86
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
87
|
+
|
|
88
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
89
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
90
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
91
|
+
|
|
92
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
93
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
94
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
95
|
+
|
|
96
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
97
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
98
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
99
|
+
|
|
100
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
101
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
102
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
103
|
+
|
|
104
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
105
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
106
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
107
|
+
|
|
108
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
109
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
110
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
111
|
+
|
|
112
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
113
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
114
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
115
|
+
|
|
116
|
+
def setItemPhase(self, key: str, val: Any, old: Any = None, ) -> bool:
|
|
117
|
+
"""
|
|
118
|
+
Does nothing, and claims nothing: 'loadSpaceHook' has already seen
|
|
119
|
+
the binding, and 'CuteSpace' has already taken any waiting
|
|
120
|
+
signature.
|
|
121
|
+
"""
|
|
122
|
+
return False
|
|
123
|
+
|
|
124
|
+
def delItemPhase(self, key: str, val: Any = None, ) -> bool:
|
|
125
|
+
"""Does nothing, and claims nothing: 'loadSpaceHook' has seen it."""
|
|
126
|
+
return False
|
|
127
|
+
|
|
128
|
+
def postCompilePhase(self, compiledSpace: dict) -> dict:
|
|
129
|
+
"""
|
|
130
|
+
Changes nothing: 'loadSpaceHook' has just built every dispatcher of
|
|
131
|
+
the class, and building them a second time here would only replace
|
|
132
|
+
each with its like.
|
|
133
|
+
"""
|
|
134
|
+
return compiledSpace
|
|
135
|
+
|
|
136
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
137
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
138
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
139
|
+
|
|
140
|
+
def buildAgain(self, methodName: str) -> Optional[Dispatcher]:
|
|
141
|
+
"""
|
|
142
|
+
Builds the dispatcher of one overloaded name from the record as it
|
|
143
|
+
is now, for the class of the namespace this hook was read through.
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
|
|
148
|
+
methodName : str
|
|
149
|
+
The overloaded name, as 'moveToThread'.
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
-------
|
|
153
|
+
|
|
154
|
+
Optional[Dispatcher]
|
|
155
|
+
A new dispatcher holding every signature on record for the name,
|
|
156
|
+
of the class and of the classes it is built on. It is placed
|
|
157
|
+
nowhere yet. None when nothing is on record for the name.
|
|
158
|
+
"""
|
|
159
|
+
return self._buildDispatcher(methodName)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CuteMixin provides shape
|
|
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.dispatch import overload
|
|
11
|
+
from worktoy.desc import Field
|
|
12
|
+
from worktoy.mcls import BaseObject
|
|
13
|
+
|
|
14
|
+
from ._ugly import Ugly
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
17
|
+
from typing import Optional, Any
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class CuteMixin(BaseObject):
|
|
21
|
+
"""
|
|
22
|
+
CuteMixin provides shape
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
26
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
27
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
28
|
+
|
|
29
|
+
@staticmethod
|
|
30
|
+
def _addressOf(cuteSide: Optional[Any]) -> Optional[int]:
|
|
31
|
+
"""
|
|
32
|
+
Gives what a ritual takes in the place of a cute object: the address
|
|
33
|
+
of the C++ object it stands for, or None for None, which C++ reads
|
|
34
|
+
as no object. Asking makes the C++ object if it is not made yet.
|
|
35
|
+
"""
|
|
36
|
+
if cuteSide is None:
|
|
37
|
+
return None
|
|
38
|
+
return cuteSide.uglySide.getAddress()
|
|
39
|
+
|
|
40
|
+
@staticmethod
|
|
41
|
+
def _bytesOf(text: Optional[str]) -> Optional[bytes]:
|
|
42
|
+
"""
|
|
43
|
+
Gives what a ritual takes in the place of text: the text as bytes,
|
|
44
|
+
or None for None, which C++ reads as no text.
|
|
45
|
+
"""
|
|
46
|
+
if text is None:
|
|
47
|
+
return None
|
|
48
|
+
return text.encode()
|
|
49
|
+
|
|
50
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
51
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
52
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
53
|
+
|
|
54
|
+
# Class Variables
|
|
55
|
+
__private_name__: str = '__ugly_name__'
|
|
56
|
+
|
|
57
|
+
# Fallback Variables
|
|
58
|
+
|
|
59
|
+
# Private Variables
|
|
60
|
+
__ugly_side__: Optional[object] = None
|
|
61
|
+
|
|
62
|
+
# Public Variables
|
|
63
|
+
uglySide: Field[object] = Field()
|
|
64
|
+
|
|
65
|
+
# Virtual Variables
|
|
66
|
+
|
|
67
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
68
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
69
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
70
|
+
|
|
71
|
+
def _createUglySide(self, ) -> None:
|
|
72
|
+
raise NotImplementedError
|
|
73
|
+
|
|
74
|
+
@uglySide.GET
|
|
75
|
+
def _getUglySide(self, **kwargs) -> object:
|
|
76
|
+
if self.__ugly_side__ is None:
|
|
77
|
+
if kwargs.get('_recursion', False):
|
|
78
|
+
raise RecursionError
|
|
79
|
+
self._createUglySide()
|
|
80
|
+
return self._getUglySide(_recursion=True)
|
|
81
|
+
return self.__ugly_side__
|
|
82
|
+
|
|
83
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
84
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
85
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
86
|
+
|
|
87
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
88
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
89
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
90
|
+
|
|
91
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
92
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
93
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
94
|
+
|
|
95
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
96
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
97
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
98
|
+
|
|
99
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
100
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
101
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def _cuteAt(cls, address: Optional[int]) -> Optional[Any]:
|
|
105
|
+
"""
|
|
106
|
+
Gives the cute object standing for the C++ object at an address
|
|
107
|
+
that a ritual gave back. A cute function giving an object back ends
|
|
108
|
+
with this:
|
|
109
|
+
|
|
110
|
+
address = self.uglySide.call('ritual_ZNK7QObject6threadEv')
|
|
111
|
+
return QThread._cuteAt(address)
|
|
112
|
+
|
|
113
|
+
What comes back
|
|
114
|
+
---------------
|
|
115
|
+
|
|
116
|
+
- None, when the address is None: C++ answered with no object.
|
|
117
|
+
- The cute object that stands for that C++ object already, when
|
|
118
|
+
there is one. It is given as it is, whatever class it has.
|
|
119
|
+
- Otherwise a new object of the class this is called on, made
|
|
120
|
+
around the address. No C++ object is created for it, and its
|
|
121
|
+
'__init__' does not run: it stands for an object C++ made itself,
|
|
122
|
+
as the thread Python runs in.
|
|
123
|
+
|
|
124
|
+
Nothing keeps a cute object made here alive but the one who asked
|
|
125
|
+
for it. Asked again after it is gone, a new one is made.
|
|
126
|
+
|
|
127
|
+
Parameters
|
|
128
|
+
----------
|
|
129
|
+
|
|
130
|
+
address : Optional[int]
|
|
131
|
+
What the ritual gave back: an address, or None.
|
|
132
|
+
|
|
133
|
+
Returns
|
|
134
|
+
-------
|
|
135
|
+
|
|
136
|
+
Optional[Any]
|
|
137
|
+
A cute object, or None.
|
|
138
|
+
"""
|
|
139
|
+
if address is None:
|
|
140
|
+
return None
|
|
141
|
+
try:
|
|
142
|
+
return Ugly.at(address).getCuteSide()
|
|
143
|
+
except LookupError:
|
|
144
|
+
pass
|
|
145
|
+
cuteSide = cls.__new__(cls)
|
|
146
|
+
ugly = Ugly()
|
|
147
|
+
ugly.setAddress(address)
|
|
148
|
+
ugly.setCuteSide(cuteSide)
|
|
149
|
+
cuteSide.__ugly_side__ = ugly
|
|
150
|
+
return cuteSide
|
|
151
|
+
|
|
152
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
153
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
154
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
155
|
+
|
|
156
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
157
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
158
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
159
|
+
|
|
160
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
161
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
162
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
163
|
+
|
|
164
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
165
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
166
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|