20 from collections
import namedtuple
22 from unity8
import get_grid_size
25 from autopilot.input
import Touch
27 SwipeCoords = namedtuple(
'SwipeCoords',
'start_x end_x start_y end_y')
32 """An emulator that understands the Hud."""
35 """Swipes open the Hud."""
36 self.
touch = Touch.create()
38 window = self.get_root_instance().wait_select_single(
'QQuickView')
39 hud_show_button = window.wait_select_single(
"HudButton")
43 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
51 hud_show_button.opacity.wait_for(1.0)
53 self.shown.wait_for(
True)
54 except AssertionError:
61 pressed = self.touch._touch_finger
is not None
62 except AttributeError:
63 pressed = self.touch.pressed
68 """Closes the open Hud."""
70 self.shown.wait_for(
True)
71 touch = Touch.create()
74 self.y.wait_for(self.height)
77 """Returns the coordinates of the Huds close button bar."""
78 rect = self.globalRect
79 x = int(rect[0] + rect[2] / 2)
80 y = rect[1] + get_grid_size()
84 """Returns the coords both start and end x,y for swiping to make the
85 'hud show' button appear.
87 start_x = int(main_view.x + (main_view.width / 2))
89 start_y = main_view.y + (main_view.height - 3)
90 end_y = main_view.y + int(
91 hud_show_button.y + (hud_show_button.height/2)
94 return SwipeCoords(start_x, end_x, start_y, end_y)
def get_button_swipe_coords
def get_close_button_coords