Back to index

unity  6.0.0
icons.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: Thomi Richards
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 from unity.emulators import UnityIntrospectionObject
00013 from unity.emulators.quicklist import Quicklist
00014 from unity.emulators.tooltip import ToolTip
00015 
00016 class SimpleLauncherIcon(UnityIntrospectionObject):
00017     """Holds information about a simple launcher icon.
00018 
00019     Do not instantiate an instance of this class yourself. Instead, use the
00020     appropriate methods in the Launcher class instead.
00021 
00022     """
00023 
00024     @property
00025     def center_position(self):
00026         """Get the center point of an icon, returns a tuple with (x, y, z)."""
00027         return (self.center_x, self.center_y, self.center_z)
00028 
00029     def get_quicklist(self):
00030         """Get the quicklist for this launcher icon.
00031 
00032         This may return None, if there is no quicklist associated with this
00033         launcher icon.
00034 
00035         """
00036         matches = self.get_children_by_type(Quicklist)
00037         return matches[0] if matches else None
00038 
00039     def get_tooltip(self):
00040         """Get the tooltip for this launcher icon.
00041 
00042         This may return None, if there is no tooltip associated with this
00043         launcher icon.
00044 
00045         """
00046         matches = self.get_children_by_type(ToolTip)
00047         return matches[0] if matches else None
00048 
00049     def is_on_monitor(self, monitor):
00050         """Returns True if the icon is available in the defined monitor."""
00051         if monitor >= 0 and monitor < len(self.monitors_visibility):
00052             return self.monitors_visibility[monitor]
00053 
00054         return False
00055 
00056     def controls_window(self, xid):
00057         """Returns true if the icon controls the specified xid."""
00058 
00059         return self.xids.contains(xid)
00060 
00061 
00062 class BFBLauncherIcon(SimpleLauncherIcon):
00063     """Represents the BFB button in the launcher."""
00064 
00065 
00066 class HudLauncherIcon(SimpleLauncherIcon):
00067     """Represents the HUD button in the launcher."""
00068 
00069 
00070 class BamfLauncherIcon(SimpleLauncherIcon):
00071     """Represents a launcher icon with BAMF integration."""
00072 
00073 
00074 class TrashLauncherIcon(SimpleLauncherIcon):
00075     """Represents the trash launcher icon."""
00076 
00077 
00078 class DeviceLauncherIcon(SimpleLauncherIcon):
00079     """Represents a device icon in the launcher."""
00080 
00081 
00082 class DesktopLauncherIcon(SimpleLauncherIcon):
00083     """Represents an icon that may appear in the switcher."""
00084 
00085 
00086 class SoftwareCenterLauncherIcon(BamfLauncherIcon):
00087     """Represents a launcher icon of a Software Center app."""
00088 
00089 
00090 class HudEmbeddedIcon(UnityIntrospectionObject):
00091     """Proxy object for the hud embedded icon child of the view."""
00092 
00093     @property
00094     def geometry(self):
00095         return (self.x, self.y, self.width, self.height)
00096 
00097 
00098 class LauncherEntry(UnityIntrospectionObject):
00099     """Proxy for the LauncherEntryRemote instances in Unity."""