I subclassed gtk.Table, then started trying to integrate it with Glade-2. I
realized I needed to set __gproperties__ to add a property to the class, so
I added that:
__gproperties__ = {
'use_checkboxes' :
(gobject.TYPE_BOOLEAN, # type
'use checkboxes for Booleans', # nick name
'use checkboxes for Booleans', # description
True, # default value
gobject.PARAM_READWRITE|gobject.PARAM_CONSTRUCT # flags
)
}
I also changed my superclass init call from
gtk.GtkTable.__init__(self, rows, cols)
to
gobject.__gobject_init__()
self.set_property(n-rows, rows)
self.set_property(n-columns, cols)
I have other instance attributes as well:
self.widgets = {}
self.values = {}
self.formats = {}
self.default_format = %s
I will eventually change default_format to a property.
If I instantiate my Table widget from Python, it seems to work fine. When
it's instantiated via Glade its __init__ method doesn't appear to be called
though. A print statement placed in Table.__init__() is not executed, and
Python denies that my class has a widgets attribute.
I incorporated the class into Glade by adding a regular GtkTable where I
wanted my Table, then using the output of
print gobject.type_name(Table)
I substituted that for GtkTable in my Glade file:
widget class=Utilities+table+Table id=ContractArea
property name=visibleTrue/property
property name=n_rows1/property
property name=n_columns6/property
property name=homogeneousFalse/property
property name=row_spacing0/property
property name=column_spacing0/property
/widget
I must be missing something, but I'm not sure what. Any ideas?
Thx,
--
Skip Montanaro
Got spam? http://www.spambayes.org/
[EMAIL PROTECTED]
___
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/