def __init__(self, image, location=None): super(EyesImagesScreenshot, self).__init__(image) if location is None: location = Point.create_top_left() argument_guard.is_a(location, Point) self._location = location self._bounds = Region.from_location_size( location, dict(width=self._image.width, height=self._image.height) )
def get_full_window_dom(driver, position_provider=None): # type: (EyesWebDriver, PositionProvider) -> str if position_provider: position_provider.push_state() position_provider.set_position(Point.create_top_left()) dom = _get_window_dom(driver) dom_json = json.dumps(dom) if position_provider: position_provider.pop_state() return dom_json
def push_state(self): """ Adds the transform to the states list. """ transforms = self._get_current_transform() if not all(transforms.values()): self._current_position = Point.create_top_left() else: point = Point(0, 0) for transform in transforms.values(): point += self._get_position_from_transform(transform) self._current_position = point self._states.append(self._current_position)
def current_frame_offset(self): # type: () -> Point location = Point.create_top_left() for frame in self: location.offset_by_location(frame.location) return location