Skip to content

Resolve "Add default widget for tasks that don't have any"

Closes #14 (closed)

When executing an Ewoks graph with Orange (pops up the GUI), use a default widget for Ewoks tasks that don't have an Orange widget associated to them.

from ewokscore import Task
from ewokscore import load_graph
from ewokscore.utils import qualname
from ewoksorange.bindings import ewoks_to_ows
from ewoksorange import execute_graph


class Dummy(Task, input_names=["a"], output_names=["b"]):
    def run(self):
        self.outputs.b = self.inputs.a + 1
        print(self.inputs.a, "->", self.outputs.b)


nodes = [
    {
        "id": "task1",
        "task_type": "class",
        "task_identifier": qualname(Dummy),
        "default_inputs": [{"name": "a", "value": 1}],
    },
    {
        "id": "task2",
        "task_type": "class",
        "task_identifier": qualname(Dummy),
    },
]

links = [
    {
        "source": "task1",
        "target": "task2",
        "data_mapping": [{"source_output": "b", "target_input": "a"}],
    }
]

graph = load_graph({"nodes": nodes, "links": links})

ewoks_to_ows(graph, "test.ows")
execute_graph(graph)

image

Edited by Wout De Nolf

Merge request reports