scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

Implement #@script directive with most @Plugin attributes

Open imagejan opened this issue 8 years ago • 6 comments

As discussed with @ctrueden. This should enable scripts to be annotated like this:

#@script(name="coolscript", menuPath="Plugins>My Scripts>Cool Script")

with an optional shortcut to the name attribute:

#@script("coolscript")

Subtasks:

  • [x] Check that named scripts have a better title bar on the dialog
  • [ ] Make menuPath override folder structure; allow toplevel scripts if menuPath is set to something non-empty
    • [ ] Enhance menuPath parsing (for ALL modules) to support shortcut key in brackets at the end, and weight in curly braces at the end

imagejan avatar Sep 22 '17 13:09 imagejan

This might be resolved now with d9dce68bf18b4db0fb812e4685f44fb58d6a988e. But I did not test whether the menuPath is working as described above. @imagejan Want to check it out when you get a chance? Can this issue be closed as resolved? Or is further work needed?

ctrueden avatar Dec 06 '17 10:12 ctrueden

Just an update: the menuPath issue is still not solved, scripts don't show up at the defined menu path, but at the one corresponding to their subfolder of ./scripts/.

Also, when running a script that contains a #@script directive, we currently get:

[WARNING] Ignoring invalid parameter: script ...

This is fixed on the script-imports-jan branch with https://github.com/scijava/scijava-common/commit/ad139e7849fbff316d42492da614b5eabeeda782 by giving a higher priority to ScriptDirectiveScriptProcessor, but we still need to tackle the menu path issue before closing this issue.

imagejan avatar Feb 27 '18 15:02 imagejan

Is there any reason not to simply cherry-pick ad139e7 right now?

ctrueden avatar Feb 28 '18 21:02 ctrueden

@ctrueden wrote:

Is there any reason not to simply cherry-pick ad139e7 right now?

There's no reason not to do that :slightly_smiling_face: I rebased onto master and opened PR https://github.com/scijava/scijava-common/pull/331 to address this.

imagejan avatar Jun 26 '18 15:06 imagejan

Great! So all that's left now is the menu path issue, right?

ctrueden avatar Jun 26 '18 16:06 ctrueden

Yes, we still need to sort out the menu path.

imagejan avatar Jun 27 '18 09:06 imagejan