From 4c868e9a3d1390369a4d76c996ed820f2d933154 Mon Sep 17 00:00:00 2001
From: "Verbeek, J.M. (Janneke)" <j.verbeek@student.ru.nl>
Date: Mon, 2 Dec 2019 14:34:52 +0100
Subject: [PATCH] Documentation.

---
 umbra/controller.py | 11 +++++++++--
 umbra/model.py      |  8 --------
 umbra/view.py       | 13 +++++--------
 3 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/umbra/controller.py b/umbra/controller.py
index b2108fee..3a14e11b 100644
--- a/umbra/controller.py
+++ b/umbra/controller.py
@@ -50,6 +50,9 @@ class Controller:
             self._delete_files(type[0], True)
 
     def _select_folder(self, type="shadow"):
+        """
+        Select a folder from which multiple files can be read.
+        """
         folder_path = fd.askdirectory()
         file_names = os.listdir(folder_path)
         file_paths = [folder_path + "/" + x for x in file_names]
@@ -94,7 +97,9 @@ class Controller:
             self._view.update_files(files, type)
 
     def _compare_files(self):
-        """Check source and shadow data availability, and compare."""
+        """Check source and shadow data availability, read in, and compare.
+            If multiple, read in and compare accordingly.
+        """
         if self._source_files == []:
             self._view.update_message('no source')
         elif self._shadow_files == []:
@@ -112,7 +117,9 @@ class Controller:
             self._view.update_message('comparison complete')
 
     def _save_results(self):
-        """Save analysis results to file."""
+        """Save analysis results to file. If there is multiple results,
+        save those.
+        """
         if not self._model.analysis_complete():
             self._view.update_message('no comparison')
         else:
diff --git a/umbra/model.py b/umbra/model.py
index 69027142..b0165422 100644
--- a/umbra/model.py
+++ b/umbra/model.py
@@ -73,7 +73,6 @@ class Model:
                         result = self._stats.analyze(self._data_source, data)
                         self.add_to_dict(key+"_res", result, self._multi_results)
                     else:
-                        print("passed")
                         pass
             else:
                 print("Single analysis")
@@ -81,10 +80,3 @@ class Model:
                     self._stats.analyze(self._data_source, self._data_shadow)
         else:
             print("This needs fixing")
-
-    # I needs it
-    def add_to_dict(self, key, item, dict):
-        if key in dict:
-            pass # TODO: raise error
-        else:
-            dict[key] = item
diff --git a/umbra/view.py b/umbra/view.py
index 5878ecca..1509d556 100644
--- a/umbra/view.py
+++ b/umbra/view.py
@@ -45,7 +45,7 @@ class View:
         self._window.mainloop()
 
     def select_files(self, type):
-        """Select file from pc.
+        """Select file from directory.
 
         Args:
             type (str): Role of file ('source' or 'shadow')
@@ -55,11 +55,9 @@ class View:
                                             filetypes=(('.csv files', '*.csv'),
                                                        ("all files", "*.*")))
         # TODO: Which file type(s)?
-
-        # TODO: Deal with multiple files at once
+        # TODO: Empty path, do what?
         for path in paths:
-           if path == "":  # Do not assign an empty file path
-               # TODO: Error message and close
+           if path == "":
                select_files(type)  # prompt again
         return paths
 
@@ -140,10 +138,9 @@ class View:
                                             parent=self._window,
                                             filetypes=((".txt files", "*.txt"),
                                                        ("all files", "*.*")))
-        if ".txt" not in path:
-            path += ".txt"
-        if path == ".txt":
+        if path == "":
             # TODO: Error message & close
+            # TODO: If no path then what?
             self.ask_save_location()  # Prompt again
         return path
 
-- 
GitLab