[RFC] ui_hint attribute for Options

Martin Pool mbp at canonical.com
Tue Jan 26 10:12:02 GMT 2010


2010/1/26 Ian Clatworthy <ian.clatworthy at canonical.com>:
> Explorer now has some generic code for building a form of widgets from a
> list of Option instances. The core code handles booleans, strings and
> registries. Al has submitted a patch to epxlorer so that certain options
> can be tagged as "locations" so we can provide a nicer widget for those
> fields, including a Browse button that selects a directory.
>
> The $64M question is how to specify the metadata saying "this option is
> a location". We could overload the type field, e.g. type="location" but
> that doesn't feel optimal to me. I'd like to suggest we add an attribute
> to Options called "ui_hint". We can then use that to tweak appearance of
> widgets, e.g. use radio buttons instead of combo-boxes, allow file
> selection, directory selection, etc.

'type' at the moment is a Python type, like bool, and perhaps it's
good to keep that simple.

On the other hand if you had type=LocationArgument, where that is a
class that can be created from a string, you could hook it in pretty
cleanly...

Having another argument for the meaning could also be ok though.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list