'Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported)'

def open_file(self, fname, external=False):

    fname = to_text_string(fname)
    ext = osp.splitext(fname)[1]
    if encoding.is_text_file(fname):
        self.editor.load(fname)
    elif ((self.variableexplorer is not None) and (ext in IMPORT_EXT)):
        self.variableexplorer.import_data(fname)
    elif (not external):
        fname = file_uri(fname)
        programs.start_file(fname)
