25
25
from unity8.shell import emulators
26
26
from unity8.shell.emulators.greeter import Greeter
27
27
from unity8.shell.emulators.hud import Hud
28
from unity8.shell.emulators.dash import Dash
29
28
from unity8.shell.emulators.launcher import Launcher
31
30
logger = logging.getLogger(__name__)
76
72
objectName="pinPadLoader"
79
def get_pinPadButton(self, buttonId):
80
return self.select_single(
82
objectName="pinPadButton%i" % buttonId
85
75
def get_lockscreen(self):
86
76
return self.select_single("Lockscreen")
117
107
@autopilot_logging.log_action(logger.info)
118
108
def show_dash_swiping(self):
119
109
"""Show the dash swiping from the left."""
123
start_y = height // 2
110
x, y, width, height = self._get_shell().globalRect
113
start_y = end_y = y + height // 2
127
115
self.pointing_device.drag(start_x, start_y, end_x, end_y)
128
return self.get_dash()
117
def _get_shell(self):
118
return self.select_single('Shell')
130
120
def get_current_focused_app_id(self):
131
121
"""Return the id of the focused application."""
132
return self.select_single('Shell').focusedApplicationId
122
return self._get_shell().focusedApplicationId
134
124
@autopilot_logging.log_action(logger.info)
135
def search(self, query):
136
self.get_dash().enter_search_query(query)
125
def enter_pin_code(self, code):
126
"""Enter code 'code' into the single-pin lightdm pincode entry screen.
128
:param code: must be a string of numeric characters.
129
:raises: TypeError if code is not a string.
130
:raises: ValueError if code contains non-numeric characters.
133
if not isinstance(code, str):
135
"'code' parameter must be a string, not %r."
139
if not num.isdigit():
141
"'code' parameter contains non-numeric characters."
143
self.pointing_device.click_object(
144
self._get_pinpad_button(int(num)))
146
def _get_pinpad_button(self, button_id):
147
return self.select_single(
149
objectName='pinPadButton{}'.format(button_id)