-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
51 lines (41 loc) · 977 Bytes
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
SETTINGS_FILE = 'settings.txt'
DEFAULT_SETTINGS = """\
trayToolTip AtomLauncher
trayIcon atom.png
launchHotKey alt-enter
quitHotKey alt-Q
"""
def readSettingsFile():
settings = {}
if not os.path.isfile(SETTINGS_FILE):
with open(SETTINGS_FILE, 'w') as settingsFile:
settingsFile.write(DEFAULT_SETTINGS)
print 'Settings File Created'
readSettingsFile()
else:
with open(SETTINGS_FILE, 'r') as settingsFile:
for line in settingsFile:
typeBuffer = ''
setBuffer = ''
setSetting = False
for c in line:
if not(typeBuffer == '' and c == '\n'):
if c == '\n':
settings[typeBuffer] = setBuffer
typeBuffer = ''
setBuffer = ''
setSetting = False
else:
if c == ' ':
setSetting = True
else:
if not setSetting:
typeBuffer += c
else:
setBuffer += c
return settings
def checkSettingsFile():
print 'test'
#readSettingsFile()
#print settings