Nick Coghlan wrote:
If this only has to work for classes created for the purpose (rather than for an arbitrary class):
Certainly a step into the direction I meant - but still missing type declarations. And that's what at least I'd like to see - as otherwise you don't know what kind of editing widget to use for a property.
Hmm, true. You really need a name:type dict to define each class that is going to be generated.
Perhaps the simplest way is to require all such classes to have a "getExample" class method that produces a fully populated example instance (making it a class method means that you shouldn't need to override it in a subclass if you don't change the signature of __init__).
Then the widget generator doesn't need to care about *how* that default example gets generated, and can be something simple like:
build_widget(name, data_type): ...
build_widget_list(cls): example = cls.getExample() widgets = [] for attr, value in example.__dict__: widgets.append(build_widget(attr, type(value))) return widgets
Cheers, Nick.
-- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list