def test_answer(): api = APIReader() api.update() assert len(api.active_mission_details) > 1 for mission in api.active_mission_details: assert len(mission) == 4
class APIThread(QThread): def __init__(self, gui): QThread.__init__(self) self.api = APIReader(gui=gui) def __del__(self): self.api.cancel_event() self.wait() def run(self): self.api.run(blocking=False)
def init_threads(self): self.ocr_thread = OCRThread(self.window) self.window.set_ocr_connection(self.ocr_thread.ocr) self.ocr_thread.start() api = APIReader(gui=self.window) self.api_thread = APIThread(self.window) self.window.set_api(api) self.api_thread.start() self.market_api = self.window.market_api
def run(self): app = ApplicationContext() window = Window() app.app.setWindowIcon(QIcon(window.icon_path)) dark_stylesheet = qdarkstyle.load_stylesheet_pyqt5() app.app.setStyleSheet(dark_stylesheet) ocr_thread = OCRThread(window) window.set_ocr_connection(ocr_thread.ocr) ocr_thread.start() api = APIReader(gui=window) api_thread = APIThread(window) window.set_api(api) api_thread.start() market_api = window.market_api exit_code = app.app.exec_() ocr_thread.ocr.exit_now = True market_api.exit_now = True ocr_thread.terminate() api_thread.terminate() return exit_code
def __init__(self, gui): QThread.__init__(self) self.api = APIReader(gui=gui)