From c9ac507ab59e95756a34217fe4dc25d9110f72c8 Mon Sep 17 00:00:00 2001
From: anima
Date: Tue, 15 Jun 2021 17:27:07 +0200
Subject: [PATCH] config file extended by categories, clients, references
---
timeTrack.py | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/timeTrack.py b/timeTrack.py
index 0f47e39..aa06f81 100644
--- a/timeTrack.py
+++ b/timeTrack.py
@@ -23,8 +23,11 @@ class TimeTrack:
self.USERID = 0
self.USERNAME = ''
self.OLDEVENT = 2
+ self.CLIENTS = False
+ self.CATEGORIES = False
+ self.REFERENCES = False
self.LOGFILE = 'timetrack.log'
- self.DBCON = sqlite3.connect(self.DATABASE, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
+ self.DBCON = sqlite3.connect(self.DATABASE, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
logging.basicConfig(
filename=self.LOGFILE,
level=logging.DEBUG,
@@ -61,17 +64,23 @@ class TimeTrack:
quit()
else:
logging.info('Config file was loaded successfully')
- self.USERID = data['user']
- self.OLDEVENT = data['oldevent']
- logging.debug('UserID {} was used'.format(data['user']))
+ self.USERID = data['userid']
+ self.OLDEVENT = data['oldevent']
+ self.CLIENTS = data['clients']
+ self.CATEGORIES = data['categories']
+ self.REFERENCES = data['references']
+ logging.debug('UserID {} was used'.format(data['userid']))
self.set_user()
else:
logging.warning('Config file not found')
config = {
'default' : 'interactive',
- 'user' : 1,
- 'oldevent' : 2
+ 'userid' : 1,
+ 'oldevent' : 2,
+ 'clients' : False,
+ 'categories' : False,
+ 'references' : False
}
with open(self.CONFIG, "w") as outfile:
json.dump(config, outfile, indent=4, sort_keys=True)