All Classes Functions Properties
unity8.shell.emulators.hud.Hud Class Reference
Inheritance diagram for unity8.shell.emulators.hud.Hud:
[legend]
Collaboration diagram for unity8.shell.emulators.hud.Hud:
[legend]

## Public Member Functions

def | show
def | dismiss
def | get_close_button_coords
def | get_button_swipe_coords

## Public Attributes

| touch

## Detailed Description

    An emulator that understands the Hud.

Definition at line 30 of file hud.py.

## Member Function Documentation

def unity8.shell.emulators.hud.Hud.dismiss | ( |  | self | ) |

    Closes the open Hud.

Definition at line 67 of file hud.py.

def dismiss(self):
"""Closes the open Hud."""
# Ensure that the Hud is actually open
self.shown.wait_for(True)
touch = Touch.create()
x, y = self.get_close_button_coords()
touch.tap(x, y)
self.y.wait_for(self.height)
unity8.shell.emulators.hud.Hud.dismiss
def dismiss
Definition: hud.py:67
unity8.shell.emulators.hud.Hud.get_close_button_coords
def get_close_button_coords
Definition: hud.py:76

def unity8.shell.emulators.hud.Hud.get_button_swipe_coords | ( |  | self,
|  |  | main_view,
|  |  | hud_show_button
| ) |  |

    Returns the coords both start and end x,y for swiping to make the
    'hud show' button appear.

Definition at line 83 of file hud.py.

def get_button_swipe_coords(self, main_view, hud_show_button):
"""Returns the coords both start and end x,y for swiping to make the
'hud show' button appear.
"""
start_x = int(main_view.x + (main_view.width / 2))
end_x = start_x
start_y = main_view.y + (main_view.height - 3)
end_y = main_view.y + int(
hud_show_button.y + (hud_show_button.height/2)
)
return SwipeCoords(start_x, end_x, start_y, end_y)
unity8.shell.emulators.hud.Hud.get_button_swipe_coords
def get_button_swipe_coords
Definition: hud.py:83

def unity8.shell.emulators.hud.Hud.get_close_button_coords | ( |  | self | ) |

    Returns the coordinates of the Huds close button bar.

Definition at line 76 of file hud.py.

def get_close_button_coords(self):
"""Returns the coordinates of the Huds close button bar."""
rect = self.globalRect
x = int(rect[0] + rect[2] / 2)
y = rect[1] + get_grid_size()
return x, y
unity8.shell.emulators.hud.Hud.get_close_button_coords
def get_close_button_coords
Definition: hud.py:76

def unity8.shell.emulators.hud.Hud.show | ( |  | self | ) |

    Swipes open the Hud.

Definition at line 34 of file hud.py.

def show(self):
"""Swipes open the Hud."""
self.touch = Touch.create()
window = self.get_root_instance().wait_select_single('QQuickView')
hud_show_button = window.wait_select_single("HudButton")
swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
self._drag(
swipe_coords.start_x,
swipe_coords.start_y,
swipe_coords.start_x,
swipe_coords.end_y
)
try:
hud_show_button.opacity.wait_for(1.0)
self.touch.release()
self.shown.wait_for(True)
except AssertionError:
raise
finally:
# XXX This ugly code is here just temporarily, waiting for uinput
# improvements to land on autopilot so we don't have to access
# device private internal attributes. --elopio - 2014-02-12
try:
pressed = self.touch._touch_finger is not None
except AttributeError:
pressed = self.touch.pressed
if pressed:
self.touch.release()
unity8.shell.DragMixin._drag
def _drag
Definition: __init__.py:52
unity8.shell.emulators.hud.Hud.get_button_swipe_coords
def get_button_swipe_coords
Definition: hud.py:83
unity8.shell.emulators.hud.Hud.touch
touch
Definition: hud.py:36
unity8.shell.emulators.hud.Hud.show
def show
Definition: hud.py:34

The documentation for this class was generated from the following file:

- tests/autopilot/unity8/shell/emulators/hud.py