Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Fix scripted loadable module importing wrapped classes #7464

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Dec 11, 2023

Backports changes originally contributed to main through the following pull requests:

…nction

This is a follow-up to f8fc53b (BUG: Ensure scripted module can depend on
wrapped C++ classes from other modules). It eliminates duplicated code by re-using
qSlicerScriptedUtils::importModulePythonExtensions in the loadable
module factory.

Additionally, unrelated cleanup is implemented by removing the use of Q_ASSERT
in the modulePaths() function.

(cherry picked from commit c23ab06)
This commit reuses the functionality introduced in 2ca77a8 (ENH: Support
scripted module associated only with loadable logics) by extending it to the
scripted loadable module factory (in additional of the loadable module factory).
Now, Python-wrapped C++ classes implemented by loadable modules (Logic, MRML,
MRMLDisplayableManager, VTKWidgets, PythonQt) can be imported in scripted modules,
even when the loading of loadable modules is disabled.

The commit addresses test failures related to the unavailability of the
`slicer.vtkMRMLMarkupsCurveNode` type annotation during module discovery
in tests such as:
* py_nowarning_mainwindow_noloadableTest
* py_nowarning_mainwindow_nocli_noloadableTest
* py_nowarning_nomainwindow_noloadableTest
* py_nowarning_nomainwindow_nocli_noloadableTest

Additionally, unrelated cleanup is implemented by removing the use of Q_ASSERT
in the modulePaths() function.

(cherry picked from commit 389cd99)
@jcfr jcfr requested review from lassoan and sjh26 December 11, 2023 20:05
@jcfr jcfr mentioned this pull request Dec 11, 2023
18 tasks
@jcfr jcfr enabled auto-merge (rebase) December 11, 2023 21:54
Copy link
Contributor

@sjh26 sjh26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jcfr jcfr merged commit 6138fcc into Slicer:5.6 Dec 11, 2023
5 checks passed
@jcfr jcfr deleted the 5.6-backport/fix-scripted-loadable-module-importing-wrapped-classes branch December 11, 2023 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants