minor UI tweaks

- fixed bug where log data could not be cleared after saving to file
- added description for coil constant in settings page
- minor message tweaks
This commit is contained in:
Martin Zietz
2021-03-08 18:36:23 +01:00
parent 12de3c3587
commit 640d99c9e2
3 changed files with 12 additions and 6 deletions
+10 -4
View File
@@ -574,7 +574,8 @@ class Configuration(Frame):
# Setup dictionary to generate entry table from
# {Key: [[x-value,y-value,z-value], unit, description, config file key, unit conversion factor]}
self.entries = {
"Coil Constants:": [[DoubleVar() for _ in range(3)], "\u03BCT/A", "", "coil_const", 1e6],
"Coil Constants:": [[DoubleVar() for _ in range(3)], "\u03BCT/A", "Field generated per applied current",
"coil_const", 1e6],
"Ambient Field:": [[DoubleVar() for _ in range(3)], "\u03BCT",
"Field to be compensated", "ambient_field", 1e6],
"Resistances:": [[DoubleVar() for _ in range(3)], "\u03A9",
@@ -958,18 +959,22 @@ class ConfigureLogging(Frame):
def clear_data(self): # called on button press, asks user if he want to save logged data and then deletes it
if log.unsaved_data: # there is logged data that has not been written to a file yet
# open pop-up to ask user if he wants to save the data:
# open pop-up to ask user if he wants to save the data or cancel clearing it:
save_log = messagebox.askyesnocancel("Save log data?", "There seems to be unsaved logging data. "
"Do you wish to write it to a file before deleting?")
if save_log: # user has chosen yes
self.write_to_file() # run write to file function to save data
if save_log is not None:
if save_log is not None: # user has chosen yes or no (not cancel)
log.clear_logged_data() # delete the logged data
log.unsaved_data = False # tell everything that there is no unsaved data remaining
self.logged_datapoints.set(len(log.log_data)) # update the label showing how much data has been logged
ui_print("Log data cleared.")
else:
else: # user has chosen to cancel
ui_print("Log data not cleared.")
else: # there is no unsaved data
log.clear_logged_data() # delete the logged data
self.logged_datapoints.set(len(log.log_data)) # update the label showing how much data has been logged
ui_print("Log data cleared.")
def update_choices(self): # updates the list storing which checkboxes are currently ticked
# (this is passed to logging functions and determines which data is logged)
@@ -1092,6 +1097,7 @@ class StatusDisplay(Frame):
self.label_dict["Trgt. Field Raw:"][i].set("%0.3f \u03BCT" % (axis.target_field_comp * 1e6))
self.label_dict["Target Current:"][i].set("%0.3f A" % axis.target_current)
self.label_dict["Inverted:"][i].set(axis.polarity_switched)
print(axis.name, axis.polarity_switched)
i += 1
+1 -1
View File
@@ -251,7 +251,7 @@ def setup_all(): # main test stand initialization function
g.PORTS = [g.XY_PORT, g.XY_PORT, g.Z_PORT] # write list with PSU port for each axis (X/Y share PSU)
# setup PSU and axis objects for X and Y axes:
ui_print("\nConnecting to XY Device on %s..." % g.XY_PORT)
ui_print("Connecting to XY Device on %s..." % g.XY_PORT)
try: # try to connect to the PSU
if g.XY_DEVICE is not None: # if PSU has previously been connected we need to close the serial link first
ui_print("Closing serial connection on XY device")
+1 -1
View File
@@ -71,7 +71,7 @@ def select_file(): # select a file to write logs to
defaultextension=[("Comma Separated Values", "*.csv*")])
if filepath == '': # this happens when file selection window is closed without selecting a file
ui.ui_print("No file selected, can not save logged data.")
ui.ui_print("No file selected, can't save logged data.")
return None
else: # a valid file name was entered
return filepath