1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2012 Canonical
3
# Author: Marco Trevisan (Treviño)
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.
12
from autopilot.keybindings import KeybindingsHelper
13
from autopilot.emulators.unity import UnityIntrospectionObject
16
logger = logging.getLogger(__name__)
19
class ShortcutController(UnityIntrospectionObject, KeybindingsHelper):
20
"""ShortcutController proxy class."""
23
logger.debug("Revealing shortcut hint with keyboard.")
24
self.keybinding_hold("shortcuthint/reveal")
27
logger.debug("Un-revealing shortcut hint with keyboard.")
28
self.keybinding_release("shortcuthint/reveal")
31
logger.debug("Hide the shortcut hint with keyboard, without releasing the reveal key.")
32
self.keybinding("shortcuthint/cancel")
34
def get_geometry(self):
35
return (self.x, self.y, self.width, self.height)
37
def get_show_timeout(self):
38
return self.timeout_duration / 1000.0
41
return bool(self.enabled)
44
return bool(self.visible)