<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mindtrove &#187; mono</title>
	<atom:link href="http://mindtrove.info/tag/mono/feed/" rel="self" type="application/rss+xml" />
	<link>http://mindtrove.info</link>
	<description>Collecting ideas since 1980</description>
	<lastBuildDate>Thu, 01 Jul 2010 01:58:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>GtkBuilder/Glade on IronPython</title>
		<link>http://mindtrove.info/gtkbuilderglade-on-ironpython/</link>
		<comments>http://mindtrove.info/gtkbuilderglade-on-ironpython/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 12:10:48 +0000</pubDate>
		<dc:creator>Peter Parente</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[pgo]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://mindtrove.info/?p=236</guid>
		<description><![CDATA[Thanks to Stephane for his answer to my query about using GtkBuilder in IronPython. It turns out his Gtk#Beans package provides the magic sauce that is currently missing from gtk# trunk the current stable release. For completeness, here's the code I sent him that accomplishes the same thing using the older Glade.XML object for those [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to Stephane for his answer to my query about <a href="http://blog.reblochon.org/2009/08/gtkbuilder-on-ironpython.html">using GtkBuilder in IronPython</a>. It turns out his <a href="http://gitorious.org/gtk-sharp-beans">Gtk#Beans</a> package provides the magic sauce that is currently missing from <del datetime="2009-08-28T15:37:36+00:00">gtk# trunk</del> the current stable release.</p>
<p>For completeness, here's the code I sent him that accomplishes the same thing using the older Glade.XML object for those that are interested. It answers a <a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2005-August/000968.html">long standing mailing list question</a> about using Glade.XML.Autoconnect in IronPython.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> clr
clr.<span style="color: black;">AddReference</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'gtk-sharp'</span><span style="color: black;">&#41;</span>
clr.<span style="color: black;">AddReference</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'glade-sharp'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">import</span> Gtk
<span style="color: #ff7700;font-weight:bold;">import</span> Glade
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> PyGladeAutoconnect<span style="color: black;">&#40;</span>gxml, target<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> _connect<span style="color: black;">&#40;</span>handler_name, event_obj, signal_name, <span style="color: #66cc66;">*</span>args<span style="color: black;">&#41;</span>:
        name = <span style="color: #483d8b;">''</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>frag.<span style="color: black;">title</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> frag <span style="color: #ff7700;font-weight:bold;">in</span> signal_name.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'_'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        event = <span style="color: #008000;">getattr</span><span style="color: black;">&#40;</span>event_obj, name<span style="color: black;">&#41;</span>
        event += <span style="color: #008000;">getattr</span><span style="color: black;">&#40;</span>target, handler_name<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># add all widgets</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> widget <span style="color: #ff7700;font-weight:bold;">in</span> gxml.<span style="color: black;">GetWidgetPrefix</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">setattr</span><span style="color: black;">&#40;</span>target, gxml.<span style="color: black;">GetWidgetName</span><span style="color: black;">&#40;</span>widget<span style="color: black;">&#41;</span>, widget<span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;"># connect all signals</span>
    gxml.<span style="color: black;">SignalAutoconnectFull</span><span style="color: black;">&#40;</span>_connect<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> Application:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        gxml = Glade.<span style="color: black;">XML</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;test.glade&quot;</span>, <span style="color: #483d8b;">&quot;window1&quot;</span>, <span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
        PyGladeAutoconnect<span style="color: black;">&#40;</span>gxml, <span style="color: #008000;">self</span><span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;"># window1 comes from glade file</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">window1</span>.<span style="color: black;">ShowAll</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> onWindowDelete<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, o, args<span style="color: black;">&#41;</span>:
        <span style="color: #808080; font-style: italic;"># connected via glade file definition</span>
        Gtk.<span style="color: black;">Application</span>.<span style="color: black;">Quit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
Gtk.<span style="color: black;">Application</span>.<span style="color: black;">Init</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
app = Application<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
Gtk.<span style="color: black;">Application</span>.<span style="color: black;">Run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://mindtrove.info/gtkbuilderglade-on-ironpython/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
