1735 @param target target directory (string) |
1735 @param target target directory (string) |
1736 """ |
1736 """ |
1737 # first perform the addition of source |
1737 # first perform the addition of source |
1738 self.__addSingleDirectory(filetype, source, target, True) |
1738 self.__addSingleDirectory(filetype, source, target, True) |
1739 |
1739 |
|
1740 ignore_patterns = [pattern for pattern, filetype in |
|
1741 self.pdata["FILETYPES"].items() |
|
1742 if filetype == '__IGNORE__'] |
|
1743 |
1740 # now recurse into subdirectories |
1744 # now recurse into subdirectories |
1741 for name in os.listdir(source): |
1745 for name in os.listdir(source): |
1742 ns = os.path.join(source, name) |
1746 ns = os.path.join(source, name) |
1743 if os.path.isdir(ns): |
1747 if os.path.isdir(ns): |
|
1748 skip = False |
|
1749 for ignore_pattern in ignore_patterns: |
|
1750 if fnmatch.fnmatch(name, ignore_pattern): |
|
1751 skip = True |
|
1752 break |
|
1753 if skip: |
|
1754 continue |
|
1755 |
1744 nt = os.path.join(target, name) |
1756 nt = os.path.join(target, name) |
1745 self.__addRecursiveDirectory(filetype, ns, nt) |
1757 self.__addRecursiveDirectory(filetype, ns, nt) |
1746 |
1758 |
1747 @pyqtSlot() |
1759 @pyqtSlot() |
1748 def addDirectory(self, fileTypeFilter=None, startdir=None): |
1760 def addDirectory(self, fileTypeFilter=None, startdir=None): |
4486 """ |
4498 """ |
4487 autoInclude = Preferences.getProject("AutoIncludeNewFiles") |
4499 autoInclude = Preferences.getProject("AutoIncludeNewFiles") |
4488 recursiveSearch = Preferences.getProject("SearchNewFilesRecursively") |
4500 recursiveSearch = Preferences.getProject("SearchNewFilesRecursively") |
4489 newFiles = [] |
4501 newFiles = [] |
4490 |
4502 |
|
4503 ignore_patterns = [pattern for pattern, filetype in |
|
4504 self.pdata["FILETYPES"].items() |
|
4505 if filetype == '__IGNORE__'] |
|
4506 |
4491 dirs = self.subdirs[:] |
4507 dirs = self.subdirs[:] |
4492 for directory in dirs: |
4508 for directory in dirs: |
|
4509 skip = False |
|
4510 for ignore_pattern in ignore_patterns: |
|
4511 if fnmatch.fnmatch(directory, ignore_pattern): |
|
4512 skip = True |
|
4513 break |
|
4514 if skip: |
|
4515 continue |
|
4516 |
4493 curpath = os.path.join(self.ppath, directory) |
4517 curpath = os.path.join(self.ppath, directory) |
4494 try: |
4518 try: |
4495 newSources = os.listdir(curpath) |
4519 newSources = os.listdir(curpath) |
4496 except OSError: |
4520 except OSError: |
4497 newSources = [] |
4521 newSources = [] |