forked from zietzm/Helmholtz_Test_Bench
enabled and added callable status display updates
This commit is contained in:
+11
-4
@@ -90,6 +90,8 @@ class ManualMode(Frame):
|
||||
def __init__(self, parent, controller):
|
||||
Frame.__init__(self, parent)
|
||||
|
||||
self.controller = controller # object on which mainloop() is running, usually main window
|
||||
|
||||
self.grid_rowconfigure(ALL, weight=1)
|
||||
self.grid_columnconfigure(ALL, weight=1)
|
||||
|
||||
@@ -230,6 +232,7 @@ class ManualMode(Frame):
|
||||
vector[i] = float(var.get())
|
||||
i = i + 1
|
||||
function_to_call(vector) # call function
|
||||
self.controller.StatusDisplay.update_labels() # update status display after change
|
||||
|
||||
def execute_field(self, vector):
|
||||
func.ui_print("field executing", vector)
|
||||
@@ -512,6 +515,7 @@ class ExecuteCSVMode(Frame):
|
||||
|
||||
def __init__(self, parent, controller):
|
||||
Frame.__init__(self, parent)
|
||||
self.controller = controller # object on which mainloop() is running, usually main window
|
||||
|
||||
# Functional init:
|
||||
self.sequence_array = None # array containing the values from the csv file
|
||||
@@ -580,7 +584,7 @@ class ExecuteCSVMode(Frame):
|
||||
# g.threadLock = threading.Lock()
|
||||
# create separate thread to run sequence execution in:
|
||||
g.running = True
|
||||
csv_thread = csv.ExecCSVThread("CSV_Thread", self.sequence_array, self)
|
||||
csv_thread = csv.ExecCSVThread("CSV_Thread", self.sequence_array, self, self.controller)
|
||||
csv_thread.start() # start thread
|
||||
|
||||
def stop_run(self):
|
||||
@@ -637,9 +641,13 @@ class StatusDisplay(Frame):
|
||||
col = col + 1
|
||||
# rowCounter = rowCounter + self.rowNo # increase row counter to place future stuff below this
|
||||
|
||||
self.update_labels(controller)
|
||||
self.continuous_label_update(controller, 500) # initiate regular value updates (ms)
|
||||
|
||||
def update_labels(self, controller):
|
||||
def continuous_label_update(self, controller, interval): # update display values in regular intervals
|
||||
self.update_labels()
|
||||
controller.after(interval, lambda: self.continuous_label_update(controller, interval))
|
||||
|
||||
def update_labels(self):
|
||||
g.ARDUINO.update_status_info()
|
||||
i = 0
|
||||
for axis in g.AXES:
|
||||
@@ -660,7 +668,6 @@ class StatusDisplay(Frame):
|
||||
self.label_dict["Target Current:"][i].set("%0.3f A" % axis.target_current)
|
||||
self.label_dict["Inverted:"][i].set(axis.polarity_switched)
|
||||
i = i + 1
|
||||
controller.after(500, lambda: self.update_labels(controller))
|
||||
|
||||
|
||||
class OutputConsole(Frame): # console to print stuff in, similar to standard python output
|
||||
|
||||
Reference in New Issue
Block a user