WroBELL <[EMAIL PROTECTED]> writes:
> On Mon, 25 Oct 1999, James Henstridge wrote:
>
> > It is not currently possible to do this with pygtk. The GTK+ type system
> > is one part of gtk that is difficult wrap. What do you need the
> > functionality for?
> I need it for dialog which should emit "add_data" signal
> when "Add" button is pressed. Hmmm... Nevermind, I will
> connect directly to the button (it is dirty, but will
> work).
FWIW, Sketch contains a pretty generic mechanism for this kind of thing.
It's pure Python and completely toolkit/platform independent.
You would simply derive your dialog class from the Publisher class.
Publisher defines methods for subscribing and unsubscribing from
messages, so somewhere else in your code you would have something like
dialog.Subscribe('add_data', add_data_function)
The different signal types are identified by strings.
The dialog would then call
self.issue('add_data')
or, to pass arguments to the subscribers,
self.issue('add_data', data1, data2) # arbitrary arguments are allowed here
whenever the add button is pressed.
IMO, if you already use Python, it makes more sense to implement
mechanisms like this in Python than going through GTK.
If you already have Sketch, it's in Sketch/Base/connector.py. If there's
enough interest, I can make it available separately and write up some
documentation.
--
Bernhard Herzog | Sketch, a drawing program for Unix
[EMAIL PROTECTED] | http://www.online.de/home/sketch/
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]