diff --git a/GUI/gui.py b/GUI/gui.py index 48208ec..a988fda 100644 --- a/GUI/gui.py +++ b/GUI/gui.py @@ -2,7 +2,7 @@ from Tkinter import * import tkMessageBox from fourmi import search -from sourceloader import SourceLoader +from utils.sourceloader import SourceLoader class ConfigImporter(): @@ -33,6 +33,7 @@ class GUI(): self.finish_with_search = False self.values = {} self.window, self.variables = self.generate_window(self.load_common_attributes(), self.load_output_types()) + self.required_variables = [''] def load_common_attributes(self): """Calls the configuration parser for common attributes.""" @@ -130,8 +131,6 @@ class GUI(): def prepare_search(self): """Saves the values from the window for later retrieval.""" - self.finish_with_search = True - variables = self.variables values = {} @@ -149,7 +148,12 @@ class GUI(): print "No known class, {}, {}".format(name, var) self.values = values - self.window.destroy() + if all([i in values.keys() for i in self.required_variables]): + self.finish_with_search = True + self.window.destroy() + else: + self.finish_with_search = False + tkMessageBox.showinfo('Not all required information was entered!') def execute_search(self): """Calls the Fourmi crawler with the values from the GUI""" @@ -184,6 +188,4 @@ class GUI(): if self.finish_with_search: self.execute_search() else: - tkMessageBox.showinfo("Notice", "No search was executed!") - -GUI().run() \ No newline at end of file + tkMessageBox.showinfo("Notice", "No search was executed!") \ No newline at end of file diff --git a/__init__.py b/__init__.py index c75c542..139597f 100644 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ -import FourmiCrawler, GUI, fourmi + diff --git a/tests/test_gui.py b/tests/test_gui.py new file mode 100644 index 0000000..00a537a --- /dev/null +++ b/tests/test_gui.py @@ -0,0 +1,19 @@ +import unittest + +from GUI import gui + +class TestGUI(unittest.TestCase): + def setUp(self): + pass + + def test_empty_attributes(self): + test_gui = gui.GUI() + test_gui.run() + test_gui.prepare_search() + + def test_no_configurations(self): + test_gui = gui.GUI() + #test_gui. + test_gui.run() + test_gui.prepare_search() +