pythonqtside 1.1.12__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.
- pythonqtside/Qt.py +14 -0
- pythonqtside/QtCore.py +14 -0
- pythonqtside/QtGui.py +14 -0
- pythonqtside/QtNetwork.py +14 -0
- pythonqtside/QtOpenGL.py +14 -0
- pythonqtside/QtSvg.py +14 -0
- pythonqtside/QtUiTools.py +14 -0
- pythonqtside/QtWidgets.py +14 -0
- pythonqtside/QtXmlPatterns.py +14 -0
- pythonqtside/__init__.py +34 -0
- pythonqtside/_app.py +319 -0
- pythonqtside/_app_cleanup.py +216 -0
- pythonqtside/_app_conversions.py +106 -0
- pythonqtside/_app_dialogs.py +74 -0
- pythonqtside/_app_flags.py +79 -0
- pythonqtside/_app_imports.py +146 -0
- pythonqtside/_app_keywords.py +210 -0
- pythonqtside/_app_native.py +404 -0
- pythonqtside/_app_proxy.py +43 -0
- pythonqtside/_app_source.py +110 -0
- pythonqtside/_differences.json +9808 -0
- pythonqtside/_flags.json +210 -0
- pythonqtside/_implicit_conversions.json +1975 -0
- pythonqtside/_inventory.json +115478 -0
- pythonqtside/_keywords.json +1 -0
- pythonqtside/_out_parameters.json +465 -0
- pythonqtside/_qtwidgets.json +202 -0
- pythonqtside/_routing.py +95 -0
- pythonqtside/compat.py +44 -0
- pythonqtside/tooling/__init__.py +2 -0
- pythonqtside/tooling/conversions.py +433 -0
- pythonqtside/tooling/differences.py +290 -0
- pythonqtside/tooling/flags.py +156 -0
- pythonqtside/tooling/inventory.py +149 -0
- pythonqtside/tooling/join.py +184 -0
- pythonqtside/tooling/keywords.py +259 -0
- pythonqtside/tooling/surface.py +191 -0
- pythonqtside-1.1.12.dist-info/METADATA +468 -0
- pythonqtside-1.1.12.dist-info/RECORD +42 -0
- pythonqtside-1.1.12.dist-info/WHEEL +4 -0
- pythonqtside-1.1.12.dist-info/licenses/LICENSE +201 -0
- pythonqtside-1.1.12.dist-info/licenses/NOTICE +7 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pythonqtside
|
|
3
|
+
Version: 1.1.12
|
|
4
|
+
Summary: Native FontLab PythonQt namespace adapter and compatibility plan
|
|
5
|
+
Project-URL: Repository, https://github.com/fontlabcom/pythonqtside
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: NOTICE
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Requires-Dist: fontlab-echopy>=0.1.0
|
|
11
|
+
Provides-Extra: test
|
|
12
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
this_file: README.md
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Install in FontLab
|
|
20
|
+
|
|
21
|
+
To install into FontLab 9, open `install.vfpy` from a checkout in FontLab
|
|
22
|
+
(double-click it or drop it onto FontLab), then restart FontLab. The file is a
|
|
23
|
+
short stub that hands the work to
|
|
24
|
+
[fontlab-instamix](https://github.com/fontlabcom/fontlab-python-instamix); if
|
|
25
|
+
instamix is not installed yet, the stub installs it from PyPI first. Instamix
|
|
26
|
+
installs the package into FontLab's own `site-packages` and records the install
|
|
27
|
+
under the extension id `com.fontlab.pythonqtside`.
|
|
28
|
+
|
|
29
|
+
## Development status — 2026-11-05
|
|
30
|
+
|
|
31
|
+
Canonical source inspected for this proposal: `1af6f8bd2d54`. This is a dated source observation, not an installed or native acceptance claim.
|
|
32
|
+
|
|
33
|
+
Keep inventories and routing matched to actual PythonQt/Echopy captures; never infer native Qt 6 support from standalone PySide6 tests.
|
|
34
|
+
|
|
35
|
+
Qualify QFileDialog tuple adaptation, overloads, properties, virtuals and ownership in the actual host, plus genuine artifacts and ordinary dependency resolution.
|
|
36
|
+
|
|
37
|
+
## Repository and development
|
|
38
|
+
|
|
39
|
+
`src/pythonqtside/` contains namespace routing and inventory tooling; `examples/` supplies compatibility demonstrations; `tests/` checks routing; `src_docs/md/pythonqt-compatibility.md` defines supported and unsupported behavior.
|
|
40
|
+
|
|
41
|
+
Prepare a development environment with pytest and a matching Echopy package as described in README, then run `./test.sh` (`uv run --no-sync python -m pytest`). Host-targeted checks use arm64 Python 3.11; the README Python 3.12 environment is for offline development only.
|
|
42
|
+
|
|
43
|
+
Keep runtime, ordinary installed artifacts, native workflows and published documentation as separate acceptance results. Track open checks in [TODO.md](TODO.md), the implementation route in [PLAN.md](PLAN.md), and dated evidence in [CHANGELOG.md](CHANGELOG.md).
|
|
44
|
+
|
|
45
|
+
## Documentation source and build
|
|
46
|
+
|
|
47
|
+
The product guide starts at [src_docs/md/index.md](src_docs/md/index.md). Build with the separate hash-locked docs environment and `sh src_docs/build.sh`; run `python -m unittest discover -s tests_docs -v`. Every main commit qualifies source/output identity and byte parity. Private Pages configuration and publication remain owner-held.
|
|
48
|
+
|
|
49
|
+
# Pythonqtside
|
|
50
|
+
|
|
51
|
+
`pythonqtside` supplies inventory-based Qt5 namespace routing for FontLab PythonQt.
|
|
52
|
+
What runs unchanged, what is adapted and what is not supported is listed in the
|
|
53
|
+
[compatibility guide](src_docs/md/pythonqt-compatibility.md); completed work is in
|
|
54
|
+
[CHANGELOG.md](CHANGELOG.md). This package never imports or installs a second Qt
|
|
55
|
+
binding or creates a QApplication.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from pythonqtside import QtCore, QtGui, QtWidgets
|
|
59
|
+
widget = QtWidgets.QWidget() # Inside FontLab: the original native QWidget.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Compatibility guide:** [src_docs/md/pythonqt-compatibility.md](src_docs/md/pythonqt-compatibility.md) lists what
|
|
63
|
+
runs unchanged, what is adapted, what is not supported, and the native acceptance
|
|
64
|
+
command.
|
|
65
|
+
|
|
66
|
+
Namespaces load lazily through fontlab-echopy. QtWidgets exposes the 195 native
|
|
67
|
+
classes in the verified PySide2 5.15.2.1 intersection. Each known PySide2 name
|
|
68
|
+
routes to its joined native module, including QtCore models found in QtGui;
|
|
69
|
+
names belonging to other families are excluded. Native extensions remain
|
|
70
|
+
available in their original families, and combined Qt remains native.
|
|
71
|
+
QObject uses QtCore's native class when present,
|
|
72
|
+
otherwise the actual PythonQt.private.QObject. Signals, slots and properties are
|
|
73
|
+
routed directly; no fake binding objects are supplied.
|
|
74
|
+
|
|
75
|
+
QtCore, QtGui, QtWidgets, QtNetwork, QtOpenGL, QtSvg, QtUiTools, QtXmlPatterns and
|
|
76
|
+
the native combined Qt namespace are available. Missing members raise
|
|
77
|
+
AttributeError. Outside FontLab, Echopy's documentation declarations may load;
|
|
78
|
+
constructing native classes raises NativeUnavailable. Names alone do not imply
|
|
79
|
+
PySide-compatible callable properties, enums, overloads, ownership or callbacks.
|
|
80
|
+
Those differences, full application ports and Qt6 are separately planned.
|
|
81
|
+
|
|
82
|
+
## Reproducible inventory
|
|
83
|
+
|
|
84
|
+
[`src/pythonqtside/_inventory.json`](src/pythonqtside/_inventory.json) joins eight
|
|
85
|
+
PySide2 module stubs with nine captured PythonQt stubs, including private and
|
|
86
|
+
combined Qt. It records 648 class declarations, availability, member differences,
|
|
87
|
+
constructor arities, enum differences and SHA256 identities for all 21 inputs.
|
|
88
|
+
Regenerate it and `_qtwidgets.json` from the read-only sibling Echopy checkout:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
uv run --no-sync python -m pythonqtside.tooling.inventory --echopy ../fontlab-echopy
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The tool parses ASTs and ZIP members, verifies wheel/manifest and recorded native
|
|
95
|
+
hashes, and emits sorted JSON without timestamps or local paths. It never loads
|
|
96
|
+
the wheel. The report is 3,607,692 bytes. The widget list changed from 200 to 195:
|
|
97
|
+
`Object` is an empty stub helper; `QAccessibleWidget`, `QColormap`,
|
|
98
|
+
`QStyleOptionComplex` and `QTreeWidgetItemIterator` also have no native match.
|
|
99
|
+
|
|
100
|
+
The supplied `_provenance.json` records no host versions: `fontlab_version`,
|
|
101
|
+
`python_version` and `qt_version` are explicitly `null`. Nested native enum types
|
|
102
|
+
are opaque; their membership remains unknown. Extra uppercase native attributes
|
|
103
|
+
are labelled enum candidates, not confirmed values. Constructor shapes describe
|
|
104
|
+
declarations, not working overloads. Inherited declarations within the eight
|
|
105
|
+
families are included; getter/attribute matches still require native checks.
|
|
106
|
+
Errors distinguish unavailable PySide2 names, names owned by another family and
|
|
107
|
+
unknown names. Native verification remains the orchestrator's gate.
|
|
108
|
+
|
|
109
|
+
## Measured adapters (phase 3)
|
|
110
|
+
|
|
111
|
+
`python -m pythonqtside.tooling.differences` reads only `_inventory.json` and
|
|
112
|
+
writes two deterministic files: the report
|
|
113
|
+
[`_differences.json`](src/pythonqtside/_differences.json) (241,816 bytes) and
|
|
114
|
+
the small runtime table
|
|
115
|
+
[`_out_parameters.json`](src/pythonqtside/_out_parameters.json) (9,916 bytes),
|
|
116
|
+
which is the only file the out-parameter adapter loads. The report covers four categories for
|
|
117
|
+
routed classes:
|
|
118
|
+
|
|
119
|
+
| Category | Measured | Adapter |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| PySide2 getter vs native attribute | 5,364 names, 228 classes; natively 4,624 measured, all Qt properties | zero-arg getter, gated by `metaObject().indexOfProperty()` |
|
|
122
|
+
| Enum members absent natively | 2,679 names, 125 classes; 1,381 opaque nested enums | none |
|
|
123
|
+
| Tuple results from out-parameters | 259 methods | 39: 2 by native predicate, 37 by `PythonQt.BoolResult` |
|
|
124
|
+
| Keyword arguments | every native constructor and method rejects them (FontLab measurement) | `_keywords.json`: PySide2 names mapped to positions |
|
|
125
|
+
|
|
126
|
+
The getter row was measured in FontLab 9 (issue 104, workspace evidence
|
|
127
|
+
`pqs-g04/getters/`): on 181 default-constructed classes, every one of the 4,624
|
|
128
|
+
names is a Qt property of the instance, so the `indexOfProperty` gate covers all of
|
|
129
|
+
them; none is already callable natively, none falls through. The other 740 names
|
|
130
|
+
belong to 47 classes that were skipped (application, clipboard, printing, GL,
|
|
131
|
+
platform dialogs) or have no default constructor; PythonQt exposes no
|
|
132
|
+
`staticMetaObject` to inspect them without an instance. The gate checks the live
|
|
133
|
+
instance at call time either way. Outside `run_app`, `compat.pyside_method(widget,
|
|
134
|
+
"windowTitle")()` uses the same gate. The measurement never reads property values:
|
|
135
|
+
reading `currentFrame` on an empty `QSvgRenderer` segfaults FontLab.
|
|
136
|
+
|
|
137
|
+
An out-parameter method is adapted only when PySide2 returns `(value, bool)` and
|
|
138
|
+
every native overload declares one bool out-parameter (`ok`, `invertible` or
|
|
139
|
+
`timedOut`) at the same position.
|
|
140
|
+
|
|
141
|
+
- Predicate: `QTransform().inverted()` and `QMatrix().inverted()` return the
|
|
142
|
+
native result plus `isInvertible()`. A call with any argument stays native.
|
|
143
|
+
- `BoolResult`: the adapter puts a native `PythonQt.BoolResult` in the
|
|
144
|
+
out-parameter slot, shifts later PySide2 arguments after it and returns
|
|
145
|
+
`(value, bool(result))`. Examples: `QLocale().toInt("42")` gives `(42, True)`,
|
|
146
|
+
`QByteArray.toInt(16)`, `QMatrix4x4().inverted()`, `item.itemTransform(other)`,
|
|
147
|
+
`QTcpServer.waitForNewConnection(msec)` (the flag is `timedOut`), and the static
|
|
148
|
+
`QInputDialog.getText/getInt/getDouble/getItem/getMultiLineText`. Static methods adapt on the class too. Parameters that
|
|
149
|
+
PySide2 lets a caller omit before the slot get Qt 5.15's declared defaults
|
|
150
|
+
(`getText` echo `QLineEdit.Normal`, looked up natively when called, and text
|
|
151
|
+
`""`).
|
|
152
|
+
- Keyword calls are first mapped to positions (see "Keyword arguments" below).
|
|
153
|
+
Calls stay native when keywords cannot be mapped, already pass a `BoolResult`,
|
|
154
|
+
pass more positional arguments than the PySide2 form allows (`getDouble`'s
|
|
155
|
+
`step` overload) or omit a parameter without a default.
|
|
156
|
+
- A PySide2-style call that passes `None` where PythonQt expects `ok` (for
|
|
157
|
+
example `getText(parent, title, label, echo, text, None)`) is read as PySide2:
|
|
158
|
+
the `BoolResult` goes into the slot and `None` follows it as `flags`. Only an
|
|
159
|
+
explicit `BoolResult` argument marks a call as PythonQt style.
|
|
160
|
+
|
|
161
|
+
Unsupported methods keep native behavior, each with a recorded reason: 106 lack a
|
|
162
|
+
native method, 112 return several values or no flag (`getRgb`,
|
|
163
|
+
`QFileDialog.getOpenFileName`), 1 is ambiguous and 1 contradicts its stub.
|
|
164
|
+
`QHostAddress.toIPv4Address` also has a same-arity PySide2 overload that returns
|
|
165
|
+
a plain int. `QFontDialog.getFont` is annotated `(QFont, bool)`, but PySide2
|
|
166
|
+
returns `(ok, font)` at runtime, and the native `(ok, parent)` overload is not in
|
|
167
|
+
the stub, so it stays native.
|
|
168
|
+
|
|
169
|
+
Behaviour change from phase 3: `QMatrix4x4().inverted()` now returns a tuple.
|
|
170
|
+
|
|
171
|
+
### Implicit enum to value-class conversions (phase 3c)
|
|
172
|
+
|
|
173
|
+
PySide2 converts an enum to a value type implicitly: `setEasingCurve(QEasingCurve.OutElastic)`
|
|
174
|
+
calls `QEasingCurve(OutElastic)` first. FontLab's PythonQt does not: that call
|
|
175
|
+
raises "wrong arguments: (30,)", and `QTcpServer().listen(QHostAddress.LocalHost, 0)`
|
|
176
|
+
finds no overload. Passing `QEasingCurve(...)` or `QHostAddress(...)` works.
|
|
177
|
+
|
|
178
|
+
`python -m pythonqtside.tooling.conversions --echopy ../fontlab-echopy` writes
|
|
179
|
+
[`_implicit_conversions.json`](src/pythonqtside/_implicit_conversions.json)
|
|
180
|
+
(34,888 bytes). `_inventory.json` keeps parameter names but no annotations, so
|
|
181
|
+
the command reads the PySide2 wheel stubs and native stubs that the inventory
|
|
182
|
+
pins. It stops if any SHA256 differs from the inventory's `inputs`, and takes
|
|
183
|
+
class routing and native enum layout from the inventory.
|
|
184
|
+
|
|
185
|
+
- A value class is a routed PySide2 class with a copy constructor (Shiboken
|
|
186
|
+
converts only to value types) and a constructor that takes one native enum.
|
|
187
|
+
Five Qt 5.15 types whose enum constructor is C++ `explicit` are left out
|
|
188
|
+
(QEvent, QOpenGLBuffer, QGLBuffer, QPageSize, QTileRules). That leaves 13:
|
|
189
|
+
QEasingCurve, QHostAddress, QColor, QBrush, QPen, QCursor, QKeySequence,
|
|
190
|
+
QPalette, QLocale, QJsonValue, QNetworkProxy, QSslError and QXmlQuery.
|
|
191
|
+
- A position is a parameter typed with one of those classes. Each routed class
|
|
192
|
+
gets its own entries, inherited methods included, because the native stubs
|
|
193
|
+
give every wrapper the base `PythonQtInstanceWrapper` and no Qt base chain, so
|
|
194
|
+
`isinstance(label, QWidget)` cannot be assumed. The table has 610 positions on
|
|
195
|
+
168 classes; each distinct entry is stored once. Examples:
|
|
196
|
+
`setEasingCurve` on QVariantAnimation, QPropertyAnimation and QTimeLine,
|
|
197
|
+
`QTcpServer.listen`, `setCursor` on every widget class, `QPixmap.fill`,
|
|
198
|
+
`setPalette` and the static `setOverrideCursor`.
|
|
199
|
+
- Exclusions are decided per call arity (phase 3d). A position is excluded at an
|
|
200
|
+
argument count when a PySide2 overload accepting that count takes an enum or
|
|
201
|
+
int there (18), or `float` or a numeric sequence that an int-like enum could
|
|
202
|
+
match (2: `QOpenGLShaderProgram`/`QGLShaderProgram.setAttributeValue`). In
|
|
203
|
+
those cases PySide2 does not convert and the native overload set may not
|
|
204
|
+
either: `QPainter.setBrush`, `setPen`, `fillRect`, `QImage.fill` and
|
|
205
|
+
`QBrush.setColor` stay native at every arity. A sibling with another arity
|
|
206
|
+
no longer blocks a position: `palette.setColor(QPalette.Window, Qt.red)` and
|
|
207
|
+
`palette.setBrush(role, Qt.red)` convert, and so do
|
|
208
|
+
`QImage.setPixelColor(point, Qt.red)`, `QOpenGLTexture.setBorderColor(Qt.red)`
|
|
209
|
+
and the 3-argument `socket.bind(QHostAddress.LocalHost, port, mode)`. The
|
|
210
|
+
3-argument `setColor(group, role, colour)` still has no position at index 1.
|
|
211
|
+
Another 16 positions have no native method. Each exclusion is recorded with
|
|
212
|
+
its reason, keyed `"index"` or, when only some arities are excluded,
|
|
213
|
+
`"index@low-high"`. If the native classes do form a chain,
|
|
214
|
+
a class without a conversion whose base has one gets an empty entry that
|
|
215
|
+
shadows the base, and the most-derived match wins. There are none today.
|
|
216
|
+
- Generation fails if a method appears in both this table and
|
|
217
|
+
`_out_parameters.json`.
|
|
218
|
+
|
|
219
|
+
At call time the argument is wrapped as `V(value)` only when all of these hold:
|
|
220
|
+
the receiver is native, the selected method is native, the arguments are
|
|
221
|
+
positional (after keyword mapping), their count is within the measured range, and the value is an
|
|
222
|
+
instance of the measured native enum type. A plain `int` or `bool`, another enum
|
|
223
|
+
type and a ready-made value object pass through unchanged. If the native enum
|
|
224
|
+
type cannot be resolved, nothing is wrapped. When a method has several entries
|
|
225
|
+
for one index, the actual positional argument count selects the entry. Native
|
|
226
|
+
class and enum objects are resolved once per path and `PythonQt` module, so a
|
|
227
|
+
`setCursor` lookup does not repeat its ~95 `getattr` chains on every call. Static methods are converted on
|
|
228
|
+
class receivers too (`QApplication.setOverrideCursor(Qt.WaitCursor)`). The native
|
|
229
|
+
call happens once and its result is returned unchanged. Constructors and module
|
|
230
|
+
functions are not converted (`QPen(Qt.red)` stays native), and neither are
|
|
231
|
+
unbound instance-method calls (see below).
|
|
232
|
+
|
|
233
|
+
`run_app` sources get every adapter automatically. New code opts in explicitly:
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
from pythonqtside import compat
|
|
237
|
+
title = compat.pyside_method(widget, "windowTitle")()
|
|
238
|
+
inverse, ok = compat.pyside_method(transform, "inverted")()
|
|
239
|
+
text, ok = compat.pyside_method(QInputDialog, "getText")(parent, "Title", "Name")
|
|
240
|
+
compat.pyside_method(animation, "setEasingCurve")(QEasingCurve.OutElastic)
|
|
241
|
+
label = compat.pyside_construct(QLabel, "Name", parent=window)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Attribute reads such as `widget.windowTitle` remain native values. Classes are
|
|
245
|
+
not patched. A Python override keeps its own behaviour. Within `run_app`, bound
|
|
246
|
+
native methods stored first and called later get the full adapter chain, with or
|
|
247
|
+
without keywords (`convert = locale.toInt; convert("42")` returns `(42, True)`).
|
|
248
|
+
Native `super()` calls get the same adapters, including when native lookup needs
|
|
249
|
+
the explicit base-method fallback; Python base methods keep their own behaviour.
|
|
250
|
+
Unbound instance-method calls such as `QTransform.inverted(t)` or
|
|
251
|
+
`QLocale.toInt(locale, s)` remain native and return PythonQt's single value.
|
|
252
|
+
|
|
253
|
+
### Keyword arguments (issue 104)
|
|
254
|
+
|
|
255
|
+
FontLab's PythonQt rejects every keyword argument to a native constructor or
|
|
256
|
+
method: `QLabel("Name", parent=window)` raises `ValueError: ... called slot does
|
|
257
|
+
not support kwargs` (measured on QWidget, QLabel, QPushButton, QDialog, QTimer,
|
|
258
|
+
QLineEdit, QVBoxLayout, QColor, QSize, `setText`, `resize`, `setProperty` and the
|
|
259
|
+
static `QColor.fromRgb`; workspace evidence `pqs-g04/probe_keywords.json`).
|
|
260
|
+
|
|
261
|
+
`python -m pythonqtside.tooling.keywords --echopy ../fontlab-echopy` writes
|
|
262
|
+
[`_keywords.json`](src/pythonqtside/_keywords.json) (805,916 bytes) from the
|
|
263
|
+
pinned PySide2 and native stubs, verified against the inventory's SHA256 inputs.
|
|
264
|
+
It lists the PySide2 parameter names of every constructor and method overload of
|
|
265
|
+
the 535 routed classes, and 450 gap defaults: Qt 5.15 declaration defaults quoted
|
|
266
|
+
in Echopy's native docstrings when they are `nullptr`, `QString()`, `true`/`false`,
|
|
267
|
+
a number or `Class::Member` of a routed class, plus the BoolResult adapter's
|
|
268
|
+
defaults. 220 tuple-returning methods are left out of the keyword table (the three QFileDialog pickers are adapted separately, see `src_docs/md/pythonqt-compatibility.md`) because PySide2 drops their
|
|
269
|
+
out-parameters, so its positions differ from the native ones
|
|
270
|
+
(`QFileDialog.getSaveFileName`'s `options` is native position 5, not 4); the 39
|
|
271
|
+
adapted ones stay.
|
|
272
|
+
|
|
273
|
+
A keyword call becomes positional when exactly one positional form fits. A
|
|
274
|
+
skipped parameter needs a recorded default; `{"native": ...}` defaults resolve at
|
|
275
|
+
call time. Distinct forms, a keyword naming a parameter already passed by
|
|
276
|
+
position, or an unresolvable default keep the native call and its native error.
|
|
277
|
+
Constructor keywords that name no parameter set a Qt property or connect a
|
|
278
|
+
signal after construction, as PySide2 does (`QTimer(interval=50)`,
|
|
279
|
+
`QPushButton("OK", clicked=accept)`); other names raise `AttributeError`. Inside
|
|
280
|
+
`run_app` these connections are tracked and disconnected by `close()`.
|
|
281
|
+
|
|
282
|
+
Covered call forms: native constructors and Python subclasses without their own
|
|
283
|
+
`__init__`, `super().__init__(parent=parent)`, `Base.__init__(self, parent=p)`,
|
|
284
|
+
instance and static methods, `super().method(...)` (also when PythonQt's `super()`
|
|
285
|
+
misses the native method; a `base = super().method` load reaches the native base),
|
|
286
|
+
and a native method stored first and called later with keywords. Mapped calls then pass through the out-parameter and
|
|
287
|
+
conversion adapters, so `QLocale().toInt(s="42")` returns `(42, True)`. Signal
|
|
288
|
+
`connect`/`disconnect`/`emit` are never wrapped. In `run_app` only call sites
|
|
289
|
+
that pass keywords consult the table, which loads on the first such call.
|
|
290
|
+
Outside `run_app`:
|
|
291
|
+
|
|
292
|
+
```python
|
|
293
|
+
from pythonqtside import compat
|
|
294
|
+
label = compat.pyside_construct(QLabel, "Name", parent=window)
|
|
295
|
+
compat.pyside_method(label, "resize")(w=120, h=30)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Native acceptance (FontLab 9.0.9780, `pqs-g04/keywords/`, re-run on the final
|
|
299
|
+
code in `pqs-g04/regression/final/keywords.json`): an unchanged app
|
|
300
|
+
with all of the forms above, including `QLabel(alignment=Qt.AlignCenter)`,
|
|
301
|
+
`QLineEdit(placeholderText=...)`, `QTimer(interval=50, singleShot=True)` and
|
|
302
|
+
`QColor.fromRgb(r=10, g=20, b=30)` (alpha from the Qt default), ran and closed
|
|
303
|
+
with no cleanup errors.
|
|
304
|
+
|
|
305
|
+
### Signals, flags and buffers (issue 104)
|
|
306
|
+
|
|
307
|
+
Measured in FontLab 9 (workspace evidence `pqs-g04/fixtures/`); `run_app` adapts
|
|
308
|
+
each one:
|
|
309
|
+
|
|
310
|
+
- **Native-slot connections.** PythonQt passes every signal argument to a native
|
|
311
|
+
slot, so `button.clicked.connect(label.clear)` fails ("wrong number of
|
|
312
|
+
arguments"); Qt drops trailing arguments. Worse, PythonQt's slot comparison casts
|
|
313
|
+
both operands to slot objects: disconnecting anything from a receiver that holds
|
|
314
|
+
both a native slot (`buttons.rejected.connect(self.reject)`) and a bound method of
|
|
315
|
+
the same object (`buttons.accepted.connect(self.submit)`) segfaults FontLab.
|
|
316
|
+
`run_app` connects native slots through a Python forwarder that retries with fewer
|
|
317
|
+
leading arguments, maps a later `disconnect(self.reject)` to that forwarder, and
|
|
318
|
+
never lets a native slot be compared with another type.
|
|
319
|
+
- **Signal overloads.** `process.finished` connects to the deprecated
|
|
320
|
+
`finished(int)`, so a PySide2 `lambda code, status: ...` never runs. When a
|
|
321
|
+
callback needs more positional arguments than PythonQt's default overload
|
|
322
|
+
delivers, `run_app` connects it with `owner.connect("2finished(int,QProcess::ExitStatus)", cb)`
|
|
323
|
+
(overloads come from `signal.parameterTypes()`) and undoes that on disconnect.
|
|
324
|
+
- **QFlags against enum overloads.** `QDialogButtonBox.Ok | QDialogButtonBox.Cancel`
|
|
325
|
+
is a plain int, and `QDialogButtonBox(int)` picks the `Qt.Orientation` overload:
|
|
326
|
+
no buttons. `python -m pythonqtside.tooling.flags --echopy ../fontlab-echopy`
|
|
327
|
+
writes [`_flags.json`](src/pythonqtside/_flags.json) (12 positions on 10 methods,
|
|
328
|
+
e.g. the QDialogButtonBox constructor and `QMessageBox.question`), where a flags
|
|
329
|
+
parameter competes with an enum overload of the same arity. There a plain int, or
|
|
330
|
+
an enum value other than the competing enum, is wrapped in the native flags class.
|
|
331
|
+
- **`bytes(QByteArray)`** raises in PythonQt; `bytes`, `bytearray` and `memoryview`
|
|
332
|
+
calls in `run_app` read a native QByteArray through `data()`.
|
|
333
|
+
- **Ownership.** Widgets returned by `QUiLoader.load()` are owned like constructor
|
|
334
|
+
results (Qt gives the caller ownership). Owned objects Qt already deleted (a
|
|
335
|
+
delegate's editor) are skipped at close: PythonQt wrappers of deleted QObjects
|
|
336
|
+
raise `ValueError: Trying to call ... on a destroyed ... object` instead of
|
|
337
|
+
crashing. A killed QProcess counts as stopped when its state is NotRunning
|
|
338
|
+
(`waitForFinished` returns false after `errorOccurred(Crashed)`).
|
|
339
|
+
|
|
340
|
+
## Unchanged-app fixtures (R036)
|
|
341
|
+
|
|
342
|
+
`examples/fixtures/` holds seven owned PySide2 apps: a form, custom
|
|
343
|
+
signals/slots/properties with an event filter and virtual overrides, a table model
|
|
344
|
+
with an editable spin-box delegate, a Designer `.ui` form loaded by QUiLoader,
|
|
345
|
+
QPainter driven by mouse and key events, QTimer with QProcess success/error/cancel,
|
|
346
|
+
and a delete-on-close child dialog reopened. Run them in FontLab:
|
|
347
|
+
|
|
348
|
+
```sh
|
|
349
|
+
cd ../fontlab-remopy
|
|
350
|
+
uv run python ../pythonqtside/examples/fixtures/run_native.py \
|
|
351
|
+
--pythonqtside ../pythonqtside/src --echopy ../fontlab-echopy/src
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Each stage is one short `run_python` call; waits happen on the host side so
|
|
355
|
+
FontLab's event loop delivers process output, queued delegate commits and deferred
|
|
356
|
+
deletion. The command prints a JSON report and exits 1 if any check fails.
|
|
357
|
+
|
|
358
|
+
The owned-font fixture (`font_edit/`, driver `run_native_font.py`, mutating) also
|
|
359
|
+
passes: an unchanged PySide2 panel sets `.notdef`'s advance width in a font FontLab
|
|
360
|
+
created for the run; Edit > Undo and Redo, `save_font`, an independent VFJ parse and
|
|
361
|
+
reopen all agree (evidence `pqs-g04/font-edit/receipt.json`). `fontlab.CurrentGlyph()`
|
|
362
|
+
is `None` without a glyph window, so the panel uses the workspace's current package.
|
|
363
|
+
|
|
364
|
+
All seven run unchanged in FontLab 9.0.9780 (evidence `pqs-g04/fixtures/run7-all.json`).
|
|
365
|
+
None needed a source change; the adapters above came from them: the form needed
|
|
366
|
+
the QFlags and native-slot fixes, the timer the overload, `bytes` and QProcess-stop
|
|
367
|
+
fixes, the `.ui` form the `load()` ownership, the model/view the destroyed-object
|
|
368
|
+
skip. Each fixture's files are hashed before and after the run.
|
|
369
|
+
|
|
370
|
+
Lifetime, measured (R035, `pqs-g04/lifetime/` and the fixtures): deleting a parent
|
|
371
|
+
deletes its children; `deleteLater()` completes only after control returns to the
|
|
372
|
+
event loop, not within the same `run_python` call; a wrapper of a deleted object
|
|
373
|
+
raises `ValueError: Trying to call 'setText' on a destroyed QLabel object` (there
|
|
374
|
+
is no `QtCore.QPointer`; this check is the validity test). After `handle.close()`
|
|
375
|
+
an emission from a still-living object reaches no app callback, owned objects are
|
|
376
|
+
gone by the next call, timers stop and processes are killed. App code that still
|
|
377
|
+
runs after close (a Python object the host kept) raises `RuntimeError: The
|
|
378
|
+
embedded application handle is closed` at its first adapted call, or `NameError`
|
|
379
|
+
when it first reads a module global, because close releases the app's globals.
|
|
380
|
+
|
|
381
|
+
## Running existing applications
|
|
382
|
+
|
|
383
|
+
Run an ordinary PySide2 script without editing its imports inside FontLab:
|
|
384
|
+
|
|
385
|
+
```python
|
|
386
|
+
from pythonqtside import run_app
|
|
387
|
+
handle = run_app("/path/to/app.py")
|
|
388
|
+
# The host event loop remains in control; the handle retains widgets and imports.
|
|
389
|
+
handle.close() # Idempotent, scoped to constructor-created objects from this app.
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
`run_app(path, parent=None)` uses a private import graph for ordinary PySide2
|
|
393
|
+
imports and local `.py` files/packages, including imports from later callbacks.
|
|
394
|
+
Original files remain byte-identical. `handle.reports` contains immutable original
|
|
395
|
+
bytes, SHA256, filename, encoding and adapted call locations; `identity_report`
|
|
396
|
+
records routed classes and the explicit application proxy. Reports survive close.
|
|
397
|
+
The package retains active handles even when the caller discards the return value.
|
|
398
|
+
|
|
399
|
+
Native class identities remain intact except QApplication/QCoreApplication and
|
|
400
|
+
available QGuiApplication: these use one explicit proxy whose `native_application`
|
|
401
|
+
is the existing FontLab application. `instance()` reuses that proxy; application
|
|
402
|
+
`exec()`/`exec_()` return zero. `quit()`, `exit()` and `closeAllWindows()` close only
|
|
403
|
+
this handle. Application subclasses and other application operations/settings
|
|
404
|
+
raise `NotImplementedError`. Native dialog `exec_()` keeps its real modality.
|
|
405
|
+
|
|
406
|
+
Callable getter adaptation requires `metaObject().indexOfProperty()` evidence;
|
|
407
|
+
ordinary Python attributes remain ordinary values. Native super calls use the
|
|
408
|
+
measured property/unbound-method fallback. Calls stay in the original Python
|
|
409
|
+
frame, including aliased `exec`, `eval`, `super`, `locals`, `globals`, `vars`, `dir`.
|
|
410
|
+
Dynamic exec/eval strings receive no call adaptation. `importlib` imports,
|
|
411
|
+
namespace packages, star imports and nonlocal plugin discovery are not supported.
|
|
412
|
+
These limits are recorded; this runner does not establish whole PySide2 compatibility.
|
|
413
|
+
|
|
414
|
+
Only native QObject results from constructors are owned. Arbitrary native API
|
|
415
|
+
returns are borrowed. Cleanup disconnects tracked native signal callbacks, stops
|
|
416
|
+
timers and terminates supported processes/threads, then schedules owned graph
|
|
417
|
+
roots for deletion. Process/thread waits are bounded to 1000 ms each; work that
|
|
418
|
+
fails to stop and its owned ancestors stay retained, with deletion withheld and
|
|
419
|
+
details in `cleanup_errors`. Native deletion completion still depends on the host
|
|
420
|
+
event loop. `parent` must be a native QWidget; it applies only to unparented owned
|
|
421
|
+
root widgets when shown or when startup finishes. All UI operations require the
|
|
422
|
+
FontLab main Python thread; QtCore.QThread.currentThread is unavailable here.
|
|
423
|
+
|
|
424
|
+
The owned Apache-2.0 example in `examples/unchanged_app/app.py` imports PySide2
|
|
425
|
+
and has ordinary standalone startup. `examples/native_app_acceptance.py` supplies
|
|
426
|
+
the external FontLab acceptance driver. Standalone fixtures exercise the algorithm;
|
|
427
|
+
live controller verification is required before claiming host compatibility.
|
|
428
|
+
|
|
429
|
+
Three standalone tests validate namespace placement and direct class/signal
|
|
430
|
+
identity. Installed native checks verify QWidget/QColor placement, actual QObject
|
|
431
|
+
class identity, parent identity and a QObject subclass signal: connect, emit 7,
|
|
432
|
+
disconnect, emit 8 delivers only 7. Deletion is scheduled on the host event loop;
|
|
433
|
+
the ownership and lifetime behaviour is verified by the fixtures (see "Unchanged-app
|
|
434
|
+
fixtures (R036)" above).
|
|
435
|
+
|
|
436
|
+
```sh
|
|
437
|
+
uv venv --python 3.12
|
|
438
|
+
uv pip install --no-deps -e .
|
|
439
|
+
uv pip install pytest
|
|
440
|
+
./test.sh
|
|
441
|
+
uv build
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Install fontlab-echopy alongside this package. Versions use hatch-vcs/Git tags.
|
|
445
|
+
The factual inventory records upstream version and input SHA256 identities;
|
|
446
|
+
no PySide2 runtime, implementation or documentation is redistributed. See NOTICE.
|
|
447
|
+
|
|
448
|
+
## Status
|
|
449
|
+
|
|
450
|
+
Released as v0.2.0 (RELEASE.md): importable routed namespace for `fly.qs` and the
|
|
451
|
+
compatibility plan. Since then (unreleased, natively accepted in FontLab 9.0.9780,
|
|
452
|
+
Python 3.11.6, Qt 5.15.19; evidence in the workspace
|
|
453
|
+
`verification/issue-101-ecosystem/evidence/pqs-inventory/` and
|
|
454
|
+
`pythonqtside-runner-sdd/`):
|
|
455
|
+
|
|
456
|
+
- Inventory join of the PySide2 5.15.2.1 stubs with the native PythonQt stubs, and
|
|
457
|
+
exact QtCore/QtGui/QtWidgets routing (559 identities exact, 138 missing names
|
|
458
|
+
raise, 195 QtWidgets names).
|
|
459
|
+
- `run_app(path)` for unchanged PySide2 sources: retained private imports, the
|
|
460
|
+
host's QApplication behind a scoped proxy, immutable reports, owned cleanup.
|
|
461
|
+
- Protected virtual handlers: unchanged `super().paintEvent()`/
|
|
462
|
+
`super().mousePressEvent()` reach the native base.
|
|
463
|
+
- Measured adapters (phases 3–3d): `(value, ok)` out-parameter results through
|
|
464
|
+
`BoolResult`, implicit enum-to-value-class conversions with arity-aware
|
|
465
|
+
exclusions, cached native resolution.
|
|
466
|
+
|
|
467
|
+
Unsupported: dynamic exec/eval adaptation, importlib and star imports, global
|
|
468
|
+
application settings, raw-pointer helpers. Detailed phase evidence is in WORK.md.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
pythonqtside/Qt.py,sha256=xbrAnqQDOvH578hmD2Nrbxko1NGEMCVfxp4oogu9KCU,350
|
|
2
|
+
pythonqtside/QtCore.py,sha256=a9AzZtWNCTFUlnHh9otdZnukbCGHOKvLpMyS3fhRSJA,366
|
|
3
|
+
pythonqtside/QtGui.py,sha256=lHjOQDP0xTEN--uxpuv_xvA4Qk7gOdzhuOdYL6ldmzQ,362
|
|
4
|
+
pythonqtside/QtNetwork.py,sha256=_9C8lMaptN-h4BcBaYtyzfy5u-QnB6FifF5p6saRxfU,378
|
|
5
|
+
pythonqtside/QtOpenGL.py,sha256=TJ1XD71AlWf7JVNp5agjAfXyjUXXMguvJ9-b5AOlNes,374
|
|
6
|
+
pythonqtside/QtSvg.py,sha256=cBUB1WUMJIUlWofkTt4_Irc-BruRFXd3boYHGxynreU,362
|
|
7
|
+
pythonqtside/QtUiTools.py,sha256=X2-TDYJB9tXI3JfLLY2bAaxnidIaFxETxTODscwA3WQ,378
|
|
8
|
+
pythonqtside/QtWidgets.py,sha256=S2oCdB5aqIDjJwUk_dww2pgjQ19lCHove_3NwgzSdk4,378
|
|
9
|
+
pythonqtside/QtXmlPatterns.py,sha256=fQ0YG-PPx1-CYjON9Muqt1fxjIjS6biz5KZqGP4EJSA,394
|
|
10
|
+
pythonqtside/__init__.py,sha256=O34x0Cm5J4_3ArUCMdtUB6oQFW96d8UusCrsOTGRYGM,715
|
|
11
|
+
pythonqtside/_app.py,sha256=jvS2x18EjK52q4oJAyWXWfH10KO-S2UgjNll8S936EI,12591
|
|
12
|
+
pythonqtside/_app_cleanup.py,sha256=YGx23NhAUzumKMJLujvD4W-HWGu2JyQzKoiSZQnPaAI,8804
|
|
13
|
+
pythonqtside/_app_conversions.py,sha256=2qAL1-TSVa3nrgkddJuN5x2fzMVJkUKN2GAcv2GDU-4,4036
|
|
14
|
+
pythonqtside/_app_dialogs.py,sha256=lAZmcjSmFO5dQj7PmchprRTdChexOM9DhizBfMVEl-A,2829
|
|
15
|
+
pythonqtside/_app_flags.py,sha256=YpR4yv21_7B0u2DaJ4KTLa3hkgXaT4zsUI8l6-8SGmI,2816
|
|
16
|
+
pythonqtside/_app_imports.py,sha256=e75_S9urvSdvQlI4OOVrXV7-w7JuxZ-zodr6Q7KdnFg,5708
|
|
17
|
+
pythonqtside/_app_keywords.py,sha256=KflRBZ4czxKm6U9_rS9M9gI9eZGBpPqGyODHT02pIS0,7952
|
|
18
|
+
pythonqtside/_app_native.py,sha256=Zo3KuI9olR_SIQLAAgE6XZ6he4aWGI9P1p1T4TikG64,15896
|
|
19
|
+
pythonqtside/_app_proxy.py,sha256=1J_TIjwSWQfSo59jFuKj7wJBdpfOswtdVFHXaUukYNc,1270
|
|
20
|
+
pythonqtside/_app_source.py,sha256=rmjXptVwPSCmLz9ghwLsK6Aq1MXl9z_zRNzVNCnT9R4,4781
|
|
21
|
+
pythonqtside/_differences.json,sha256=CdoUuy2jQwu86bM32FeAhwN_jHgSkb9vQWDoDcXvIf8,243058
|
|
22
|
+
pythonqtside/_flags.json,sha256=eSn9x_StVt7qYXHIq3KdXjkAcwXMNHmkbpJ0roINM4Y,3716
|
|
23
|
+
pythonqtside/_implicit_conversions.json,sha256=JIX29pI8DW8zq8mJbvQphsqqAGojWqISmEsfrd0L5s8,34888
|
|
24
|
+
pythonqtside/_inventory.json,sha256=XPk68mnYsWas87bWDBU1R-oQOTNtGYKe3RuCFsnqI-4,3607692
|
|
25
|
+
pythonqtside/_keywords.json,sha256=EQj51UHe_jVSkDQ5IBDXI-eSWCMzuCG1T0ge-M5vHjQ,805916
|
|
26
|
+
pythonqtside/_out_parameters.json,sha256=iEo9CopHqpvSw79_-CjnFSEtXX_KmI9cDFI3xoPb2R4,9916
|
|
27
|
+
pythonqtside/_qtwidgets.json,sha256=ib-tMpdDcUItf3JKQnjWxR5AOm4Kp1uUGi0j-AYksYk,4610
|
|
28
|
+
pythonqtside/_routing.py,sha256=8jKsNRITXbWzeR-Erknv6j2i8Z1yXD3gFP_vLLQwrB0,3199
|
|
29
|
+
pythonqtside/compat.py,sha256=Ds_3LwFkp82sZncmAsCBSBXb5wXs_d5PlAvDGbROLgg,2133
|
|
30
|
+
pythonqtside/tooling/__init__.py,sha256=b7SUsuuiGYZSHLSElKqCkHC-lh3QKQvQy39lSj2UeKQ,116
|
|
31
|
+
pythonqtside/tooling/conversions.py,sha256=CWG1_FQV4PnrUXCSOlCjirzQkEBHF6uEb1pWHGnhNNI,17634
|
|
32
|
+
pythonqtside/tooling/differences.py,sha256=DjgQsQLV0DDK7ShfiDHdm8nlJzmNEmFOjlpc9W9TLK0,12619
|
|
33
|
+
pythonqtside/tooling/flags.py,sha256=9AMlfTzv28UDXRWVI5kMQh7cMxn8N0S6r9sZmAqN6ks,6129
|
|
34
|
+
pythonqtside/tooling/inventory.py,sha256=LHqm7zv2myE5Jzv-uQzQ18vvQEtwPPHsTlTfVYZo6a8,5999
|
|
35
|
+
pythonqtside/tooling/join.py,sha256=mIugVbay7u6BkQICefg1mSfrMUsdt1Bz-M2CtFPoVqY,6587
|
|
36
|
+
pythonqtside/tooling/keywords.py,sha256=aSXo1o15du0He4x3sY0Qchk-uMhDD8cejP-yR5iNWV8,10053
|
|
37
|
+
pythonqtside/tooling/surface.py,sha256=uQzuBOCmqqXCOJ7p47hAmpP0m8evXixUxNkzF0tRRAI,7520
|
|
38
|
+
pythonqtside-1.1.12.dist-info/METADATA,sha256=oPAzzHM557_nLxZyrBf7TjcmXKym-QlZasKlM4uKlIM,28252
|
|
39
|
+
pythonqtside-1.1.12.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
40
|
+
pythonqtside-1.1.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
41
|
+
pythonqtside-1.1.12.dist-info/licenses/NOTICE,sha256=Lj9rXO2oGgXKd35uKuQDhlUCu-lT09kKFrAAVSKAcK8,507
|
|
42
|
+
pythonqtside-1.1.12.dist-info/RECORD,,
|