-
Notifications
You must be signed in to change notification settings - Fork 26
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
ImageJ2Options: add log level selection #137
Conversation
@@ -80,10 +80,20 @@ | |||
description = "<html>Whether to use ImageJ2's file I/O mechanism when " | |||
+ "opening files.<br>Image files will be opened using the SCIFIO library " | |||
+ "(SCientific Image<br>Format Input and Output), which provides truly " | |||
+ "extensible support for<br>reading and writing image file formats.", | |||
+ "extensible support for<br>reading and writing image file formats.</html>", |
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.
Is that closing tag really necessary?
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.
With HTML5 it is optional. Shall I remove it?
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.
Well, that HTML is the bastardized Java version, which Swing uses for rich text formatting. AFAIK, you absolutely do not need the closing tag. And in any case: adding it here is unrelated to the stated purpose of your commit.
Yes, although you shouldn't need to access the widget. Just give the field an
Not without breaking backwards API compatibility in SciJava Common. I guess we could do this for SJC3. But what would be the advantage? I guess as things stand, when you call |
de4895c
to
243739c
Compare
That does not set the selection of the combo box. That's why I was asking about the widget. Should the selection of the combo box be set according to the value of the annotated field?
Exactly... |
Yes, that is what is supposed to happen. The initial value of the field should determine the initially selected item of the combo box, according to the |
/** | ||
* Parses a log level from a {@code int} | ||
* | ||
* FIXME Could be removed if log level is defined as enumeration |
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.
Please mark this as TODO
rather than FIXME
. From the ImageJ coding style page:
- For code (or lack thereof) that is considered wrong or broken, and in need of repair, we add a "FIXME" comment with the relevant developer's initials, to serve as a reminder to address it as soon as time allows.
- When additional work is needed somewhere, but not urgently, we add a "TODO" comment marking it.
That does not work for me. Some additional insights, @ctrueden
Shall I open a new issue? |
4dcc348
to
d96d028
Compare
I just tried to debug into this and could not reproduce. It then occurred to me what the problem is: the parameter value was persisted by the |
We could add a hack that the |
It did 👏 Thanks, @ctrueden!
I would appreciate that hack since debugging such issues repeatedly is a pain (I thought the issue was somewhere with the |
Sure. Here is where you would add the following code: // NB: Do not persist values which are computed via an initializer.
if (item.getInitializer() != null && !item.getInitializer().isEmpty()) return; Again: this breaks the (theoretical) use case where a command uses the initializer to specify the initial initial value (i.e.: the initial value the first time the command ever runs), but then wants to prefer the last-chosen value of the user for the initial value upon subsequent executions. I am not sure whether that is a big deal. But without this hack, you can have the behavior work either way, by setting |
Disable the persisting of a ModuleItems if an initialize() method is set and is not empty. This way, initialize() can overwrite the value of a ModuleItem even if persist=true is assumed implicitly. See: * imagej/imagej-legacy#137 (comment)
Feel free to do it yourself the next time (if it is just one line). I think writing that comment has taken you longer than actually integrating that line 😄 |
Nope, I didn't test it. And untested code is nonworking code. Besides: I am trying to train you. Training always takes longer than doing it yourself. But hopefully not globally over all time. |
@@ -90,9 +90,10 @@ | |||
@Parameter( | |||
label = "SciJava log level", | |||
description = "<html>Log level for SciJava</html", | |||
initializer = "initializeLogLevel", |
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.
Please add persist = false
just for clarity here (even though scijava/scijava-common#236 will probably merge soon).
@stelfrich Can you take a couple of minutes to clean up these commits as mentioned in my earlier comments? Then we can merge it! |
Thanks for the comments @ctrueden. I took the liberty to reformat both |
f252ed6
to
7cd2af8
Compare
Disable the persisting of a ModuleItems if an initialize() method is set and is not empty. This way, initialize() can overwrite the value of a ModuleItem even if persist=true is assumed implicitly. See: * imagej/imagej-legacy#137 (comment)
7cd2af8
to
be07ac0
Compare
I finally found time to rewrite/clean these commits. Merging. Thanks again @stelfrich! |
Add selection of the SciJava log level to the ImageJ2 options dialog.
Known issues:
initialize()
method?LogService.WARN
, etc, be implemented as an enum?