From e7fc17fdfdb77d44391a2e82b3cf69dd5e9c1ef3 Mon Sep 17 00:00:00 2001 From: Romeo <r.haak@student.ru.nl> Date: Sat, 30 Nov 2019 18:12:44 +0100 Subject: [PATCH] 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. --- umbra/controller.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/umbra/controller.py b/umbra/controller.py index b4f63999..f49ed42e 100644 --- a/umbra/controller.py +++ b/umbra/controller.py @@ -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 -- GitLab