mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 00:31:31 +00:00
Make excluded stuff in FileManager configurable from __init__()
This commit is contained in:
parent
b224ed519d
commit
7858caf51a
@ -9,8 +9,8 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class FileManager:
|
class FileManager:
|
||||||
def __init__(self, working_directory, selected_file=None):
|
def __init__(self, working_directory, selected_file=None, exclude=None):
|
||||||
self.exclude = ['__pycache__']
|
self.exclude = exclude if exclude is not None else []
|
||||||
self._workdir = None
|
self._workdir = None
|
||||||
self.workdir = working_directory
|
self.workdir = working_directory
|
||||||
self.filename = selected_file or self.files[0]
|
self.filename = selected_file or self.files[0]
|
||||||
@ -54,9 +54,9 @@ class FileManager:
|
|||||||
|
|
||||||
|
|
||||||
class SourceCodeEventHandler(TriggerlessEventHandler):
|
class SourceCodeEventHandler(TriggerlessEventHandler):
|
||||||
def __init__(self, key, directory, selected_file=None):
|
def __init__(self, key, directory, selected_file=None, exclude=None):
|
||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
self.filemanager = FileManager(directory, selected_file=selected_file)
|
self.filemanager = FileManager(directory, selected_file=selected_file, exclude=exclude)
|
||||||
|
|
||||||
self.commands = {
|
self.commands = {
|
||||||
'read': self.read,
|
'read': self.read,
|
||||||
|
@ -9,7 +9,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD)
|
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD, ['__pycache__'])
|
||||||
terminado = TerminadoEventHandler('shell')
|
terminado = TerminadoEventHandler('shell')
|
||||||
terminado.historymonitor.subscribe_callback(lambda hist: log.debug('User executed command: "{}"'.format(hist[-1])))
|
terminado.historymonitor.subscribe_callback(lambda hist: log.debug('User executed command: "{}"'.format(hist[-1])))
|
||||||
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
|
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
|
||||||
|
Loading…
Reference in New Issue
Block a user