implement buffer ignoring

--HG--
branch : pmacs2
This commit is contained in:
moculus 2009-05-05 04:18:39 +00:00
parent a937b50d1b
commit ef2c64067a
1 changed files with 16 additions and 0 deletions

View File

@ -1,13 +1,21 @@
import fnmatch
import dirutil, os
from buffer import Buffer
ignore = ['*.o', '*.lo', '*.la', '#*#', '*.rej', '*~', '.#*', '.DS_Store',
'*.pyc', '*.pyo', '.sconsign.dblite']
class DirBuffer(Buffer):
btype = 'dir'
def __init__(self, path, name=None):
Buffer.__init__(self)
self.path = os.path.realpath(path)
self.settings['hide-dot'] = True
self.settings['type-sort'] = False
self.settings['hide-glob'] = True
self.settings['ignores'] = list(ignore)
def changed(self):
return False
def readonly(self):
@ -36,6 +44,14 @@ class DirBuffer(Buffer):
if self.settings.get('hide-dot'):
if name.startswith('.') and name not in ('.', '..'):
continue
if self.settings.get('hide-glob'):
skip = False
for glob in self.settings.get('ignores', []):
if fnmatch.fnmatch(name, glob):
skip = True
break
if skip:
continue
path = self._make_path(name)
fields = dirutil.path_fields(path, name)
for i in range(0, 5):