RYX
March 1st, 2007, 12:37 AM
I am trying to get all options of a plugin with a dbus-call but somehow I always get an empty list ...
#!/usr/bin/env python
# A little test of getting compiz-options from python ...
#
# (by RYX) - can be used freely
import dbus
# init service/interface
COMPIZ_DBUS_SERVICE = 'org.freedesktop.compiz'
COMPIZ_DBUS_INTERFACE = 'org.freedesktop.compiz'
# get session bus
bus = dbus.SessionBus()
# utility function to call methods in compiz
def compiz_call_method(obj_path, func_name, *args):
"""Call method in obj_path in compiz-service over dbus."""
tmp_obj = bus.get_object(COMPIZ_DBUS_SERVICE, obj_path)
tmp_iface = dbus.Interface(tmp_obj, COMPIZ_DBUS_INTERFACE)
func = getattr(tmp_iface, func_name)
if func:
return func(*args)
return None
# test getting various things
#print compiz_call_method('/org/freedesktop/compiz', 'getPlugins')
#print compiz_call_method('/org/freedesktop/compiz', 'getPluginMetadata', 'cube')
#print compiz_call_method('/org/freedesktop/compiz/core/allscreens', 'list')
print compiz_call_method('/org/freedesktop/compiz/cube/allscreens', 'list')
The commented calls work fine. Getting list of plugins is no problem, getting core options works, getting metadata works - only plugin-options are empty. Does anyone know how to retrieve the list of options for a plugin? Or am I doing it wrong?
(I thought the plugins would offer some type of dbus-interface, but they don't, am I right? Just method-calls ...)
Thanks in advance.
:)
#!/usr/bin/env python
# A little test of getting compiz-options from python ...
#
# (by RYX) - can be used freely
import dbus
# init service/interface
COMPIZ_DBUS_SERVICE = 'org.freedesktop.compiz'
COMPIZ_DBUS_INTERFACE = 'org.freedesktop.compiz'
# get session bus
bus = dbus.SessionBus()
# utility function to call methods in compiz
def compiz_call_method(obj_path, func_name, *args):
"""Call method in obj_path in compiz-service over dbus."""
tmp_obj = bus.get_object(COMPIZ_DBUS_SERVICE, obj_path)
tmp_iface = dbus.Interface(tmp_obj, COMPIZ_DBUS_INTERFACE)
func = getattr(tmp_iface, func_name)
if func:
return func(*args)
return None
# test getting various things
#print compiz_call_method('/org/freedesktop/compiz', 'getPlugins')
#print compiz_call_method('/org/freedesktop/compiz', 'getPluginMetadata', 'cube')
#print compiz_call_method('/org/freedesktop/compiz/core/allscreens', 'list')
print compiz_call_method('/org/freedesktop/compiz/cube/allscreens', 'list')
The commented calls work fine. Getting list of plugins is no problem, getting core options works, getting metadata works - only plugin-options are empty. Does anyone know how to retrieve the list of options for a plugin? Or am I doing it wrong?
(I thought the plugins would offer some type of dbus-interface, but they don't, am I right? Just method-calls ...)
Thanks in advance.
:)