ConfigImporter in it's own file
This commit is contained in:
parent
d0d0f9f72d
commit
f81addc2f0
30
GUI/configImporter.py
Normal file
30
GUI/configImporter.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import ConfigParser
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigImporter():
|
||||||
|
def __init__(self, filename):
|
||||||
|
"""Read the filename into the parser."""
|
||||||
|
self.filename = filename
|
||||||
|
self.parser = ConfigParser.ConfigParser()
|
||||||
|
self.parser.read(self.filename)
|
||||||
|
|
||||||
|
def load_common_attributes(self):
|
||||||
|
"""Loads common attributes from the initialized file."""
|
||||||
|
try:
|
||||||
|
return self.parser.get('GUI_Options', 'CommonParameters')
|
||||||
|
except:
|
||||||
|
return 'One, Two, Three'
|
||||||
|
|
||||||
|
def load_output_types(self):
|
||||||
|
"""Loads output types from the initialized file."""
|
||||||
|
try:
|
||||||
|
return self.parser.get('GUI_Options', 'OutputTypes')
|
||||||
|
except:
|
||||||
|
return 'csv'
|
||||||
|
|
||||||
|
def load_always_attributes(self):
|
||||||
|
"""Loads attributes that are always searched for from the initialized file."""
|
||||||
|
try:
|
||||||
|
return self.parser.get('GUI_Options', 'AlwaysParameters')
|
||||||
|
except:
|
||||||
|
return 'Name, Weight'
|
29
GUI/gui.py
29
GUI/gui.py
@ -1,36 +1,9 @@
|
|||||||
from Tkinter import *
|
from Tkinter import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class ConfigImporter():
|
from configImporter import *
|
||||||
def __init__(self, filename):
|
|
||||||
"""Read the filename into the parser."""
|
|
||||||
import ConfigParser
|
|
||||||
self.filename = filename
|
|
||||||
self.parser = ConfigParser.ConfigParser()
|
|
||||||
self.parser.read(self.filename)
|
|
||||||
|
|
||||||
|
|
||||||
def load_common_attributes(self):
|
|
||||||
"""Loads common attributes from the initialized file."""
|
|
||||||
try:
|
|
||||||
return self.parser.get('GUI_Options', 'CommonParameters')
|
|
||||||
except:
|
|
||||||
return 'One, Two, Three'
|
|
||||||
|
|
||||||
def load_output_types(self):
|
|
||||||
"""Loads output types from the initialized file."""
|
|
||||||
try:
|
|
||||||
return self.parser.get('GUI_Options', 'OutputTypes')
|
|
||||||
except:
|
|
||||||
return 'csv'
|
|
||||||
|
|
||||||
def load_always_attributes(self):
|
|
||||||
"""Loads attributes that are always searched for from the initialized file."""
|
|
||||||
try:
|
|
||||||
return self.parser.get('GUI_Options', 'AlwaysParameters')
|
|
||||||
except:
|
|
||||||
return 'Name, Weight'
|
|
||||||
|
|
||||||
class GUI():
|
class GUI():
|
||||||
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader=None, in_source=True):
|
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader=None, in_source=True):
|
||||||
"""Boots the window, configuration."""
|
"""Boots the window, configuration."""
|
||||||
|
Reference in New Issue
Block a user