[pygtk] How can I inherit __gsignals__ attribute from a class?
Iven Day
ivenvd at gmail.com
Tue Jun 2 17:05:45 WST 2009
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 <ivenvd at gmail.com> wrote:
>
> > From: Iven Day <ivenvd at gmail.com>
> > Subject: [pygtk] How can I inherit __gsignals__ attribute from a class?
> > To: pygtk at 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 at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://faq.pygtk.org/
> >
>
>
>
More information about the pygtk
mailing list