Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle the connection event of widget output in Orange3?

Tags:

python

orange

I am developing an add-on widget for Orange3. Is there any way to handle the event of connection/disconnection of widget output?

I would like to postpone heavy calculations for one of the outputs until this output is connected with the input of another widget.

like image 424
Dmitriy Kalugin-Balashov Avatar asked Feb 16 '18 22:02

Dmitriy Kalugin-Balashov


1 Answers

As far as I know, there is no signal (Orange3 employs PyQt's signals & slots) in source widget about it being connected with another one.

But you can always postpone heavy computation by hiding it in lazy properties or starting this computation within the receiving widget.

class TargetWidget(OWWidget): 
   @Inputs.obj
   def set_obj(self, obj): 
       # start computation here
       obj.compute()


like image 106
alexey Avatar answered Oct 16 '22 09:10

alexey