hi i wish to be able to trigger a send with a thread launched in an Orange python script but i can't figger how.
from PyQt5.QtCore import QThread, pyqtSignal
import Orange.data
import time
#The thread intialisation
class CustomThread(QThread):
finished_signal = pyqtSignal()
send_signal = pyqtSignal(Orange.data.Table)
def __init__(self, in_data, parent=None):
super().__init__(parent)
self.in_data = in_data
def run(self):
for i in range(1, 11):
print(f"Compteur : {i}")
#the signal for the function in the main thread who is suposed to trigger the send out_data
self.send_signal.emit(self.in_data)
time.sleep(1)
self.finished_signal.emit()
def out_data1(data):
new_data = Orange.data.Table(data)
new_data.X[0][0] = 1.0
print(f"Type de l'objet Orange.data.Table : {type(new_data)}")
print(f"Nombre d'instances : {len(new_data)}")
#here the signal is supposed to start
out_data = new_data
return(out_data)
iris = Orange.data.Table("iris")
my_thread = CustomThread(in_data=iris)
my_thread.finished_signal.connect(lambda: print("Le thread est terminé."))
my_thread.send_signal.connect(out_data1)
my_thread.start()
i wish that the data out would be retrigered with each iteration in the thread but it only happen the first iteration