borgend.py

Sun, 21 Jan 2018 12:04:24 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 21 Jan 2018 12:04:24 +0000
changeset 29
9dd2e5d57a7c
parent 10
76dbfb06eba0
child 31
b4b4bb7a2ec5
permissions
-rwxr-xr-x

Something weird going on

#!/usr/local/bin/python3

import logging
from threading import Thread

logging.basicConfig(#filename='example.log',
                    format='%(levelname)s:%(message)s',
                    level=logging.DEBUG)

from backup import Backup
from config import settings
from queue import Queue
from ui import BorgendTray
import signal, os

backupconfigs=settings['backups']
backups=[None]*len(backupconfigs);

for i in range(len(backupconfigs)):
    logging.info('Setting up backup set %d' % i)
    backups[i]=Backup(i, backupconfigs[i])
    backups[i].schedule()

if __name__ == "__main__":
    #print(settings)
    tray=BorgendTray("Borgend", backups);
    tray.run()
    pass

    #
    # This shit is fucked, disables ^C etc., and threading doesn't seem to help
    #

    # ui_thread=Thread(target=tray.run)
    # ui_thread.daemon=True
    # ui_thread.start()

    # def quit_signal_handler(signum, frame):
    #     print('Signal handler called with signal %s' % str(signum))
    #     ui_thread.terminate()
    #     os.exit()

    # signal.signal(signal.SIGTERM, quit_signal_handler)
    # signal.signal(signal.SIGINT, quit_signal_handler)

mercurial