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
Add support for registering scripted IOOptionsWidget #6953
base: main
Are you sure you want to change the base?
Conversation
41af0a2
to
6808a72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks great, just added a few comments inline.
Py_DECREF(arguments); | ||
if (!result) | ||
{ | ||
// Method call failed (probably an omitted function), call default implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that we do this all the time, but now that you are working on this and you are so knowledgable about Python integration, I would ask: is it possible to do this better? The main limitation of this is that if an uncaught exception is raised in the reimplemented method then it is silently ignored and it is assumed that the method is just not overridden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is way to address this and simplify across Slicer, will do so in a follow-up PR.
6808a72
to
d4f4dfa
Compare
d4f4dfa
to
b442ad4
Compare
b442ad4
to
81f1444
Compare
@jamesobutler This is now ready for review & testing. |
...sting/Python/ScriptedModuleDiscoveryTest/ModuleG_WithFileReaderAndIOOptions_WithoutWidget.py
Outdated
Show resolved
Hide resolved
@jcfr A few merge conflicts here with various recent integrations. |
This change is implemented anticipating the integration of scripted IOOptionsWidget that will required to override the options() method and instantiate a qSlicerScriptedIOOptionsWidget object.
81f1444
to
7f45704
Compare
7f45704
to
c15664f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcfr Thanks for moving this work forward 🙏🏻 . Using this example I was able to see the progress you made to have options for a scripted file reader:
...sting/Python/ScriptedModuleDiscoveryTest/ModuleG_WithFileReaderAndIOOptions_WithoutWidget.py
Show resolved
Hide resolved
...sting/Python/ScriptedModuleDiscoveryTest/ModuleG_WithFileReaderAndIOOptions_WithoutWidget.py
Outdated
Show resolved
Hide resolved
pass | ||
|
||
def updateProperties(self): | ||
self.parent.properties["coordinateSystem"] = vtkMRMLStorageNode.GetCoordinateSystemTypeFromString( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying this update in my custom scripted file reader, it appears that the properties dictionary isn't updated with these new custom entries. It is only has fileName
and fileType
. Oddly reviewing self.parent.properties
at the end of this method was revealing that the new entry wasn't added and therefore not used in the FileReader's load
method which then uses properties
as an input argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it appears that the properties dictionary isn't updated
Thanks for testing 🙏 I also observed this. I have an idea of the issue and will follow up.
…dget (3) Support updating "Properties" by updating qSlicerScriptedIOOptionsWidget to derive its pimpl from qSlicerIOOptionsPrivate and updating the Q_PROPERTY declaration to use "setProperties" as a write method.
@jamesobutler What we are still missing is the ability to implement Specialization may allow to:
For example: Slicer/Modules/Loadable/Volumes/qSlicerVolumesReader.cxx Lines 219 to 253 in 516716c
|
No description provided.