Source code for ewoksorange.tests.test_dynamic_link

import pytest
from ewokscore.task import Task
from ewoksutils.import_utils import qualname

from ..gui.orange_utils.signals import Input
from ..gui.owwidgets.base import OWWidget
from ..gui.owwidgets.nothread import OWEwoksWidgetNoThread
from ..gui.owwidgets.registration import register_owwidget
from ..gui.workflows.owscheme import ewoks_to_ows
from ..orange_version import ORANGE_VERSION


[docs] class Mother(int): ...
[docs] class SubClass(Mother): ...
if ORANGE_VERSION != ORANGE_VERSION.oasys_fork: # else with oasys we need to provide the 'handler' mechanism
[docs] class NativeWidget(OWWidget): name = "native widget" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._data = None
[docs] class Inputs: data = Input("data", type=Mother)
@Inputs.data def data_received(self, data): self._data = data
[docs] class EwoksTask( Task, input_names=(), output_names=("data",), ):
[docs] def run(self): self.outputs.data = SubClass(2)
[docs] class EwoksOrangeWidget(OWEwoksWidgetNoThread, ewokstaskclass=EwoksTask): name = "ewoks widget"