main.py 975 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python3
  2. from sensors.acousticSensor import AcousticSensor
  3. from sensors.calibration import CalibrationStateMashine
  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_calibration_state = CalibrationStateMashine()
  14. ac_sensor = AcousticSensor(conf, ac_calibration_state)
  15. try:
  16. ac_sensor.start()
  17. root = tk.Tk()
  18. root.title("Tracking System")
  19. root.attributes('-fullscreen', conf['gui']['fullscreen'] == "yes")
  20. view = MainWindow(root, ac_sensor, ac_calibration_state, conf)
  21. view.pack(side="top", fill="both", expand=True)
  22. view.update()
  23. root.mainloop()
  24. except KeyboardInterrupt:
  25. print("stop")
  26. except Exception as e:
  27. print("Error: ",e)
  28. traceback.print_exc()
  29. finally:
  30. ac_sensor.stop()
  31. main()