-
Notifications
You must be signed in to change notification settings - Fork 52
Persistence of enum choices in Commands #471
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
Persistence of enum choices in Commands #471
Comments
I think this issue is general for enums (i.e. not only enums with custom labels). Looking at MoBIE's ... non-default values seem to be correctly persisted to preference storage: #@ PrefService ps
#@ ConvertService cs
import org.embl.mobie.command.open.OpenCollectionTableCommand
import org.embl.mobie.command.open.OpenCollectionTableCommand.DataRoot
stringValue = ps.get(OpenCollectionTableCommand.class, "dataRoot")
println(stringValue) // e.g. UseTableFolder
converted = cs.convert(stringValue, DataRoot.class)
println(converted) // e.g. UseTableFolder
println(converted.class) // class org.embl.mobie.command.open.OpenCollectionTableCommand$DataRoot However, the command dialog still falls back to default value every time. Hence I think the issue is somewhere in the command module processing, not in the preferences. @ctrueden would you have a best guess where to dig next? |
This issue has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/scijava-persist-not-working-for-enums/99827/7 |
I noticed that persisted enum values are actually harvested just fine: as long as you don't touch the dropdown widget, the persisted value is kept. It's just the UI that isn't updated to reflect the persisted value 🤦 Consider this Groovy script:
When you run it, the dialog will always show the first enum value, However, if you choose an alternative value (e.g. That means this issue actually belongs to (NB: This didn't work in older Fiji installation of mine that had |
This issue has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/scijava-persist-not-working-for-enums/99827/9 |
I am sorry 😬 ! I did not carefully read @imagejan's above post. tl;dr please simply ignore all my comments. |
With 664b3ab and 61e98d7 it was made possible to use enums with custom labels in scijava commands
However, currently enums with custom labels are not persisted, i.e. if the user makes some settings using an enum with custom labels in a dialog, closes this dialog and comes back to this dialog, the selected value would fall back to the default parameter instead of the last selected parameter, which users may consider a bug, since this behavior would be different to other parameter types.
The text was updated successfully, but these errors were encountered: