645 parentIndex = ( |
645 parentIndex = ( |
646 QModelIndex() |
646 QModelIndex() |
647 if parentItem == self.rootItem |
647 if parentItem == self.rootItem |
648 else self.createIndex(parentItem.row(), 0, parentItem) |
648 else self.createIndex(parentItem.row(), 0, parentItem) |
649 ) |
649 ) |
|
650 |
|
651 if typeString == "OTHERS": |
|
652 childItem = self.findChildItem(os.path.basename(name), 0, parentItem) |
|
653 if childItem is not None: |
|
654 if childItem.bold: |
|
655 # the entry was already added |
|
656 return |
|
657 else: |
|
658 self.removeItem(name) |
|
659 |
650 if os.path.isdir(fname): |
660 if os.path.isdir(fname): |
651 itm = ProjectBrowserDirectoryItem( |
661 itm = ProjectBrowserDirectoryItem( |
652 parentItem, |
662 parentItem, |
653 fname, |
663 fname, |
654 self.__projectBrowser.getProjectBrowserFilter(typeString), |
664 self.__projectBrowser.getProjectBrowserFilter(typeString), |
921 if childItem is not None: |
931 if childItem is not None: |
922 self.beginRemoveRows(parentIndex, childItem.row(), childItem.row()) |
932 self.beginRemoveRows(parentIndex, childItem.row(), childItem.row()) |
923 parentItem.removeChild(childItem) |
933 parentItem.removeChild(childItem) |
924 self.endRemoveRows() |
934 self.endRemoveRows() |
925 |
935 |
|
936 if isinstance(parentItem, ProjectBrowserSimpleDirectoryItem): |
|
937 # unmanaged directory |
|
938 self.removeItem(os.path.dirname(name)) |
|
939 |
926 def repopulateItem(self, name): |
940 def repopulateItem(self, name): |
927 """ |
941 """ |
928 Public method to repopulate an item. |
942 Public method to repopulate an item. |
929 |
943 |
930 @param name name of the file relative to the project root |
944 @param name name of the file relative to the project root |