Implement SourceCodeEventHandler blacklist manipulating API

This commit is contained in:
Kristóf Tóth 2018-03-15 15:54:07 +01:00
parent aa54e40f14
commit cc87540171

View File

@ -77,7 +77,8 @@ class SourceCodeEventHandler(TriggerlessEventHandler):
self.commands = {'read': self.read,
'write': self.write,
'select': self.select,
'selectdir': self.select_dir}
'selectdir': self.select_dir,
'exclude': self.exclude}
self._monitor = None
self.reload_monitor()
@ -125,6 +126,11 @@ class SourceCodeEventHandler(TriggerlessEventHandler):
log.error('Failed to select directory "{}"'.format(data['directory']))
return data
def exclude(self, data):
try: self.filemanager.exclude = list(data['exclude'])
except TypeError: log.error('Exclude must be Iterable!')
return data
def attach_fileinfo(self, data):
data['filename'] = self.filemanager.filename
data['files'] = self.filemanager.files