'Update the color scheme of the preview editor and adds text.
Note
\'index\' is needed, because this is triggered by a signal that sends
the selected index.'

def update_preview(self, index=None, scheme_name=None):

    text = '"""A    string"""\n\n#    A    comment\n\n#    %%    A    cell\n\nclass    Foo(object):\n                def    __init__(self):\n                                bar    =    42\n                                print(bar)\n'
    show_blanks = CONF.get('editor', 'blank_spaces')
    if (scheme_name is None):
        scheme_name = self.current_scheme
    self.preview_editor.setup_editor(linenumbers=True, markers=True, tab_mode=False, font=get_font(), show_blanks=show_blanks, color_scheme=scheme_name)
    self.preview_editor.set_text(text)
    self.preview_editor.set_language('Python')
