Add support for tab switching on backend SourceCodeEventHandler

This commit is contained in:
Kristóf Tóth 2018-02-07 14:50:29 +01:00
parent eb344de7a2
commit fc168f47ef

View File

@ -19,14 +19,14 @@ class FileManager:
self.language = map_file_extension_to_language(self.filename) self.language = map_file_extension_to_language(self.filename)
def select_file(self, filename): def select_file(self, filename):
if not self._filepath(filename) in self.files: if not filename in self.files:
raise EnvironmentError('No such file in workdir!') raise EnvironmentError('No such file in workdir!')
self.filename = filename self.filename = filename
self.language = map_file_extension_to_language(self.filename) self.language = map_file_extension_to_language(self.filename)
@property @property
def files(self): def files(self):
return [file for file in glob(join(self._workdir, '**/*'), recursive=True) if isfile(file)] return [basename(file) for file in glob(join(self._workdir, '**/*'), recursive=True) if isfile(file)]
@property @property
def file_contents(self): def file_contents(self):
@ -66,7 +66,8 @@ class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin):
data_json['data'] = { data_json['data'] = {
'filename': self.filemanager.filename, 'filename': self.filemanager.filename,
'content': self.filemanager.file_contents, 'content': self.filemanager.file_contents,
'language': self.filemanager.language 'language': self.filemanager.language,
'files': self.filemanager.files
} }
def write(self, data_json): def write(self, data_json):