main.py 963 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from sensors.acousticSensor import AcousticSensor
  2. from sensors.calibration import CalibrationStateMashine
  3. from gui.mainWindow import MainWindow
  4. import queue
  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()
  13. ac_queue = queue.Queue()
  14. ac_calibration_state = CalibrationStateMashine(log_handler)
  15. ac_sensor = AcousticSensor(conf, ac_queue, ac_calibration_state)
  16. try:
  17. ac_sensor.start()
  18. root = tk.Tk()
  19. root.title("Tracking System")
  20. root.attributes('-fullscreen', True)
  21. view = MainWindow(root, ac_sensor, ac_queue, ac_calibration_state, conf)
  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. main()