def _controllers_for(opt):
"""
Give a string representing the parameter represented, find the appropriate
command.
"""
colors = [None, 'blue', 'red', 'green', 'black']
controllers = {'type': widgets.Dropdown(options=['auto detect'] +\
_get_types(), description='type'),
'bin': widgets.Checkbox(description='bin'),
'aggregate': widgets.Dropdown(options=[None] +\
_get_functions(), description='aggregate'),
'zero': widgets.Checkbox(description='zero'),
'text': widgets.Text(description='text value'),
'scale': widgets.Dropdown(options=['linear', 'log'],
description='scale'),
'color': widgets.Dropdown(options=colors,
description='main color'),
'applyColorToBackground': widgets.Checkbox(description='applyColorToBackground'),
'shortTimeLabels': widgets.Checkbox(description='shortTimeLabels')
}
for title, controller in controllers.items():
controller.title = title
if 'Checkbox' in str(controller):
# traits = dir(controller.layout)
# traits = [t for t in traits if t[0] != '_']
controller.layout.max_width = '200ex'
# controller.layout.min_width = '100ex'
# controller.layout.width = '150ex'
return controllers[opt]
评论列表
文章目录