/usr/lib/python2.7/dist-packages/unity/emulators/screen.py is in unity-autopilot 7.5.0+18.04.20180413-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
# Author: Marco Trevisan (TreviƱo)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
from __future__ import absolute_import
import logging
from unity.emulators import UnityIntrospectionObject
from testtools.matchers import GreaterThan
from autopilot.introspection.types import Rectangle
from unity.emulators.dash import SearchBar
logger = logging.getLogger(__name__)
class Screen(UnityIntrospectionObject):
"""The Screen class."""
@property
def windows(self):
"""Return the available windows, or None."""
return self.get_children_by_type(Window)
@property
def scaled_windows(self):
"""Return the available scaled windows, or None."""
return self.get_children_by_type(Window, scaled=True)
@property
def spread_filter(self):
"""Return the spread filter, or None."""
filter = self.get_children_by_type(SpreadFilter)
if len(filter):
return filter[0]
return None
def window(self, xid):
"""Return the window with given xid."""
windows = self.get_children_by_type(Window, xid=xid)
if len(windows):
return windows[0]
return None
class Window(UnityIntrospectionObject):
"""An individual window."""
@property
def geometry(self):
"""Returns a Rectangle (x,y,w,h) for the current window."""
return self.globalRect
@property
def scale_close_geometry(self):
"""Returns a Rectangle (x,y,w,h) for the scale close button."""
self.scaled_close_width.wait_for(GreaterThan(0))
self.scaled_close_height.wait_for(GreaterThan(0))
return Rectangle(self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height)
class SpreadFilter(UnityIntrospectionObject):
"""The spread filter."""
@property
def search_bar(self):
"""Return the search bar."""
[search_bar] = self.get_children_by_type(SearchBar)
return search_bar
|