Back to index

unity  6.0.0
window_manager.py
Go to the documentation of this file.
00001 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
00002 # Copyright 2012 Canonical
00003 # Author: Marco Trevisan (TreviƱo)
00004 #
00005 # This program is free software: you can redistribute it and/or modify it
00006 # under the terms of the GNU General Public License version 3, as published
00007 # by the Free Software Foundation.
00008 #
00009 
00010 from __future__ import absolute_import
00011 
00012 import logging
00013 from autopilot.keybindings import KeybindingsHelper
00014 
00015 from unity.emulators import UnityIntrospectionObject
00016 
00017 logger = logging.getLogger(__name__)
00018 
00019 
00020 class WindowManager(UnityIntrospectionObject, KeybindingsHelper):
00021     """The WindowManager class."""
00022 
00023     @property
00024     def screen_geometry(self):
00025         """Returns a tuple of (x,y,w,h) for the screen."""
00026         return (self.x, self.y, self.width, self.height)
00027 
00028     def enter_show_desktop(self):
00029         if not self.showdesktop_active:
00030             logger.info("Entering show desktop mode.")
00031             self.keybinding("window/show_desktop")
00032             self.showdesktop_active.wait_for(True)
00033         else:
00034             logger.warning("Test tried to enter show desktop mode while already \
00035                 in show desktop mode.")
00036 
00037     def leave_show_desktop(self):
00038         if self.showdesktop_active:
00039             logger.info("Leaving show desktop mode.")
00040             self.keybinding("window/show_desktop")
00041             self.showdesktop_active.wait_for(False)
00042         else:
00043             logger.warning("Test tried to leave show desktop mode while not in \
00044                 show desktop mode.")