parent
a937b50d1b
commit
ef2c64067a
16
buffer/fs.py
16
buffer/fs.py
|
@ -1,13 +1,21 @@
|
||||||
|
import fnmatch
|
||||||
import dirutil, os
|
import dirutil, os
|
||||||
from buffer import Buffer
|
from buffer import Buffer
|
||||||
|
|
||||||
|
ignore = ['*.o', '*.lo', '*.la', '#*#', '*.rej', '*~', '.#*', '.DS_Store',
|
||||||
|
'*.pyc', '*.pyo', '.sconsign.dblite']
|
||||||
|
|
||||||
class DirBuffer(Buffer):
|
class DirBuffer(Buffer):
|
||||||
btype = 'dir'
|
btype = 'dir'
|
||||||
def __init__(self, path, name=None):
|
def __init__(self, path, name=None):
|
||||||
Buffer.__init__(self)
|
Buffer.__init__(self)
|
||||||
self.path = os.path.realpath(path)
|
self.path = os.path.realpath(path)
|
||||||
|
|
||||||
self.settings['hide-dot'] = True
|
self.settings['hide-dot'] = True
|
||||||
self.settings['type-sort'] = False
|
self.settings['type-sort'] = False
|
||||||
|
self.settings['hide-glob'] = True
|
||||||
|
self.settings['ignores'] = list(ignore)
|
||||||
|
|
||||||
def changed(self):
|
def changed(self):
|
||||||
return False
|
return False
|
||||||
def readonly(self):
|
def readonly(self):
|
||||||
|
@ -36,6 +44,14 @@ class DirBuffer(Buffer):
|
||||||
if self.settings.get('hide-dot'):
|
if self.settings.get('hide-dot'):
|
||||||
if name.startswith('.') and name not in ('.', '..'):
|
if name.startswith('.') and name not in ('.', '..'):
|
||||||
continue
|
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)
|
path = self._make_path(name)
|
||||||
fields = dirutil.path_fields(path, name)
|
fields = dirutil.path_fields(path, name)
|
||||||
for i in range(0, 5):
|
for i in range(0, 5):
|
||||||
|
|
Loading…
Reference in New Issue