mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 16:41:21 +00:00
Add support for tab switching on backend SourceCodeEventHandler
This commit is contained in:
parent
eb344de7a2
commit
fc168f47ef
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user