'Set current folder and return associated model index'

def set_current_folder(self, folder):

    index = self.fsmodel.setRootPath(folder)
    self.__last_folder = folder
    if self.show_cd_only:
        if (self.__original_root_index is None):
            self.__original_root_index = self.rootIndex()
        self.setRootIndex(index)
    return index
