(self, root, path, indent, tree, expanded)
return tree
Recursively build list of filenames for self.re_populate_view
Recursively build list of filenames for self.re_populate_view
Recursively build list of filenames for self . re_populate_view
def traverse_tree(self, root, path, indent, tree, expanded):
        '''Recursively build list of filenames for self.re_populate_view'''
        if not path:  # special case for ThisPC, path is empty string
            items = [u'%s\\' % d for d in tree]
            tree  = []

        else:
            if indent:  # this happens during recursive call, i.e. path in expanded
                # basename return funny results for c:\\ so it is tricky
                bname = os.path.basename(os.path.abspath(path)) or path.rstrip(os.sep)
                tree.append(u'%s▾ %s%s' % (indent[:-1], bname.rstrip(os.sep), os.sep))
                self.index.append(u'%s' % path)

            items, error = self.try_listing_directory(path)
            if error:
                tree[~0] += u'\t<%s>' % error
                return
            if not items:
                if path == root:
                    return []
                # expanding empty folder, so notify that it is empty
                tree[~0] += '\t<empty>'
                return

        files = []
        index_files = []
        for f in items:
            new_path = join(path, f)
            dir_path = u'%s%s' % (new_path.rstrip(os.sep), os.sep)
            check = isdir(new_path)
            if check and dir_path in expanded:
                self.traverse_tree(root, dir_path, indent + '\t', tree, expanded)
            elif check:
                self.index.append(dir_path)
                tree.append(u'%s▸ %s%s' % (indent, f.rstrip(os.sep), os.sep))
            else:
                index_files.append(new_path)
                files.append(u'%s≡ %s' % (indent, f))

        self.index += index_files
        tree += files
        return tree
def traverse_tree ( self , root , path , indent , tree , expanded ) : if not path : # special case for ThisPC, path is empty string items = [ u'%s\\' % d for d in tree ] tree = [ ] else : if indent : # this happens during recursive call, i.e. path in expanded # basename return funny results for c:\\ so it is tricky bname = os . path . basename ( os . path . abspath ( path ) ) or path . rstrip ( os . sep ) tree . append ( u'%s▾ %s%s' % ( n dent[: - 1 ] , b ame.r s trip(o s .s e p), o .s e p)) self . index . append ( u'%s' % path ) items , error = self . try_listing_directory ( path ) if error : tree [ ~ 0 ] += u'\t<%s>' % error return if not items : if path == root : return [ ] # expanding empty folder, so notify that it is empty tree [ ~ 0 ] += '\t<empty>' return files = [ ] index_files = [ ] for f in items : new_path = join ( path , f ) dir_path = u'%s%s' % ( new_path . rstrip ( os . sep ) , os . sep ) check = isdir ( new_path ) if check and dir_path in expanded : self . traverse_tree ( root , dir_path , indent + '\t' , tree , expanded ) elif check : self . index . append ( dir_path ) tree . append ( u'%s▸ %s%s' % ( n dent,  f r s trip(o s .s e p), o .s e p)) else : index_files . append ( new_path ) files . append ( u'%s≡ %s' % ( n dent,  f ) self . index += index_files tree += files return tree