(self)
Get the content of the current dir
Get the content of the current dir
Get the content of the current dir
def get_dir_cont(self):
        '''Get the content of the current dir'''

        try:
            dir_cont = listdir(self.control.cur_dir)
        except OSError:
            self.control.draw_text(False,
                                   (1, 0, 'Was not able to read directory'),
                                   (2, 0, 'Press any key.'))
            if self.control.any_key() == -1:
                return -1
            last = self.control.cur_dir.split('/')[-1]
            self.control.cur_dir = self.control.cur_dir[:-len(last) - 1]
            if self.control.cur_dir == '':
                self.control.cur_dir = '/'
            return False

        rem = []
        for i in dir_cont:
            if ((not isdir(self.control.cur_dir + '/' + i) and not
                    i[-4:] == '.kdb' and self.keyfile is False) or
                    (i[0] == '.' and self.hidden is True)):
                rem.append(i)
        for i in rem:
            dir_cont.remove(i)

        dirs = []
        files = []
        for i in dir_cont:
            if isdir(self.control.cur_dir + '/' + i):
                dirs.append(i)
            else:
                files.append(i)
        dirs.sort()
        files.sort()

        self.dir_cont = []
        self.dir_cont.extend(dirs)
        self.dir_cont.extend(files)
        if not self.control.cur_dir == '/':
            self.dir_cont.insert(0, '..')
def get_dir_cont ( self ) : try : dir_cont = listdir ( self . control . cur_dir ) except OSError : self . control . draw_text ( False , ( 1 , 0 , 'Was not able to read directory' ) , ( 2 , 0 , 'Press any key.' ) ) if self . control . any_key ( ) == - 1 : return - 1 last = self . control . cur_dir . split ( '/' ) [ - 1 ] self . control . cur_dir = self . control . cur_dir [ : - len ( last ) - 1 ] if self . control . cur_dir == '' : self . control . cur_dir = '/' return False rem = [ ] for i in dir_cont : if ( ( not isdir ( self . control . cur_dir + '/' + i ) and not i [ - 4 : ] == '.kdb' and self . keyfile is False ) or ( i [ 0 ] == '.' and self . hidden is True ) ) : rem . append ( i ) for i in rem : dir_cont . remove ( i ) dirs = [ ] files = [ ] for i in dir_cont : if isdir ( self . control . cur_dir + '/' + i ) : dirs . append ( i ) else : files . append ( i ) dirs . sort ( ) files . sort ( ) self . dir_cont = [ ] self . dir_cont . extend ( dirs ) self . dir_cont . extend ( files ) if not self . control . cur_dir == '/' : self . dir_cont . insert ( 0 , '..' )