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
ConfigImporter in it's own file
dekker.one
11 years ago
f81addc2
d0d0f9f7
+33
-30
2 changed files
expand all
collapse all
unified
split
GUI
configImporter.py
gui.py
+30
GUI/configImporter.py
···
1
1
+
import ConfigParser
2
2
+
3
3
+
4
4
+
class ConfigImporter():
5
5
+
def __init__(self, filename):
6
6
+
"""Read the filename into the parser."""
7
7
+
self.filename = filename
8
8
+
self.parser = ConfigParser.ConfigParser()
9
9
+
self.parser.read(self.filename)
10
10
+
11
11
+
def load_common_attributes(self):
12
12
+
"""Loads common attributes from the initialized file."""
13
13
+
try:
14
14
+
return self.parser.get('GUI_Options', 'CommonParameters')
15
15
+
except:
16
16
+
return 'One, Two, Three'
17
17
+
18
18
+
def load_output_types(self):
19
19
+
"""Loads output types from the initialized file."""
20
20
+
try:
21
21
+
return self.parser.get('GUI_Options', 'OutputTypes')
22
22
+
except:
23
23
+
return 'csv'
24
24
+
25
25
+
def load_always_attributes(self):
26
26
+
"""Loads attributes that are always searched for from the initialized file."""
27
27
+
try:
28
28
+
return self.parser.get('GUI_Options', 'AlwaysParameters')
29
29
+
except:
30
30
+
return 'Name, Weight'
+3
-30
GUI/gui.py
···
1
1
from Tkinter import *
2
2
import os
3
3
4
4
-
class ConfigImporter():
5
5
-
def __init__(self, filename):
6
6
-
"""Read the filename into the parser."""
7
7
-
import ConfigParser
8
8
-
self.filename = filename
9
9
-
self.parser = ConfigParser.ConfigParser()
10
10
-
self.parser.read(self.filename)
11
11
-
4
4
+
from configImporter import *
12
5
13
13
-
def load_common_attributes(self):
14
14
-
"""Loads common attributes from the initialized file."""
15
15
-
try:
16
16
-
return self.parser.get('GUI_Options', 'CommonParameters')
17
17
-
except:
18
18
-
return 'One, Two, Three'
19
19
-
20
20
-
def load_output_types(self):
21
21
-
"""Loads output types from the initialized file."""
22
22
-
try:
23
23
-
return self.parser.get('GUI_Options', 'OutputTypes')
24
24
-
except:
25
25
-
return 'csv'
26
26
-
27
27
-
def load_always_attributes(self):
28
28
-
"""Loads attributes that are always searched for from the initialized file."""
29
29
-
try:
30
30
-
return self.parser.get('GUI_Options', 'AlwaysParameters')
31
31
-
except:
32
32
-
return 'Name, Weight'
33
6
34
7
class GUI():
35
35
-
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader = None, in_source=True):
8
8
+
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader=None, in_source=True):
36
9
"""Boots the window, configuration."""
37
10
if in_source:
38
11
current_dir = os.path.dirname(os.path.abspath(__file__))
···
168
141
print "No known class, {}, {}".format(name, var)
169
142
170
143
self.values = values
171
171
-
if all([values.get(i)!='' for i in self.required_variables]):
144
144
+
if all([values.get(i) != '' for i in self.required_variables]):
172
145
self.finish_with_search = True
173
146
self.window.destroy()
174
147
else: