When importing images, the intrinsics were (re)built asynchronously in
a thread that was not attached to anything. The update of the intrinsics,
performed in the main thread following a signal emitted in the detached
thread, would block when there were already some existing intrinsics
because the garbage collector would destroy the thread in which the
new intrinsics had been computed while the update was ongoing.
This commit adds a ThreadPool to the Reconstruction object, and uses it
to perform the intrinsics computations asynchronously. The update of the
intrinsics thus does not remain blocked and images can be imported safely,
either though the "Import Images" menu or through drag & drop.
The "Update Intrinsics" button, which appears when the dialog to edit the
sensor database is on display, also uses the ThreadPool to recompute the
intrinsics when requested.
The "runAsync" method, which spawned a thread without attaching it to
anything, is removed. The "importImagesAsync" method, whose only goal
was to call "runAsync" on "importImagesSync", is also removed. Instead,
the pool of threads is directly used to call "importImagesSync"
asynchronously.
Loading images with the "Import Images" menu action is a blocking
operation that might freeze the app if there are many images to import.
This commit performs the import asynchronously (similarly to what is done
when images are dropped in the Image Gallery): Meshroom remains unusable
while the images are imported and the intrinsics built (which is a wanted
behaviour), but it does not freeze at all.
In particular:
- In common/, remove the backport of weakref.WeakMethod
- In docs/ and ui/, use the standard FileNotFoundError class
- Use built-in open() instead of io.open(), and stop importing io
- In core/stats.py, use the standard implementation of xml.etree instead
of the C one
- "pyCompatibility.basestring" are replaced by standard Python3 "str"
- "Sequence" and "Iterable" from "collections" are now directly imported
with "collections.abc"
If a node of type "CameraInit" is double-clicked in the Graph Editor,
the Image Gallery group index will immediately be updated to display
the corresponding node's information.
- Support loading external pipelines as templates with project files
- Add template files for some standard pipelines
- Remove the hard-coded generation of new pipelines
- Update multiviewPipeline test: the multiviewPipeline test relied on the hard-coded generation of
pipelines.
PySide 5.15.1 and newer have a bug
(https://bugreports.qt.io/browse/PYSIDE-1426) which results in the
following error emitted on certain @Property decorators:
TypeError: A constant property cannot have a WRITE method or a NOTIFY
signal.
Until the bug is fixed on PySide2 side workaround is to not use Property
as a decorator, but as a simple function wrapper emitting the property
as a class member.
Fixes#1239.