Skip to content

Commit e725f59

Browse files
committed
[ui] Work around PySide2 bug affecting property decorators
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.
1 parent 8eaef0b commit e725f59

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

meshroom/ui/app.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,17 @@ def markdownToHtml(self, md):
284284
return md
285285
return markdown(md)
286286

287-
@Property(QJsonValue, constant=True)
288-
def systemInfo(self):
287+
def _systemInfo(self):
289288
import platform
290289
import sys
291290
return {
292291
'platform': '{} {}'.format(platform.system(), platform.release()),
293292
'python': 'Python {}'.format(sys.version.split(" ")[0])
294293
}
295294

296-
@Property("QVariantList", constant=True)
297-
def licensesModel(self):
295+
systemInfo = Property(QJsonValue, _systemInfo, constant=True)
296+
297+
def _licensesModel(self):
298298
"""
299299
Get info about open-source licenses for the application.
300300
Model provides:
@@ -316,6 +316,7 @@ def licensesModel(self):
316316
}
317317
]
318318

319+
licensesModel = Property("QVariantList", _licensesModel, constant=True)
319320
recentProjectFilesChanged = Signal()
320321
recentProjectFiles = Property("QVariantList", _recentProjectFiles, notify=recentProjectFilesChanged)
321322

meshroom/ui/reconstruction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,8 @@ def _updateDenseSceneParams(self):
249249
self._undistortedImagePath = os.path.join(self._activeNode_PrepareDenseScene.node.output.value, filename)
250250
self.denseSceneParamsChanged.emit()
251251

252-
@Property(type=QObject, constant=True)
253-
def attribute(self):
254-
""" Get the underlying Viewpoint attribute wrapped by this Viewpoint. """
255-
return self._viewpoint
252+
# Get the underlying Viewpoint attribute wrapped by this Viewpoint.
253+
attribute = Property(QObject, lambda self: self._viewpoint, constant=True)
256254

257255
@Property(type="QVariant", notify=initialParamsChanged)
258256
def initialIntrinsics(self):

0 commit comments

Comments
 (0)