summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Frank Erikson <kristian@kristian-desktop.(none)>2009-01-11 13:30:29 +1300
committerKristian Frank Erikson <kristian@kristian-desktop.(none)>2009-01-11 13:30:29 +1300
commit41cb12bed864f364df1399d56589ad20f67cb229 (patch)
tree3528f67eb86528a685e3a42944eb590a75f98c67
parent577b4158140595eb7d89ff606f558ad3b8f99cf2 (diff)
downloadpython-compiz-manager-41cb12bed864f364df1399d56589ad20f67cb229.tar.gz
python-compiz-manager-41cb12bed864f364df1399d56589ad20f67cb229.tar.bz2
Updates to the readme and the built in python documentation.
-rwxr-xr-xCompizManager.py35
-rw-r--r--README79
2 files changed, 81 insertions, 33 deletions
diff --git a/CompizManager.py b/CompizManager.py
index 6e89221..24ce8b1 100755
--- a/CompizManager.py
+++ b/CompizManager.py
@@ -37,7 +37,7 @@ class CompizManager(object):
"""
def __init__(self):
- """ Build a compiz manager instance """
+ """ Build a compiz manager instance. """
self.connection = CompizConnection()
self.pluginDict = {}
self.pluginNameList = []
@@ -58,7 +58,7 @@ class CompizManager(object):
pass
def buildPlugins(self): # Creates new plugin objects for each of the plugins
- """ Internal function that builds the plugins and their options and actions """
+ """ Internal function that builds the plugins and their options and actions. """
tree = xml.etree.ElementTree.parse("plugins.xml") # Builds even is Compiz not running
for pluginName in self.pluginNameList:
plugin = CompizPlugin(pluginName, self)
@@ -67,12 +67,12 @@ class CompizManager(object):
self.pluginDict[pluginName] = plugin # Save once parsed from XML
def getPlugin(self, pluginName): # Returns specified plugin object (if active)
- """ Returns a representation of a Compiz plugin, if Compiz is running """
+ """ Returns a representation of a Compiz plugin, if Compiz is running. """
if self.active: return self.pluginDict[pluginName]
else: raise CompizNotActiveError
def listActivePlugins(self): # List all currently active plugins
- """ Returns a list of currently active Compiz plugins """
+ """ Returns a list of currently active Compiz plugins. """
if self.active:
activePluginTuple = self.connection.get('/core/allscreens/active_plugins')
activePlugins = convertFromDbusToPython(activePluginTuple)
@@ -81,12 +81,12 @@ class CompizManager(object):
else: raise CompizNotActiveError
def listAllPlugins(self): # List all avaible plugins
- """ Returns a list of all available Compiz plugins (active and inactive) """
+ """ Returns a list of all available Compiz plugins (active and inactive). """
if self.active: return self.pluginNameList
else: raise CompizNotActiveError
def listInactivePlugins(self): # List inactive plugins = pluginNameList - activePluginList
- """ Returns a list of currently inactive Compiz plugins """
+ """ Returns a list of currently inactive Compiz plugins. """
if self.active:
self.listActivePlugins()
self.inactivePluginList = []
@@ -99,7 +99,7 @@ class CompizManager(object):
else: raise CompizNotActiveError
def activatePlugin(self, pluginNames): # takes a tuple of names (strings) or a single name
- """ Activates plugins, either takes a single name or tuple of names """
+ """ Activates plugins, either takes a single name or tuple of names. """
if self.active:
if type(pluginNames) == type('s'): # if it's a string
if pluginNames in self.pluginNameList:
@@ -125,7 +125,7 @@ class CompizManager(object):
else: raise CompizNotActiveError
def deactivatePlugin(self, pluginNames): # takes a tuple of names (strings) or a single name
- """ Deactivates plugins, takes either a single name or tuple of names """
+ """ Deactivates plugins, takes either a single name or tuple of names. """
if self.active:
if type(pluginNames) == type('s'): # if it's a string
if pluginNames in self.pluginNameList:
@@ -151,25 +151,28 @@ class CompizManager(object):
else: raise CompizNotActiveError
def setActivePluginList(self, pluginList):
- """ Lets you set the list of currently active plugins. Proceed with caution. """
+ """ Lets you set the list of currently active plugins. """
if self.active:
dbusArray = convertFromPythonToDbus(pluginList)
self.connection.setActivePlugins(dbusArray)
else: raise CompizNotActiveError
def pluginDoAction(self, pluginName, action, parameters=None):
- """ Get a plugin to do an action with parameters without having to get the plugin first """
+ """ Get a plugin to do an action with parameters without having to get\n\
+ the plugin first. Assuming the plugin is active or you will get an \n\
+ exception. """
if self.active:
plugin = self.pluginDict[pluginName]
plugin.doAction(action, parameters)
else: raise CompizNotActiveError
def listWindows(self):
- import CompizPyWindowList
"""
- For now this simply returns a list containing tuples of windows titles and window id's.
-
- Hopefully in the future it will have more specific details like which viewport or face of the cube, etc. -- Not yet implemented """
+ For now this simply returns a list containing tuples of windows \n\
+ titles and window id's. Hopefully in the future it will have more \n\
+ specific details like which viewport or face of the cube, etc, but \n\
+ this is not yet implemented. """
+ import CompizPyWindowList
# Go get the list of windows from the now C extension written specifically
# Implementation using wmctrl source code
@@ -177,7 +180,7 @@ class CompizManager(object):
def AllToScreen():
- """ Prints all Plugins with their actions and options to the screen """
+ """ Prints all Plugins with their actions and options to the screen. """
listofPlugins = manager.listAllPlugins()
for plugin in listofPlugins:
tempPlugin = manager.getPlugin(plugin)
@@ -187,7 +190,7 @@ def AllToScreen():
def AllToFile(fileName):
- """ Prints all Plugins with their actions and options to a file """
+ """ Prints all Plugins with their actions and options to a file. """
listofPlugins = manager.listAllPlugins()
output = open(fileName, 'w')
for plugin in listofPlugins:
diff --git a/README b/README
index 233139d..884b45f 100644
--- a/README
+++ b/README
@@ -1,7 +1,33 @@
-
python-compiz-manager - Python module for using Compiz easily
+Dependencies:
+Development packages for the following:
+ - glib-2.0
+ - X11
+ - Xmu
+ - X11-xcb
+ - xcb
+On Ubuntu 8.10 these are packaged as:
+x11proto-core-dev libx11-dev libxmu-dev libglib2.0-dev
+
+
+IMPORTANT:
+--------------------------------------------------------------------------------
+Currently to configure enable window listing you must first build the module.
+You can do this by going to the folder where this file in located and using:
+
+~$ python CompizPyWindowList-setup.py build_ext -i
+
+If that for some reason fails check CompizPyWindowList-setup.py and make sure
+you've satisfied all the dependencies, and that the directories in the
+'include_dirs' match on your machine. Intruction for how to do this are
+described in the file.
+--------------------------------------------------------------------------------
+
+
+USAGE:
+--------------------------------------------------------------------------------
I hope to briefly outline how this module can be used through some examples:
--------------------------------------------------------------------------------
import CompizManager
@@ -23,37 +49,56 @@ corePlugin.doAction('maximize_window', {'window':'Buddy List'})
corePlugin.doAction('close_window', {'window':'Buddy List'})
--------------------------------------------------------------------------------
+
+GENERAL:
+--------------------------------------------------------------------------------
There are two main classes in the module, with the following uses:
class CompizManager()
Getting plugins:
- getPlugin( pluginName )
- - Returns a Compiz plugin
+ getPlugin(self, pluginName)
+ - Returns a representation of a Compiz plugin, if Compiz is running.
+
+ Doing things with plugins:
+ pluginDoAction(self, pluginName, action, parameters=None)
+ - Get a plugin to do an action with parameters without having to get
+ - the plugin first. Assuming the plugin is active or you will get an
+ - exception.
Plugin management:
- activatePlugin( pluginName(s) )
- - activates plugins, either takes a single name or tuple of names
+ activatePlugin(self, pluginNames)
+ - Activates plugins, either takes a single name or tuple of names.
- deactivatePlugin( pluginName(s) )
- - deactivates plugins, either takes a single name or tuple of names
+ deactivatePlugin(self, pluginNames)
+ - Deactivates plugins, takes either a single name or tuple of names.
Fetching information about plugins:
- listAllPlugins()
- - returns a list of all available Compiz plugins (active and inactive)
+ listAllPlugins(self)
+ - Returns a list of all available Compiz plugins (active and inactive).
- listActivePlugins()
- - returns a list of currently active Compiz plugins
+ listActivePlugins(self)
+ - Returns a list of currently active Compiz plugins.
- listInactivePlugins()
- - returns a list of currently inactive Compiz plugins
+ listInactivePlugins(self)
+ - returns a list of currently inactive Compiz plugins.
+
+ setActivePluginList(self, pluginList)
+ - Lets you set the list of currently active plugins.
+
+ Fetching information about windows:
+ listWindows(self)
+ - For now this simply returns a list containing tuples of windows
+ - titles and window id's. Hopefully in the future it will have more
+ - specific details like which viewport or face of the cube, etc, but
+ - this is not yet implemented.
class CompizPlugin()
Option related:
listOptions()
- - returns a list of available options for the plugin
+ - returns a list of available options for the plugin.
getOption( optionName )
- - returns value associated with the option
+ - returns value associated with the option.
setOption( optionName, newValue )
- sets the value of an option. Refer to listOptions() to determine what
@@ -61,7 +106,7 @@ class CompizPlugin()
Action related:
listActions()
- - returns a list of available actions for the plugin
+ - returns a list of available actions for the plugin.
doAction( actionName, args )
- calls an action. Some actions require arguments which then must be
@@ -72,5 +117,5 @@ class CompizPlugin()
update()
- can be used after a plugin has been activated to change it's status
and reload it's options and actions from the Dbus.
-
+--------------------------------------------------------------------------------