A Curses based CalDAV Agenda that really works with NextCloud
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

47 lines
1.7 KiB

#!/usr/bin/env python3
# -*- coding: utf-8
import os
import locale
import curses
import inspect
import configparser
from logger import Logger
from cursesmgr import Cursesmgr
from displaymgr import Displaymgr
from calendarmgr import Calendarmgr
from inputmgr import Inputmgr
if __name__ == '__main__' :
logger = None
curses_manager = None
LOCAL_CONFIG_FILENAME = 'config.local.ini'
if not os.path.exists(LOCAL_CONFIG_FILENAME):
print("\033[91mError: Config file not found: %s\033[0m" % LOCAL_CONFIG_FILENAME)
exit(1)
config = configparser.ConfigParser()
try:
config.read(LOCAL_CONFIG_FILENAME)
locale.setlocale(locale.LC_TIME, config['global']['locale'])
logger = Logger(config['logger']['level'], config['logger']['logfile'])
logger.info("Starting application...")
curses_manager = Cursesmgr(logger)
display_manager = Displaymgr(config['global']['timezone'], logger)
calendar_manager = Calendarmgr(config['calendar']['scheme'],
config['calendar']['url'],
config['calendar']['user'],
config['calendar']['passwd'],
config['calendar']['collection'],
config['global']['timezone'],
logger)
input_manager = Inputmgr(curses_manager, display_manager, calendar_manager, logger)
input_manager.run()
logger.info('[+] Quitting')
except Exception as e:
if logger:
logger.critical('[%s %s()]: %s "%s"' % ('calterm.py', inspect.currentframe().f_code.co_name, e.__class__, e))
if curses_manager:
curses_manager.end()
print("\033[91mError at startup: %s\033[0m" % str(e))
exit(1)