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

Qt methods not wrapped correctly #232

Open
jhlegarreta opened this issue Dec 18, 2023 · 1 comment
Open

Qt methods not wrapped correctly #232

jhlegarreta opened this issue Dec 18, 2023 · 1 comment

Comments

@jhlegarreta
Copy link
Contributor

Qt methods are not being wrapped correctly or the wrapping libraries are being loaded in the extension, since Qt properties and public slots are not available in Python.

This is verified when trying to invoke such ivars for the qSlicerTractographyDisplayModuleWidget class in a Python script, e.g.

(...)
# Download and load the data
(...)

m = slicer.util.mainWindow()
m.moduleSelector().selectModule("TractographyDisplay")
display_widget = slicer.util.findChildren(name="qSlicerTractographyDisplayModuleWidget")[0]
opacity = display_widget.opacity()

which yields

AttributeError: qSlicerTractographyDisplayWidget has no attribute named 'opacity'

Being able to write a Python script (test) for that class would potentially avoid regressions in that class (e.g. #229). Although a C++ test could be an option, the test data would need to be stored somewhere and be made available for the test; in Python, this task is done without requiring any additional work through the SampleData::downloadFromURL method.

A thread had been started on 3D Slicer's discourse: https://discourse.slicer.org/t/call-a-widgets-methods-in-python/33416/4

@jhlegarreta
Copy link
Contributor Author

Cross-referencing PR #233.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant