I just tried, but it doesn't work. I think __gsignals__ must be a class attribute so that signals within it could be emited, but not data attribute(self.xxx). 在 2009-06-02二的 02:11 -0700,Chris Camacho写道: > self.__gsignals__=.... > > how is it not a class attribute doing that???? > > --- On Tue, 2/6/09, Iven Day <ive...@gmail.com> wrote: > > > From: Iven Day <ive...@gmail.com> > > Subject: Re: [pygtk] How can I inherit __gsignals__ attribute from a class? > > To: "Chris Camacho" <chris_cama...@yahoo.com> > > Cc: pygtk@daa.com.au > > Date: Tuesday, 2 June, 2009, 10:05 AM > > It seems __gsignals__ only works as > > user-defined signals in pygtk when > > it is defined as a class attribute, isn't it? > > > > 在 2009-06-01一的 09:11 -0700,Chris Camacho写道: > > > shouldn't you be setting set __gsignals__ in > > PluginObject.__init__ ? > > > > > > --- On Mon, 1/6/09, Iven Day <ive...@gmail.com> > > wrote: > > > > > > > From: Iven Day <ive...@gmail.com> > > > > Subject: [pygtk] How can I inherit __gsignals__ > > attribute from a class? > > > > To: pygtk@daa.com.au > > > > Date: Monday, 1 June, 2009, 4:52 PM > > > > Hi, > > > > I wrote a parent class > > like this: > > > > > > > > class PluginObject(gobject.GObject): > > > > __gsignals__ = { > > > > > > "change-ui": > > > > (gobject.SIGNAL_RUN_FIRST, > > > > > > > > > > > > gobject.TYPE_NONE, > > > > > > > > > > > > > > (gobject.TYPE_PYOBJECT, > > > > gobject.TYPE_STRING,)), > > > > > > > > > > } > > > > def __init__(self): > > > > > > gobject.GObject.__init__(self) > > > > > > > > , and a child class like this: > > > > > > > > class PluginComboBox(gtk.ComboBox, > > PluginObject): > > > > def __init__(self, > > input_dict): > > > > > > PluginObject.__init__(self) > > > > > > gtk.ComboBox.__init__(self) > > > > ... > > > > > > self.connect("changed", > > > > self.changed_cb, input_dict) > > > > > > self.set_active(0) > > > > def changed_cb(self, > > widget, data = None): > > > > model = > > self.get_model() > > > > index = > > self.get_active() > > > > > > self.emit("change-ui", > > > > data.values, data[model[index][0]]) > > > > > > > > , but I got a > > > > > > > > TypeError: <PluginComboBox object at > > 0x7f02c4c20690 > > > > (GtkComboBox at > > > > 0x26e8010)>: unknown signal name: change-ui > > > > > > > > It seems __gsignals__ isn't inherited, how can I > > get it > > > > work? > > > > Sorry for my english. > > > > > > > > _______________________________________________ > > > > pygtk mailing list pygtk@daa.com.au > > > > http://www.daa.com.au/mailman/listinfo/pygtk > > > > Read the PyGTK FAQ: http://faq.pygtk.org/ > > > > > > > > > > > > > > > > > > > >
_______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/