34 lines
967 B
Python
34 lines
967 B
Python
import configparser
|
|
|
|
|
|
class Config(object):
|
|
""" Config Class, parses the arguments and the config from the flashairup.conf ini file"""
|
|
def __init__(self, arguments):
|
|
""" read arguments dicts as a base """
|
|
|
|
self.arguments = arguments
|
|
|
|
# Read settings from flashairup.conf ini configfile
|
|
self.configfile = "flashairup.conf"
|
|
self.conf = configparser.ConfigParser()
|
|
|
|
|
|
def load(self):
|
|
""" loads the config file"""
|
|
self.conf.read(self.configfile)
|
|
|
|
|
|
# def write(self):
|
|
# print("writing the following config to file..\n")
|
|
# self.print()
|
|
# with open('flashairup.conf', 'w') as configf:
|
|
# self.conf.write(configf)
|
|
#
|
|
#
|
|
# def print(self):
|
|
# for section in ['DEFAULT'] + self.conf.sections() :
|
|
# print('[' + section + ']')
|
|
# for key in self.conf[section]:
|
|
# print(key + ' = ' + self.conf[section][key])
|
|
# print('\n')
|