Hey, it looks there's no missing parts ! It all works fine since day one. Here's the the trick:
Now your IronPython skills are ready to rock Gnome3!
import clr
clr.AddReference('glib-sharp')
clr.AddReference('gtk-sharp')
clr.AddReference('gtk-sharp-beans')
import Gtk
import GLib
import GtkBeans
import System.IO
def PyBuilderAutoconnect(builder, target):
def _connect(builder, object, signal_name, handler_name, connect_object, flags):
name = ''.join([frag.title() for frag in signal_name.split('_')])
event = getattr(object, name)
event += getattr(target, handler_name)
for object in builder.Objects:
setattr(target, object.Name, object)
builder.ConnectSignalsFull (_connect)
class Application:
def __init__(self):
builder = GtkBeans.Builder (System.IO.FileStream ('ui.ui', System.IO.FileMode.Open))
#use this ctor if you don't like FileStream
#builder = GtkBeans.Builder ()
#builder.AddFromFile ('./ui.ui')
PyBuilderAutoconnect (builder, self)
self.window1.ShowAll ()
def onbuttonclicked(self, o, args):
Gtk.Application.Quit()
Gtk.Application.Init ()
app = Application ()
Gtk.Application.Run ()
Thanks for the code.
ReplyDelete