main.py 964 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env python3
  2. from sensors.acousticSensor import AcousticSensor
  3. from sensors.opticalSensor import OpticalSensor
  4. from gui.mainWindow import MainWindow
  5. import configparser
  6. import tkinter as tk
  7. import traceback
  8. import logHandler
  9. conf = configparser.ConfigParser()
  10. conf.read('config.ini')
  11. def main():
  12. log_handler = logHandler.get_log_handler(int(conf['gui']['log_lines']))
  13. ac_sensor = AcousticSensor(conf)
  14. opt_sensor = OpticalSensor(conf)
  15. try:
  16. ac_sensor.start()
  17. opt_sensor.start()
  18. root = tk.Tk()
  19. root.title("Tracking System")
  20. root.attributes('-fullscreen', conf['gui']['fullscreen'] == "yes")
  21. view = MainWindow(root, conf, ac_sensor, opt_sensor)
  22. view.pack(side="top", fill="both", expand=True)
  23. view.update()
  24. root.mainloop()
  25. except KeyboardInterrupt:
  26. print("stop")
  27. except Exception as e:
  28. print("Error: ",e)
  29. traceback.print_exc()
  30. finally:
  31. ac_sensor.stop()
  32. opt_sensor.stop()
  33. main()