tangled
alpha
login
or
join now
dekker.one
/
Fourmi
0
fork
atom
A web scraper build to search specific information for a given compound (and its pseudonyms)
0
fork
atom
overview
issues
pulls
pipelines
Moved gui config file to main package
Harmen Prins
11 years ago
b3a17920
1a5b804e
+36
-26
3 changed files
expand all
collapse all
unified
split
GUI
gui.py
configuration.cfg
tests
test_gui.py
GUI/gui.cfg.sample
configuration.cfg
+35
-25
GUI/gui.py
···
5
5
6
6
7
7
class GUI():
8
8
-
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader=None, in_source=True):
8
8
+
def __init__(self, search, config_file='configuration.cfg', sourceloader=None, in_source=True):
9
9
"""Boots the window, configuration."""
10
10
if in_source:
11
11
current_dir = os.path.dirname(os.path.abspath(__file__))
···
49
49
50
50
frame_all_attributes = Frame(window)
51
51
frame_selecting_attributes = Frame(frame_all_attributes)
52
52
-
53
52
frame_new_attributes = Frame(frame_selecting_attributes)
54
53
label_new_attributes = Label(frame_new_attributes, text="Parameters: ")
55
54
input_new_attributes = Text(frame_new_attributes, font=("Helvetica", 8), width=25, height=7, padx=5, pady=5)
···
71
70
label_common_attributes.pack(side=TOP)
72
71
input_common_attributes.pack(side=LEFT)
73
72
scrollbar_common_attributes.pack(side=RIGHT, fill=Y)
74
74
-
75
73
frame_selecting_attributes.pack()
76
74
77
77
-
frame_checkbox_attributes = Frame(frame_all_attributes)
78
78
-
variable_all_attributes = BooleanVar()
79
79
-
variable_all_attributes.set(False)
80
80
-
input_all_attributes = Checkbutton(frame_checkbox_attributes, text="Search ALL parameters",
81
81
-
variable=variable_all_attributes)
82
82
-
variables.update({"all_attributes": variable_all_attributes})
83
83
-
frame_checkbox_attributes.pack(side=BOTTOM)
84
84
-
input_all_attributes.pack()
85
85
-
86
86
-
frame_all_attributes.pack()
75
75
+
frame_last = Frame(window)
76
76
+
search_button = Button(frame_last, text="Start search", command=self.prepare_search)
77
77
+
cancel_button = Button(frame_last, text="Cancel", command=window.destroy)
78
78
+
frame_last.pack(side=BOTTOM)
79
79
+
search_button.pack(side=LEFT)
80
80
+
cancel_button.pack(side=RIGHT)
87
81
88
88
-
frame_output_name = Frame(window)
82
82
+
frame_name = Frame(window)
83
83
+
frame_output_name = Frame(frame_name)
89
84
output_name = StringVar()
90
85
output_name.set("results")
91
86
variables.update({'output_name': output_name})
92
87
label_output_name = Label(frame_output_name, text="Output name:")
93
88
input_output_name = Entry(frame_output_name, font=("Helvetica", 12), width=25, textvariable=output_name)
94
94
-
frame_output_name.pack()
89
89
+
frame_output_name.pack(side=LEFT)
95
90
label_output_name.pack()
96
91
input_output_name.pack()
97
92
···
101
96
variables.update({"output_type": output_type})
102
97
else:
103
98
output_type = StringVar()
104
104
-
output_type.set(output_types[0] if output_types and len(output_types) != 0 else "json")
99
99
+
output_type.set(output_types[0] if output_types and len(output_types) != 0 else "csv")
105
100
variables.update({"output_type": output_type})
106
106
-
frame_output_type = Frame(window)
101
101
+
frame_output_type = Frame(frame_name)
107
102
label_output_type = Label(frame_output_type, text="Extension: ")
108
103
if output_types and len(output_types) > 0:
109
104
input_output_type = OptionMenu(frame_output_type, output_type, *output_types)
110
105
else:
111
111
-
input_output_type = Label(frame_output_type, text="No output types in config file\nSelecting json")
112
112
-
frame_output_type.pack()
106
106
+
input_output_type = Label(frame_output_type, text="No output types in config file\nSelecting csv")
107
107
+
frame_output_type.pack(side=RIGHT)
113
108
label_output_type.pack()
114
109
input_output_type.pack()
110
110
+
frame_name.pack(side=BOTTOM)
115
111
116
116
-
frame_last = Frame(window)
117
117
-
search_button = Button(frame_last, text="Start search", command=self.prepare_search)
118
118
-
cancel_button = Button(frame_last, text="Cancel", command=window.destroy)
119
119
-
frame_last.pack(side=BOTTOM)
120
120
-
search_button.pack(side=LEFT)
121
121
-
cancel_button.pack(side=RIGHT)
112
112
+
113
113
+
frame_checkboxes = Frame(window)
114
114
+
frame_checkbox_attributes = Frame(frame_checkboxes)
115
115
+
variable_all_attributes = BooleanVar()
116
116
+
variable_all_attributes.set(False)
117
117
+
input_all_attributes = Checkbutton(frame_checkbox_attributes, text="Search ALL parameters",
118
118
+
variable=variable_all_attributes)
119
119
+
variables.update({"all_attributes": variable_all_attributes})
120
120
+
frame_checkbox_attributes.pack(side=LEFT)
121
121
+
input_all_attributes.pack()
122
122
+
123
123
+
frame_logging = Frame(frame_checkboxes)
124
124
+
variable_logging = BooleanVar()
125
125
+
variable_logging.set(False)
126
126
+
input_logging = Checkbutton(frame_logging, text="Verbose logging", variable=variable_logging)
127
127
+
variables.update({'logging':variable_logging})
128
128
+
frame_logging.pack(side=RIGHT)
129
129
+
frame_checkboxes.pack(side=BOTTOM)
130
130
+
input_logging.pack()
131
131
+
frame_all_attributes.pack()
122
132
123
133
return window, variables
124
134
+1
-1
tests/test_gui.py
···
7
7
pass
8
8
9
9
def test_empty_attributes(self):
10
10
-
self.test_gui = gui.GUI(None, '../GUI/gui.cfg.sample', in_source=False)
10
10
+
self.test_gui = gui.GUI(None, '../GUI/configuration.cfg', in_source=False)
11
11
self.test_gui.window.after(9, self.test_gui.prepare_search)
12
12
self.test_gui.window.after(11, self.test_gui.window.destroy)
13
13
self.test_gui.run()