Beispiel #1
0
    def setOpen(self, o):
        if o:
            self.setIcon(0, folderOpenIcon)
        else:
            self.setIcon(0, folderClosedIcon)

        if o and not self.childCount():
            s = self.fullName()
            thisDir = QDir(s)
            if not thisDir.isReadable():
                self.readable = 0
                return

            files = thisDir.entryInfoList()
            if files:
                for f in files:
                    # f is a QFileInfo
                    # f.fileName is '.' or '..' or 'bearings' or...
                    fileName = str(f.fileName())
                    if fileName == '.' or fileName == '..':
                        continue
                    elif f.isSymLink():
                        d = QTreeWidgetItem(self,
                                            fileName)  #, 'Symbolic Link')
                        d.setIcon(0, fileIcon)
                    elif f.isDir():
                        if fileName == 'CVS':
                            #bruce 060319 skip CVS directories, so developers see same set of directories as end-users
                            # (implements NFR I recently reported)
                            # WARNING: this is only legitimate for some applications of this module.
                            # For now that's ok (we only use it in MMKit). Later this feature should be turned on
                            # by an optional argument to __init__, and generalized to a list of files to not show
                            # or to a filter function.
                            continue
                        d = Directory(self, fileName)
                    else:
                        if f.isFile():
                            s = 'File'
                        else:
                            s = 'Special'
                        if not fileName[-3:] in self.filterList:
                            continue
                        d = FileItem(self, f.absFilePath(), fileName)
                        d.setIcon(0, fileIcon)

        qt4todo('QTreeWidgetItem.setOpen(self, o)')
Beispiel #2
0
    def setOpen(self, o):
        if  o: 
            self.setIcon(0, folderOpenIcon)
        else:
            self.setIcon(0, folderClosedIcon)

        if o and not self.childCount():
            s = self.fullName()
            thisDir = QDir(s)
            if not thisDir.isReadable():
                self.readable = 0
                return

            files = thisDir.entryInfoList()
            if files:
                for f in files:
                    # f is a QFileInfo
                    # f.fileName is '.' or '..' or 'bearings' or...
                    fileName = str(f.fileName())
                    if fileName == '.' or fileName == '..':
                        continue
                    elif f.isSymLink():
                        d = QTreeWidgetItem(self, fileName)#, 'Symbolic Link')
                        d.setIcon(0, fileIcon)
                    elif f.isDir():
                        if fileName == 'CVS':
                            #bruce 060319 skip CVS directories, so developers see same set of directories as end-users
                            # (implements NFR I recently reported)
                            # WARNING: this is only legitimate for some applications of this module.
                            # For now that's ok (we only use it in MMKit). Later this feature should be turned on
                            # by an optional argument to __init__, and generalized to a list of files to not show
                            # or to a filter function.
                            continue
                        d = Directory(self, fileName)
                    else:
                        if f.isFile():
                            s = 'File'
                        else:
                            s = 'Special'
                        if not fileName[-3:] in self.filterList:
                            continue
                        d = FileItem(self, f.absFilePath(), fileName)
                        d.setIcon(0, fileIcon)
    
        qt4todo('QTreeWidgetItem.setOpen(self, o)')