1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2012 Canonical
3
# Author: Thomi Richards
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
10
from autopilot.keybindings import KeybindingsHelper
11
from autopilot.emulators.unity import UnityIntrospectionObject
14
class HudView(UnityIntrospectionObject):
15
"""Proxy object for the hud view child of the controller."""
18
class HudController(UnityIntrospectionObject, KeybindingsHelper):
19
"""Proxy object for the Unity Hud Controller."""
21
def ensure_hidden(self):
22
"""Hides the hud if it's not already hidden."""
26
def ensure_visible(self):
27
"""Shows the hud if it's not already showing."""
28
if not self.is_visible():
34
def toggle_reveal(self, tap_delay=0.1):
35
"""Tap the 'Alt' key to toggle the hud visibility."""
36
self.keybinding("hud/reveal", tap_delay)
39
views = self.get_children_by_type(HudView)
40
return views[0] if views else None
43
def selected_button(self):
44
view = self._get_view()
46
return view.selected_button
51
def num_buttons(self):
52
view = self._get_view()
54
return view.num_buttons