Cleaned main.py. Renamed exit_flag global.

This commit is contained in:
2021-10-22 20:56:16 +02:00
parent f2c33f69fa
commit 5a3625021e
5 changed files with 56 additions and 52 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ class ExecCSVThread(Thread):
self.cage_dev.close()
# when the sequence has ended, reset buttons on the UI:
if not g.exitFlag: # main window is open
if not g.exit_flag: # main window is open
self.parent.select_file_button["state"] = "normal"
self.parent.execute_button["state"] = "normal"
self.parent.stop_button["state"] = "disabled"
@@ -79,7 +79,7 @@ class ExecCSVThread(Thread):
i = 0 # index of the current array row
while i < len(array):
if self.stopped or g.exitFlag:
if self.stopped or g.exit_flag:
# Interrupt sequence
ui_print("Sequence interrupted, powering down channels.")
# Channels powered down in run function
+1 -1
View File
@@ -22,7 +22,7 @@ global PORTS # list containing [XY_PORT, XY_PORT, Z_PORT], used in loops where
global threadLock # thread locking object, used to force threads to perform actions in a certain order (threading.Lock)
exitFlag = True # False when main window is open, True otherwise
exit_flag = True # False when main window is open, True otherwise
# Create dictionaries with default Constants and maximum/minimum values
# Used to create default configs and to check if user inputs are within safe limits
-2
View File
@@ -95,8 +95,6 @@ class HelmholtzCageDevice:
# TODO: Move to proxy
def connect_hardware(self):
"""Connects devices. Does not check if they are already connected: Remember to call shutdown first"""
time.sleep(3)
with self.hardware_lock:
# All devices are usable if the object exists. None indicates
# the device is not connected/not working properly
+1 -1
View File
@@ -7,7 +7,7 @@ def ui_print(*content):
"""prints text to built-in console, use exactly like normal print(). Requires the ui to be initialized"""
output = " ".join([str(c) for c in content])
if not g.exitFlag and g.app is not None: # application is still running --> output window is visible
if not g.exit_flag and g.app is not None: # application is still running --> output window is visible
output = "".join(("\n", output)) # begin new line each time
g.app.OutputConsole.console.insert(END, output) # print to console
g.app.OutputConsole.console.see(END) # scroll console to bottom