Exemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     DeviceMixin.__init__(self)
     self._display = Display(1280, 720)
     self._rotation = 1
     self.last_click = None
     self.serial = '1234'
     self._fail_first_screenshot = False
Exemplo n.º 2
0
    def screenshot(self, filename=None):
        """Take a screenshot
        Args:
            - filename(string): file name to save

        Returns:
            PIL Image object
        """
        raw_png = self._wda.screenshot()
        img = Image.open(StringIO(raw_png))
        if filename:
            img.save(filename)
        if not self.__display:
            self.__display = Display(*sorted(img.size))
        return img
Exemplo n.º 3
0
 def _init_display(self):
     model = self.d.info['HardwareModel']
     with open(os.path.join(__dir__, 'ios-models.yml'), 'rb') as f:
         items = yaml.load(f.read())
     for item in items:
         if model == item.get('model'):
             (width, height) = map(int, item.get('pixel').split('x'))
             self._scale = item.get('scale')
             self._display = Display(width * self._scale,
                                     height * self._scale)
             break
     if self._display is None:
         raise RuntimeError(
             "TODO: not support your phone for now, You need contact the author."
         )
Exemplo n.º 4
0
 def display(self):
     """ Get screen width and height """
     w, h = self.session.window_size()
     return Display(w * self.scale, h * self.scale)
Exemplo n.º 5
0
 def display(self):
     """Display size in pixels."""
     w, h = self.size
     return Display(w, h)