30 lines
699 B
Python
30 lines
699 B
Python
#!/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'
|
|
write()
|
|
|
|
config.read('settings.ini')
|
|
|
|
|
|
def write():
|
|
with open('settings.ini', 'w') as configfile:
|
|
config.write(configfile)
|
|
|
|
def pomodoro_logfile():
|
|
return config['pomodoro']['logfile']
|
|
|
|
def pomodoro_latest_recorded(value = None):
|
|
if value:
|
|
pomodoro.set('latest_recorded', value)
|
|
write()
|
|
else:
|
|
return pomodoro.get('latest_recorded', None)
|