<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: More on the DBus Python Bindings</title>
	<atom:link href="http://www.j5live.com/2005/04/20/more-on-the-dbus-python-bindings/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.j5live.com/2005/04/20/more-on-the-dbus-python-bindings/</link>
	<description>Where the urethane hits the pavement</description>
	<lastBuildDate>Mon, 10 Oct 2011 13:34:18 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: James</title>
		<link>http://www.j5live.com/2005/04/20/more-on-the-dbus-python-bindings/comment-page-1/#comment-1332</link>
		<dc:creator>James</dc:creator>
		<pubDate>Thu, 21 Apr 2005 15:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.martianrock.com/?p=47#comment-1332</guid>
		<description>For the dbus_signal() decorator, you might want to try something like this (hopefully the formatting won&#039;t get too mangled):

&lt;code&gt;&lt;pre&gt;
def dbus_signal(dbus_interface):
    def decorator(func):
        def handler(self, *args, **kwargs):
            func(self, *args, **kwargs)
            # however you emit a dbus signal ...
            emit_signal(self, dbus_interface, func.func_name, *args, **kwargs)
        handler.func_name = func.func_name
        return handler
    return decorator
&lt;/pre&gt;&lt;/code&gt;

This decorator wraps the function object so that you can perform a signal emission after running the function.  The assignment to the func_name attribute is so that the proxy function reports the right name in stack traces, etc.</description>
		<content:encoded><![CDATA[<p>For the dbus_signal() decorator, you might want to try something like this (hopefully the formatting won&#8217;t get too mangled):</p>
<p><code>
<pre>
def dbus_signal(dbus_interface):
    def decorator(func):
        def handler(self, *args, **kwargs):
            func(self, *args, **kwargs)
            # however you emit a dbus signal ...
            emit_signal(self, dbus_interface, func.func_name, *args, **kwargs)
        handler.func_name = func.func_name
        return handler
    return decorator
</pre>
<p></code></p>
<p>This decorator wraps the function object so that you can perform a signal emission after running the function.  The assignment to the func_name attribute is so that the proxy function reports the right name in stack traces, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.j5live.com/2005/04/20/more-on-the-dbus-python-bindings/comment-page-1/#comment-1331</link>
		<dc:creator>James</dc:creator>
		<pubDate>Thu, 21 Apr 2005 04:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.martianrock.com/?p=47#comment-1331</guid>
		<description>You should be able to implement your dbus_method decorator with something like this:

&lt;code&gt;&lt;pre&gt;
def dbus_method(interface_name):
    def decorator(func):
        func.dbus_interface = interface_name
        return func
    return decorator
&lt;/pre&gt;&lt;/code&gt;

After the class is constructed, you can check for all methods with dbus_interface attributes to work out what interfaces to provide.  Furthermore, if you use a custom meta-class for dbus.Object, you can do some extra processing at class creation time.</description>
		<content:encoded><![CDATA[<p>You should be able to implement your dbus_method decorator with something like this:</p>
<p><code>
<pre>
def dbus_method(interface_name):
    def decorator(func):
        func.dbus_interface = interface_name
        return func
    return decorator
</pre>
<p></code></p>
<p>After the class is constructed, you can check for all methods with dbus_interface attributes to work out what interfaces to provide.  Furthermore, if you use a custom meta-class for dbus.Object, you can do some extra processing at class creation time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

