[pygtk] Problem with Notebook - stop-emission doubts
John Finlay
finlay at moeraki.com
Sat Dec 27 04:49:42 WST 2008
Alessandro Dentella wrote:
> On Wed, Dec 24, 2008 at 01:22:49PM +0100, Gian Mario Tagliaretti wrote:
>
>> On Wed, Dec 24, 2008 at 9:57 AM, Frédéric
>> <frederic.mantegazza at gbiloba.org> wrote:
>>
>>
>>> PS: BTW, where did you find the stop_emission() method? I can't retreive it
>>> in the doc...
>>>
>> it a gobject method:
>> http://library.gnome.org/devel/pygobject/stable/class-gobject.html#method-gobject--stop-emission
>>
>
> following the docs I have several questions?
>
> 1. the explanation is exactly the same as for "emit_stop_by_name": which
> is the difference?
>
>
They are the same.
> """
> The stop_emission() method stops the current emission of the signal
> specified by detailed_signal
> """
>
> 2. "current emission" means the emission of the signal that is now
> handled? if this is the case, what's the need for specifying the name?
>
A signal could be emitted within a signal emission.
> 3. How is it different from returning True?
> I tested it with::
>
> b = gtk.Button("Press me")
> e = gtk.Entry()
> b.connect('clicked', self.on_clicked1)
> b.connect('clicked', self.on_clicked2)
>
> e.connect('key-press-event', self.on_key_press_event1)
> e.connect('key-press-event', self.on_key_press_event2)
>
>
> on_clicked2 cannot be inhibited returning True from on_clicked1 while
> on_key_press_event1 *can* be inhibited simply returning True.
>
> Both can be inhibited using stop_emission.
>
Some signals provide an explicit means of stopping the signal emission
using a return value from a handler. The "clicked" handler is not
supposed to provide a return value so returning True does nothing.
John
More information about the pygtk
mailing list