Unity 8
 All Classes Functions
unity8.shell.emulators.hud.Hud Class Reference
Inheritance diagram for unity8.shell.emulators.hud.Hud:
Collaboration diagram for unity8.shell.emulators.hud.Hud:

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.

67 
68  def dismiss(self):
69  """Closes the open Hud."""
70  # Ensure that the Hud is actually open
71  self.shown.wait_for(True)
72  touch = Touch.create()
73  x, y = self.get_close_button_coords()
74  touch.tap(x, y)
75  self.y.wait_for(self.height)
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.

83 
84  def get_button_swipe_coords(self, main_view, hud_show_button):
85  """Returns the coords both start and end x,y for swiping to make the
86  'hud show' button appear.
87  """
88  start_x = int(main_view.x + (main_view.width / 2))
89  end_x = start_x
90  start_y = main_view.y + (main_view.height - 3)
91  end_y = main_view.y + int(
92  hud_show_button.y + (hud_show_button.height/2)
93  )
94 
95  return SwipeCoords(start_x, end_x, start_y, end_y)
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.

76 
77  def get_close_button_coords(self):
78  """Returns the coordinates of the Huds close button bar."""
79  rect = self.globalRect
80  x = int(rect[0] + rect[2] / 2)
81  y = rect[1] + get_grid_size()
82  return x, y
def unity8.shell.emulators.hud.Hud.show (   self)
Swipes open the Hud.

Definition at line 34 of file hud.py.

34 
35  def show(self):
36  """Swipes open the Hud."""
37  self.touch = Touch.create()
38 
39  window = self.get_root_instance().wait_select_single('QQuickView')
40  hud_show_button = window.wait_select_single("HudButton")
41 
42  swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
43 
44  self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
45  self._drag(
46  swipe_coords.start_x,
47  swipe_coords.start_y,
48  swipe_coords.start_x,
49  swipe_coords.end_y
50  )
51  try:
52  hud_show_button.opacity.wait_for(1.0)
53  self.touch.release()
54  self.shown.wait_for(True)
55  except AssertionError:
56  raise
57  finally:
58  # XXX This ugly code is here just temporarily, waiting for uinput
59  # improvements to land on autopilot so we don't have to access
60  # device private internal attributes. --elopio - 2014-02-12
61  try:
62  pressed = self.touch._touch_finger is not None
63  except AttributeError:
64  pressed = self.touch.pressed
65  if pressed:
66  self.touch.release()

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