| 1 #!/usr/local/bin/python3 |
1 #!/usr/local/bin/python3 |
| 2 |
2 |
| 3 import logging |
3 import logging |
| |
4 from threading import Thread |
| 4 |
5 |
| 5 logging.basicConfig(#filename='example.log', |
6 logging.basicConfig(#filename='example.log', |
| 6 format='%(levelname)s:%(message)s', |
7 format='%(levelname)s:%(message)s', |
| 7 level=logging.DEBUG) |
8 level=logging.DEBUG) |
| 8 |
9 |
| 9 from backup import Backup |
10 from backup import Backup |
| 10 from config import settings |
11 from config import settings |
| 11 from queue import Queue |
12 from queue import Queue |
| 12 from ui import BorgendTray |
13 from ui import BorgendTray |
| 13 |
14 import signal, os |
| 14 |
15 |
| 15 backupconfigs=settings['backups'] |
16 backupconfigs=settings['backups'] |
| 16 backups=[None]*len(backupconfigs); |
17 backups=[None]*len(backupconfigs); |
| 17 |
18 |
| 18 for i in range(len(backupconfigs)): |
19 for i in range(len(backupconfigs)): |
| 25 |
26 |
| 26 #backups[0].join() |
27 #backups[0].join() |
| 27 |
28 |
| 28 if __name__ == "__main__": |
29 if __name__ == "__main__": |
| 29 #print(settings) |
30 #print(settings) |
| 30 BorgendTray("Borgend").run() |
31 tray=BorgendTray("Borgend", backups); |
| 31 pass |
32 tray.run() |
| |
33 |
| |
34 # |
| |
35 # This shit is fucked, disables ^C etc., and threading doesn't seem to help |
| |
36 # |
| |
37 |
| |
38 # ui_thread=Thread(target=tray.run) |
| |
39 # ui_thread.daemon=True |
| |
40 # ui_thread.start() |
| |
41 |
| |
42 # def quit_signal_handler(signum, frame): |
| |
43 # print('Signal handler called with signal %s' % str(signum)) |
| |
44 # ui_thread.terminate() |
| |
45 # os.exit() |
| |
46 |
| |
47 # signal.signal(signal.SIGTERM, quit_signal_handler) |
| |
48 # signal.signal(signal.SIGINT, quit_signal_handler) |
| |
49 |