'Generate a tour.'

def _generate_tour(self):

    tour_name = (self._tool.name + '    Tour')
    test_inputs = self._test.inputs.keys()
    steps = [{'title': tour_name, 'content': (('This    short    tour    will    guide    you    through    the    <b>' + self._tool.name) + '</b>    tool.'), 'orphan': True}]
    for (name, input) in self._tool.inputs.items():
        cond_case_steps = []
        if (input.type == 'repeat'):
            continue
        step = {'title': input.label, 'element': ('[tour_id=%s]' % name), 'placement': 'right', 'content': ''}
        if (input.type == 'text'):
            if (name in test_inputs):
                param = self._test.inputs[name]
                step['content'] = ('Enter    value(s):    <b>%s</b>' % param)
            else:
                step['content'] = 'Enter    a    value'
        elif ((input.type == 'integer') or (input.type == 'float')):
            if (name in test_inputs):
                num_param = self._test.inputs[name][0]
                step['content'] = ('Enter    number:    <b>%s</b>' % num_param)
            else:
                step['content'] = 'Enter    a    number'
        elif (input.type == 'boolean'):
            if (name in test_inputs):
                choice = ('Yes' if (self._test.inputs[name][0] is True) else 'No')
                step['content'] = ('Choose    <b>%s</b>' % choice)
            else:
                step['content'] = 'Choose    Yes/No'
        elif (input.type == 'select'):
            params = []
            if (name in test_inputs):
                for option in self._tool.inputs[name].static_options:
                    for test_option in self._test.inputs[name]:
                        if (test_option == option[1]):
                            params.append(option[0])
            if params:
                select_param = ',    '.join(params)
                step['content'] = ('Select    parameter(s):    <b>%s</b>' % select_param)
            else:
                step['content'] = 'Select    a    parameter'
        elif (input.type == 'data'):
            if (name in test_inputs):
                hid = self._hids[name]
                dataset = self._test.inputs[name][0]
                step['content'] = ('Select    dataset:    <b>%s:    %s</b>' % (hid, dataset))
            else:
                step['content'] = 'Select    a    dataset'
        elif (input.type == 'conditional'):
            param_id = ('%s|%s' % (input.name, input.test_param.name))
            step['title'] = input.test_param.label
            step['element'] = ('[tour_id="%s"]' % param_id)
            params = []
            if (param_id in self._test.inputs.keys()):
                for option in input.test_param.static_options:
                    for test_option in self._test.inputs[param_id]:
                        if (test_option == option[1]):
                            params.append(option[0])
                cases = {}
                for case in input.cases:
                    for (key, value) in case.inputs.items():
                        if (key not in cases.keys()):
                            cases[key] = value.label
                for (case_id, case_title) in cases.items():
                    tour_id = ('%s|%s' % (input.name, case_id))
                    if (tour_id in self._test.inputs.keys()):
                        if (case_id in self._data_inputs.keys()):
                            hid = self._hids[case_id]
                            dataset = self._test.inputs[tour_id][0]
                            step_msg = ('Select    dataset:    <b>%s:    %s</b>' % (hid, dataset))
                        else:
                            case_params = ',    '.join(self._test.inputs[tour_id])
                            step_msg = ('Select    parameter(s):    ' + ('<b>%s</b>' % case_params))
                        cond_case_steps.append({'title': case_title, 'element': ('[tour_id="%s"]' % tour_id), 'placement': 'right', 'content': step_msg})
            if params:
                cond_param = ',    '.join(params)
                step['content'] = ('Select    parameter(s):    <b>%s</b>' % cond_param)
            else:
                step['content'] = 'Select    a    parameter'
        elif (input.type == 'data_column'):
            if (name in test_inputs):
                column_param = self._test.inputs[name][0]
                step['content'] = ('Select    <b>Column:    %s</b>' % column_param)
            else:
                step['content'] = 'Select    a    column'
        else:
            step['content'] = 'Select    a    parameter'
        steps.append(step)
        if cond_case_steps:
            steps.extend(cond_case_steps)
    steps.append({'title': 'Execute    tool', 'content': 'Click    <b>Execute</b>    button    to    run    the    tool.', 'element': '#execute', 'placement': 'bottom'})
    self._tour = {'title_default': tour_name, 'name': tour_name, 'description': ((self._tool.name + '    ') + self._tool.description), 'steps': steps}
