def add_info_to_disable_buttons(data_to_show, assigned_tags, fields, state):
    reference_disabled = True
    selected_figure_id = fields.get('state.selectedFigureId', (- 1))
    if (selected_figure_id not in g.figures_in_reference):
        reference_disabled = False
    data_to_show = OrderedDict(data_to_show)
    for (label, data) in data_to_show.items():
        if ((label in assigned_tags) or ((len(assigned_tags) > 0) and state['tagPerImage'])):
            data_to_show[label].update({'assignDisabled': True, 'referenceDisabled': reference_disabled})
        else:
            data_to_show[label].update({'assignDisabled': False, 'referenceDisabled': reference_disabled})
    return dict(data_to_show)
def add_info_to_disable_buttons(data_to_show, assigned_tags, fields, state):
    reference_disabled = True
    selected_figure_id = fields.get('state.selectedFigureId', (- 1))
    if (selected_figure_id not in g.figures_in_reference):
        reference_disabled = False
    data_to_show = OrderedDict(data_to_show)
    for (label, data) in data_to_show.items():
        if ((label in assigned_tags) or ((len(assigned_tags) > 0) and state['tagPerImage'])):
            data_to_show[label].update({'assignDisabled': True, 'referenceDisabled': reference_disabled})
        else:
            data_to_show[label].update({'assignDisabled': False, 'referenceDisabled': reference_disabled})
    return dict(data_to_show)