forked from zietzm/Helmholtz_Test_Bench
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from User_Interface import HelmholtzGUI
|
|
import cage_func as func
|
|
import traceback
|
|
import globals as g
|
|
from os.path import exists
|
|
|
|
try: # start normal operations
|
|
|
|
g.CONFIG_FILE = 'config.ini'
|
|
|
|
if not exists(g.CONFIG_FILE):
|
|
print("Config file not found, creating new from defaults.")
|
|
func.create_default_config(g.CONFIG_FILE)
|
|
|
|
print("Starting setup...")
|
|
func.setup_axes() # initiate communication, set handles
|
|
|
|
print("\nOpening User Interface...")
|
|
|
|
g.app = HelmholtzGUI()
|
|
func.ui_print("Program Initialized")
|
|
func.ui_print("Starting setup...") # do it again, so it is printed in the UI console
|
|
func.setup_axes() # initiate communication, set handles
|
|
g.app.mainloop()
|
|
g.app = None # reset to None so nothing tries to print in the UI output
|
|
|
|
|
|
except BaseException as e: # if there is an error, print what happened
|
|
func.ui_print("\nAn error occurred, Shutting down.")
|
|
func.ui_print(e)
|
|
func.ui_print(traceback.print_exc())
|
|
|
|
finally: # safely shut everything down at the end
|
|
func.shut_down_all()
|