class Ux(QMainWindow, window.Ui_MainWindow):
@pyqtSlot()
def do_stop_search(self):
pass
@pyqtSlot(dict)
def do_append_result(self, item):
pass
def on_btn_search_clicked(self):
self.search = SearchThread(self, text)
self.search.run()
class SearchThread(QThread):
to_append_result = pyqtSignal([dict])
to_stop_search = pyqtSignal()
def __init__(self, obj, key_word):
super().__init__()
self.site = obj.site -sharp obj.site is a class
self.key = key_word
self.to_append_result.connect(obj.do_append_result)
self.to_stop_search.connect(obj.do_stop_search)
def run(self):
search = self.site(self.to_append_result)
search.search(self.key) -sharp do a lot of things
self.to_stop_search.emit()
what"s wrong with this implementation?