How to use the uiautomator2.ext-archived.aircv.__init__.Aircv function in uiautomator2

To help you get started, we’ve selected a few uiautomator2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openatx / uiautomator2 / uiautomator2 / ext-archived / aircv / __init__.py View on Github external
def find_template_by_crop(self, img, area=None):
        if Aircv.support_network:
            img_url = "".join(["http://", Aircv.host, Aircv.path, img])
            data = requests.get(img_url)
            img_serch = self.cvHandler.imdecode(data.content)
        else:
            img_serch = self.cvHandler.imread(img)
        if area:
            crop_img = self.aircv_cache_image[area[1]:area[3], area[0]:area[2]]
            result = self.cvHandler.find_template(crop_img, img_serch)
            point = result['result'] if result else None
            if point:
                point = (point[0] + area[0], point[1] + area[1])
        else:
            crop_img = self.aircv_cache_image
            result = self.cvHandler.find_template(crop_img, img_serch)
            point = result['result'] if result else None

        return (int(point[0] * self.zoom_out), int(point[1] * self.zoom_out)) if point else None
github openatx / uiautomator2 / uiautomator2 / ext-archived / aircv / __init__.py View on Github external
def find_template_by_crop(self, img, area=None):
        if Aircv.support_network:
            img_url = "".join(["http://", Aircv.host, Aircv.path, img])
            data = requests.get(img_url)
            img_serch = self.cvHandler.imdecode(data.content)
        else:
            img_serch = self.cvHandler.imread(img)
        if area:
            crop_img = self.aircv_cache_image[area[1]:area[3], area[0]:area[2]]
            result = self.cvHandler.find_template(crop_img, img_serch)
            point = result['result'] if result else None
            if point:
                point = (point[0] + area[0], point[1] + area[1])
        else:
            crop_img = self.aircv_cache_image
            result = self.cvHandler.find_template(crop_img, img_serch)
            point = result['result'] if result else None
github openatx / uiautomator2 / uiautomator2 / ext-archived / aircv / __init__.py View on Github external
def swipe_points(self, img_list, duration=0.5, timeout=timeout, area=None):
        point_list = []
        while timeout:
            if self.debug:
                print(timeout)
            if self.aircv_cache_image is not None:
                for img in img_list:
                    point = self.find_template_by_crop(img, area)
                    if not point:
                        break
                    point_list.append(point)
            if len(point_list) == len(img_list):
                time.sleep(Aircv.wait_before_operation)
                self.d.swipe_points(point_list, duration)
                break
            else:
                timeout -= 1
                time.sleep(1)
            if not timeout:
                raise RuntimeError('No image found')
github openatx / uiautomator2 / uiautomator2 / ext-archived / aircv / __init__.py View on Github external
def on_message(ws, message):
            this = self
            if isinstance(message, bytes):

                if int(time.time()) - this.__rcv_interva_time_cache >= Aircv.rcv_interval:
                    # with open(this.aircv_cache_image_name, 'wb') as f:
                    #     f.write(message)
                    # this.aircv_cache_image = this.cvHandler.imread(self.aircv_cache_image_name)
                    this.aircv_cache_image = this.cvHandler.imdecode(message)
                    this.__rcv_interva_time_cache = int(time.time())