def run(self): while True: if image_update_flag: self.img = Shooter.get_img() if self.img is None: self.ok = False self.ui.setConnectionStatus(False) else: self.ok = True self.ui.setConnectionStatus(True) self.calc_image() time.sleep(0.1) if self.ok and self.gameplay: #self.new: self.ui.Log("making move...") self.t = Timer(0.5, self.update_thinking_status) self.t.start() if main.move(self.table, self.ui): #self.gameplay = False pass self.t.cancel() ui.update_thinking_bar() ui.update_thinking_label("") self.new = False if self.set_pos_flag: main.set_position(self.table) self.set_pos_flag = False
def calibrate_image(self): logger.log("calibrating image") global image_update_flag image_update_flag = False try: img = Shooter.get_img() ImageProcess.calibrate_board(img) except Exception as ex: logger.log("cannot calibrate image" + str(ex),error=True) image_update_flag = True
def calibrate_image(self): logger.log("calibrating image") global image_update_flag image_update_flag = False try: img = Shooter.get_img() ImageProcess.calibrate_board(img) except Exception as ex: logger.log("cannot calibrate image" + str(ex), error=True) image_update_flag = True