-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
71 lines (60 loc) · 1.84 KB
/
config.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import storage
def _readConfig(f):
try:
return storage.json.load(f)
except IOError:
return []
dir_path = os.path.dirname(os.path.realpath(__file__))
defaultConfig = _readConfig(dir_path + '/config_default.json')
userConfig = _readConfig(dir_path + '/config.json')
overrides = {}
# File name of main data store
def log():
return _getConfigValue('log') + ".yaml"
# File name of txt for exporting
def export():
return _getConfigValue('export')
# Repository to sync worktimes to
def syncRepoUrl():
return _getConfigValue('sync_repo_url')
def syncRepoBranch():
return _getConfigValue('sync_repo_branch')
def autoSync():
return _getConfigValue("sync_automatically")
# Print notices to macOS notification center as well as shell
def notifications():
return _getConfigValue('notifications')
def hoursPerDay():
return _getConfigValue('hours_per_day')
# Send an iMessage to a contact when ending a timer
def imessage():
return _getConfigValue('imessage')
def imessage_address():
return _getConfigValue('imessage_address')
def imessage_text():
return _getConfigValue('imessage_text')
# TextBar mode (http://richsomerfield.com/apps/textbar/)
def textbar():
return _getConfigValue('textbar')
def default_category():
return _getConfigValue('default_category')
def categories():
return _getConfigValue('categories')
def log_path():
return dir_path + "/" + log()
def export_path():
return dir_path + '/' + export()
def xlsx_template():
return _getConfigValue('xlsx_template')
def ods_template():
return _getConfigValue('ods_template')
def _getConfigValue(s):
if s in overrides:
return overrides[s]
if s in userConfig:
return userConfig[s]
elif s in defaultConfig:
return defaultConfig[s]
else:
raise ValueError('Config value %s missing' % s)