Skip to content

Commit

Permalink
Use better way of detecting synthetic "result" ouput
Browse files Browse the repository at this point in the history
Signed-off-by: Squareys <[email protected]>
  • Loading branch information
Squareys committed Sep 26, 2016
1 parent 4e0736e commit 56398f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.scijava.module.process.PreprocessorPlugin;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.PluginService;
import org.scijava.script.ScriptInfo;

/**
* Default implementation of {@link NodeModule}.
Expand Down Expand Up @@ -175,11 +176,14 @@ public NodeModuleOutputChangedListener(final boolean manualPush) {
public void notifyListener() throws Exception {
// output can be null if sink node
if (output != null) {
final boolean hasSyntheticResult = info instanceof ScriptInfo &&
((ScriptInfo) info).isReturnValueAppended();

final List<DataCell> cells = new ArrayList<DataCell>();
for (final ModuleItem<?> entry : module.getInfo().outputs()) {
// FIXME hack because e.g. python script contains
// result log
if (!entry.getName().equals("result")) {
if (!hasSyntheticResult || !entry.getName().equals("result")) {
cells.add(cs.convertToKnime(
module.getOutput(entry.getName()),
entry.getType(), outputMapping.get(entry),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.scijava.module.ModuleService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import org.scijava.script.ScriptInfo;
import org.scijava.service.AbstractService;

/**
Expand Down Expand Up @@ -100,12 +101,12 @@ public DataTableSpec createOutSpec(final ModuleInfo info,
nameGen = new UniqueNameGenerator(new HashSet<>());
}

// TODO (What?)... What?
final List<DataColumnSpec> tableSpecs = new ArrayList<>();

// FIXME (result)
final boolean hasSyntheticResult = info instanceof ScriptInfo &&
((ScriptInfo) info).isReturnValueAppended();
for (final ModuleItem<?> item : info.outputs()) {
if (item.getName().equals("result")) {
if (!hasSyntheticResult && item.getName().equals("result")) {
continue;
}
tableSpecs.add(
Expand Down

0 comments on commit 56398f7

Please sign in to comment.