Projekt

Obecné

Profil

Stáhnout (741 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
import logging
2
from threading import Thread
3

    
4
from tendo import singleton
5

    
6
from config_manager import logger_format, logger_level
7
from usb_detector.detector import register_listener, usb_detector_run
8
from usb_detector.event_listener import usb_connected_callback, usb_disconnected_callback
9

    
10

    
11
if __name__ == "__main__":
12
    app_instance = singleton.SingleInstance()
13

    
14
    logging.basicConfig(format=logger_format, level=logger_level)
15

    
16
    register_listener(callback=usb_connected_callback, connected=True)
17
    register_listener(callback=usb_disconnected_callback, connected=False)
18

    
19
    usb_detector_thread = Thread(target=usb_detector_run)
20
    usb_detector_thread.setDaemon(True)
21
    usb_detector_thread.start()
22

    
23
    usb_detector_thread.join()
(5-5/6)