Skip to content
Snippets Groups Projects
Commit e7fc17fd authored by Haak, R. (Romeo)'s avatar Haak, R. (Romeo)
Browse files

Changed the reading such that shadow and source can be compared again. Now...

Changed the reading such that shadow and source can be compared again. Now only the first ones are picked. For now, this is fine since the model can only handle two files, but needs to be changed in the future.
parent 01bb14f4
No related branches found
No related tags found
1 merge request!43Sc 97/paired nw and tempfix reading
......@@ -12,7 +12,7 @@ class Controller:
self._view = view
self._view.actionlistener = self.actionlistener
self._filereader = CSVReader("","") # TODO: Deal with csv OR txt
self._filereader = CSVReader() # TODO: Deal with csv OR txt
self._filewriter = CSVWriter()
# Lists of paths, represented as string
......@@ -79,8 +79,8 @@ class Controller:
self._view.update_message('no shadow')
else:
self._view.update_message('files ok')
self._read_files("source")
self._read_files("shadow")
self._read_files(self._source_files[0],"source") # TODO: obviously extend to not only reading first one
self._read_files(self._shadow_files[0],"shadow") # TODO: fine for now, the model can only handle two anyways
self._model.compare()
self._view.update_message('comparison complete')
......@@ -95,19 +95,14 @@ class Controller:
# results are of form sc, sh, info
self._view.update_message('saved')
def _read_files(self, type):
"""Read data from file paths and save to model.
def _read_files(self, path, word_type):
"""Read data from file path and save to model.
Args:
type (str): Role of file ('source' or 'shadow')
word_type (str): Role of file ('source' or 'shadow')
"""
# TODO
# Temporary 'solution' for testing below
path = self._source_files[0]
print(path)
self._filereader = CSVReader(path, type)
data = self._filereader.read()
if type == "source": # Fix is dirtier than I can talk
data = self._filereader.read(path,word_type)
if word_type == "source":
self._model._data_source = data
else:
self._model._data_shadow = data
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment