davemds pushed a commit to branch master.
commit 294bbda78bd1d19b86cc5c4350098a8f161d9412
Author: davemds <[email protected]>
Date: Sun May 5 17:39:19 2013 +0200
Python-EFL: espionage: double-clink on a property to fetch the value
---
examples/dbus/test_dbus_spy.py | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/examples/dbus/test_dbus_spy.py b/examples/dbus/test_dbus_spy.py
index efcb145..d10d318 100755
--- a/examples/dbus/test_dbus_spy.py
+++ b/examples/dbus/test_dbus_spy.py
@@ -85,6 +85,20 @@ class DBusProperty(DBusNode):
parent_iface.properties.append(self)
self._type = typ
self._access = access
+ self._value = None
+
+ def fetch_value(self):
+ named_service = self.parent.parent.parent
+ object_path = self.parent.parent.name
+ iface_name = self.parent.name
+
+ obj = bus.get_object(named_service, object_path)
+ iface = dbus.Interface(obj, "org.freedesktop.DBus.Properties")
+ self._value = iface.Get(iface_name, self.name)
+
+ @property
+ def value(self):
+ return self._value
@property
def type(self):
@@ -302,7 +316,11 @@ class NodeItemClass(GenlistItemClass):
if isinstance(obj, DBusInterface):
return '[IFACE] ' + obj.name
if isinstance(obj, DBusProperty):
- return '[PROP] %s %s (%s)' % (obj.type, obj.name, obj.access)
+ if obj.value:
+ return '[PROP] %s %s (%s) = %s' % \
+ (obj.type, obj.name, obj.access, obj.value)
+ else:
+ return '[PROP] %s %s (%s)' % (obj.type, obj.name, obj.access)
if isinstance(obj, DBusMethod):
params = obj.params_str
rets = obj.returns_str
@@ -371,6 +389,9 @@ class DetailList(Genlist):
def double_click_cb(self, genlist, item):
if isinstance(item.data, DBusMethod):
MethodRunner(self._parent, item.data)
+ elif isinstance(item.data, DBusProperty):
+ item.data.fetch_value()
+ item.update()
### Methods runner
--
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may