Proof of concept settings system
This commit is contained in:
parent
3dc4d28f2f
commit
6180d04bc5
1 changed files with 25 additions and 0 deletions
25
settings.py
Normal file
25
settings.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import configparser
|
||||||
|
import os
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config['pomodoro'] = {}
|
||||||
|
pomodoro = config['pomodoro']
|
||||||
|
|
||||||
|
if not os.path.isfile('settings.ini'):
|
||||||
|
# Set some essential initial values.
|
||||||
|
pomodoro['logfile'] = '~/Projects/agaric/python/pomodoroprompt/logs/2021.csv'
|
||||||
|
with open('settings.ini', 'w') as configfile:
|
||||||
|
config.write(configfile)
|
||||||
|
|
||||||
|
config.read('settings.ini')
|
||||||
|
|
||||||
|
def pomodoro_logfile():
|
||||||
|
return config['pomodoro']['logfile']
|
||||||
|
|
||||||
|
def pomodoro_latest_start(value = None):
|
||||||
|
if value:
|
||||||
|
pomodoro.set('latest_start', value)
|
||||||
|
else:
|
||||||
|
return pomodoro.get('latest_start', None)
|
Loading…
Reference in a new issue