コード例 #1
0
ファイル: dummy.py プロジェクト: songjt1993/gitskills
 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
コード例 #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
コード例 #3
0
ファイル: __init__.py プロジェクト: songjt1993/gitskills
 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."
         )
コード例 #4
0
 def display(self):
     """ Get screen width and height """
     w, h = self.session.window_size()
     return Display(w * self.scale, h * self.scale)
コード例 #5
0
 def display(self):
     """Display size in pixels."""
     w, h = self.size
     return Display(w, h)