summaryrefslogtreecommitdiff
path: root/voctogui/lib/config.py
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-23 10:43:56 +0200
committerMaZderMind <github@mazdermind.de>2015-05-23 10:44:11 +0200
commite1fae24a3b145d42eaa40d62f7aed8f00d6bdf51 (patch)
treecb38d834e72435ab6e5aba48bcf1b0abed0ec703 /voctogui/lib/config.py
parentf59f27430b221fa5cd395ed6c747d282bcb18246 (diff)
basic gui
Diffstat (limited to 'voctogui/lib/config.py')
-rw-r--r--voctogui/lib/config.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/voctogui/lib/config.py b/voctogui/lib/config.py
new file mode 100644
index 0000000..b06075c
--- /dev/null
+++ b/voctogui/lib/config.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python3
+import os.path
+from configparser import SafeConfigParser
+from lib.args import Args
+
+__all__ = ['Config']
+
+def getlist(self, section, option):
+ return [x.strip() for x in self.get(section, option).split(',')]
+
+SafeConfigParser.getlist = getlist
+
+files = [
+ os.path.join(os.path.dirname(os.path.realpath(__file__)), '../default-config.ini'),
+ os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config.ini'),
+ '/etc/voctogui.ini',
+ os.path.expanduser('~/.voctogui.ini'),
+]
+
+if Args.ini_file is not None:
+ files.append(Args.ini_file)
+
+Config = SafeConfigParser()
+Config.read(files)